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