From 14a94d1fb1ea79fcbb040d32da60c3671f2df6e2 Mon Sep 17 00:00:00 2001 From: zhangsir Date: Wed, 16 Oct 2024 16:49:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8E=92=E8=A1=8C=E6=A6=9C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/user/ranking.vue | 48 +++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/src/views/user/ranking.vue b/src/views/user/ranking.vue index 393d4ddd..38f2070b 100644 --- a/src/views/user/ranking.vue +++ b/src/views/user/ranking.vue @@ -382,7 +382,7 @@ export default { aid:this.userInfo.aid,// #用户id statType:21, // #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数 field:this.experience.field,// #统计周期 todays-当天,weeks-周,months-月,years-年 total-总计 - num:5,// #显示的条数 + num:10,// #显示的条数 } if(data.field == 'now'){ data.statType = 20 @@ -421,8 +421,26 @@ export default { sex: null } }) - this.getUserData(ids,res.result.rankingData) - this.experience.list = res.result.rankingData; + // this.getUserData(ids,res.result.rankingData) + const noReapetIds = [...new Set(ids)]; + apiUser.getByIds(noReapetIds).then(rs => { + if (rs.status == 200) { + const listData = [] + rs.result.forEach((item, index) => { + res.result.rankingData.forEach(author => { + if (author.aid == item.aid) { + author.authorInfo = item; + listData.push(author) + } + }); + }); + this.experience.list = listData.sort((a,b)=>{ + return b.total-a.total + }).slice(0,5); + } else { + this.$message.error(res.message); + } + }); } }) }, @@ -431,7 +449,7 @@ export default { aid:this.userInfo.aid,// #用户id statType:12, // #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数 field:this.learningDuration.field,// #统计周期 todays-当天,weeks-周,months-月,years-年 total-总计 - num:5,// #显示的条数 + num:10,// #显示的条数 } if(data.field == 'now'){ data.statType = 10 @@ -469,8 +487,26 @@ export default { sex: null } }) - this.getUserData(ids,res.result.rankingData) - this.learningDuration.list = res.result.rankingData; + // this.getUserData(ids,res.result.rankingData) + const noReapetIds = [...new Set(ids)]; + apiUser.getByIds(noReapetIds).then(rs => { + if (rs.status == 200) { + const listData = [] + rs.result.forEach((item, index) => { + res.result.rankingData.forEach(author => { + if (author.aid == item.aid) { + author.authorInfo = item; + listData.push(author) + } + }); + }); + this.learningDuration.list = listData.sort((a,b)=>{ + return b.total-a.total + }).slice(0,5); + } else { + this.$message.error(res.message); + } + }); } }) }, From 0ebbb0399fbb5b8e8150d6f84b7f1f5fa436ea71 Mon Sep 17 00:00:00 2001 From: zhangsir Date: Thu, 17 Oct 2024 09:13:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E5=A4=A9=E6=95=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/user/ranking.vue | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/views/user/ranking.vue b/src/views/user/ranking.vue index 38f2070b..a0f66295 100644 --- a/src/views/user/ranking.vue +++ b/src/views/user/ranking.vue @@ -516,7 +516,7 @@ export default { aid:this.userInfo.aid,// #用户id statType:11, // #统计类型 10学习时长 11 学习天数 20表经验值 30表u币 40表获取天数 field:this.learningDays.field,// #统计周期 todays-当天,weeks-周,months-月,years-年 total-总计 - num:5,// #显示的条数 + num:10,// #显示的条数 } if(data.field == 'now'){ data.statType = 13 @@ -553,8 +553,26 @@ export default { sex: null } }) - this.getUserData(ids,res.result.rankingData) - this.learningDays.list = res.result.rankingData; + // this.getUserData(ids,res.result.rankingData) + const noReapetIds = [...new Set(ids)]; + apiUser.getByIds(noReapetIds).then(rs => { + if (rs.status == 200) { + const listData = [] + rs.result.forEach((item, index) => { + res.result.rankingData.forEach(author => { + if (author.aid == item.aid) { + author.authorInfo = item; + listData.push(author) + } + }); + }); + this.learningDays.list = listData.sort((a,b)=>{ + return b.total-a.total + }).slice(0,5); + } else { + this.$message.error(res.message); + } + }); } }) },