|
|
@@ -897,12 +897,12 @@ export default {
|
|
|
}
|
|
|
|
|
|
this.scrLoading[tabName].next = true;
|
|
|
+ // 与 liveUserTotals 口径一致:在线/离线仅非禁言;禁言不限在线状态
|
|
|
const queryParams = {
|
|
|
liveId: this.liveId,
|
|
|
pageNum: params.currentPage,
|
|
|
pageSize: 20,
|
|
|
- online: tabName === 'online' ? 0 : 1,
|
|
|
- msgStatus: tabName === 'silenced' ? 1 : 0
|
|
|
+ ...this.buildWatchUserQuery(tabName)
|
|
|
};
|
|
|
// 调用接口加载对应状态的分页数据(需后端支持按状态筛选)
|
|
|
watchUserList(queryParams).then(response => {
|
|
|
@@ -911,6 +911,14 @@ export default {
|
|
|
|
|
|
const { rows, total } = response;
|
|
|
params.total = total; // 记录总数据量
|
|
|
+ // Tab 角标与列表接口 total 保持一致
|
|
|
+ if (tabName === 'online') {
|
|
|
+ this.userTotal.online = total || 0;
|
|
|
+ } else if (tabName === 'offline') {
|
|
|
+ this.userTotal.offline = total || 0;
|
|
|
+ } else if (tabName === 'silenced') {
|
|
|
+ this.userTotal.silenced = total || 0;
|
|
|
+ }
|
|
|
// 过滤重复数据(基于userId)
|
|
|
const newRows = rows.filter(row =>
|
|
|
!displayList.some(u => u.userId === row.userId)
|
|
|
@@ -953,8 +961,7 @@ export default {
|
|
|
liveId: this.liveId,
|
|
|
pageNum: targetPage,
|
|
|
pageSize: 20,
|
|
|
- online: tabName === 'online' ? 0 : 1,
|
|
|
- msgStatus: tabName === 'silenced' ? 1 : 0
|
|
|
+ ...this.buildWatchUserQuery(tabName)
|
|
|
};
|
|
|
watchUserList(queryParams).then(response => {
|
|
|
this.scrLoading[tabName].prev = false;
|
|
|
@@ -997,6 +1004,17 @@ export default {
|
|
|
this.scrLoading[tabName].prev = false;
|
|
|
});
|
|
|
},
|
|
|
+ // 与 liveUserTotals 统计口径一致的筛选条件
|
|
|
+ buildWatchUserQuery(tabName) {
|
|
|
+ if (tabName === 'silenced') {
|
|
|
+ return { msgStatus: 1 };
|
|
|
+ }
|
|
|
+ if (tabName === 'online') {
|
|
|
+ return { online: 0, msgStatus: 0 };
|
|
|
+ }
|
|
|
+ // offline
|
|
|
+ return { online: 1, msgStatus: 0 };
|
|
|
+ },
|
|
|
// 辅助:获取Tab对应的滚动容器
|
|
|
getScrollElement(tabName) {
|
|
|
const scrollRefs = {
|