feat(抽奖活动页): 修复获取我的排名的问题

This commit is contained in:
hzj 2025-10-23 17:56:01 +08:00
parent b82a639868
commit 00b79cdcc8

View File

@ -1178,8 +1178,14 @@ const getUserInfo = async () => {
if (Object.keys(userInfo.value).length === 0) { if (Object.keys(userInfo.value).length === 0) {
const resUserInfo = await getMemberProfile() const resUserInfo = await getMemberProfile()
if (resUserInfo.status && resUserInfo.body) { if (resUserInfo.status && resUserInfo.body) {
userInfo.value = if (ranking.value.length == 0) {
userInfo.value == {} ? resUserInfo.body : Object.assign(userInfo.value, resUserInfo.body) userInfo.value = resUserInfo.body
} else {
//
const myInfo = ranking.value.find((item) => item.account == resUserInfo.body.account)
console.log('myInfo:', myInfo)
userInfo.value = Object.assign(resUserInfo.body, myInfo)
}
} }
} }
const resIdentity = await getUserIdentity() const resIdentity = await getUserIdentity()
@ -1315,12 +1321,14 @@ const getRanking = async () => {
const resRanking = await ranklist() const resRanking = await ranklist()
if (resRanking.status && resRanking.body) { if (resRanking.status && resRanking.body) {
ranking.value = resRanking.body ranking.value = resRanking.body
// if (Object.keys(userInfo.value).length != 0) {
const myInfo = ranking.value.find((item) => item.account == userInfo.value.account) //
console.log('myInfo:', myInfo) const myInfo = resRanking.body.find((item) => item.account == userInfo.value.account)
console.log('myInfo:', myInfo)
if (myInfo) { if (myInfo) {
userInfo.value = userInfo.value == {} ? myInfo : Object.assign(userInfo.value, myInfo) Object.assign(userInfo.value, myInfo)
}
} }
} else { } else {
ranking.value = {} ranking.value = {}