Skip to content

Commit 80f46b7

Browse files
author
Taois
committed
feat:搜索结果在底部工具栏统计
1 parent 7ecf575 commit 80f46b7

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

dashboard/src/stores/paginationStore.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ export const usePaginationStore = defineStore('pagination', {
2020
// 设置当前路由
2121
setCurrentRoute(route) {
2222
this.currentRoute = route;
23-
// 如果不是点播页面,清除统计信息
24-
if (route !== '/video') {
23+
// 如果不是点播页面或搜索页面,清除统计信息
24+
if (route !== '/video' && route !== '/search') {
2525
this.clearStats();
2626
}
2727
}
2828
},
2929
getters: {
30-
// 是否应该显示统计信息(在点播页面且有统计文本
31-
shouldShow: (state) => state.isVisible && state.currentRoute === '/video'
30+
// 是否应该显示统计信息(在点播页面或搜索页面且有统计文本
31+
shouldShow: (state) => state.isVisible && (state.currentRoute === '/video' || state.currentRoute === '/search')
3232
}
3333
});

dashboard/src/views/SearchAggregation.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,15 +693,26 @@ export default defineComponent({
693693
694694
// 更新全局统计信息
695695
const updateGlobalStats = () => {
696+
console.log('[updateGlobalStats] 更新全局统计信息');
696697
if (!activeSource.value || !searchResults.value[activeSource.value]) {
697-
paginationStore.updateStats(0, 0, 0);
698+
paginationStore.updateStats('');
698699
return;
699700
}
700701
701702
const totalResults = searchResults.value[activeSource.value].length;
702703
const displayedResults = Math.min(displayedCount.value, totalResults);
704+
const sourceName = getSourceName(activeSource.value);
703705
704-
paginationStore.updateStats(displayedResults, totalResults, 1);
706+
let statsText = `搜索"${searchKeyword.value}":${sourceName} - 已显示${displayedResults}条,共${totalResults}`;
707+
// 检查是否还有更多数据可以加载
708+
const hasMore = hasMoreData.value;
709+
if (hasMore) {
710+
statsText += ',可继续加载';
711+
} else if (totalResults > 0) {
712+
statsText += ',已全部加载';
713+
}
714+
console.log('[updateGlobalStats] <statsText>:', statsText);
715+
paginationStore.updateStats(statsText);
705716
};
706717
707718
// ActionRenderer相关方法

0 commit comments

Comments
 (0)