diff --git a/src/views/Activities/Lottery/Lottery.vue b/src/views/Activities/Lottery/Lottery.vue index f11d901..09e6282 100644 --- a/src/views/Activities/Lottery/Lottery.vue +++ b/src/views/Activities/Lottery/Lottery.vue @@ -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 = {}