feat(抽奖活动页): 修复获取我的排名的问题
This commit is contained in:
parent
b82a639868
commit
00b79cdcc8
@ -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 = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user