fix(userId): 调整获取userId的获取方式
This commit is contained in:
parent
257a7d6712
commit
080c7ac8dd
@ -642,7 +642,6 @@ import { isInApp } from '../../utils/appBridge.js'
|
|||||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
import borderImg from '../../components/TopList/borderImg.vue'
|
import borderImg from '../../components/TopList/borderImg.vue'
|
||||||
import maskLayer from '../../components/MaskLayer.vue'
|
import maskLayer from '../../components/MaskLayer.vue'
|
||||||
import { getUserId } from '@/utils/userStore.js'
|
|
||||||
import {
|
import {
|
||||||
getWeekTopList,
|
getWeekTopList,
|
||||||
getWeekMyContribution,
|
getWeekMyContribution,
|
||||||
@ -650,7 +649,7 @@ import {
|
|||||||
getHistoryTopOne,
|
getHistoryTopOne,
|
||||||
} from '@/api/topList.js'
|
} from '@/api/topList.js'
|
||||||
import { useDebounce, useThrottle } from '@/utils/useDebounce'
|
import { useDebounce, useThrottle } from '@/utils/useDebounce'
|
||||||
import { usePageInitializationWithConfig } from '@/utils/pageConfig.js'
|
import { getMemberProfile } from '@/api/wallet'
|
||||||
|
|
||||||
//vite动态批量导入图片
|
//vite动态批量导入图片
|
||||||
const imageModules = import.meta.glob('@/assets/images/TopList/*.{png,jpg,svg}', { eager: true })
|
const imageModules = import.meta.glob('@/assets/images/TopList/*.{png,jpg,svg}', { eager: true })
|
||||||
@ -662,6 +661,8 @@ const images = Object.fromEntries(
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const userInfo = ref({})
|
||||||
|
|
||||||
const visibleKingList = ref(true)
|
const visibleKingList = ref(true)
|
||||||
|
|
||||||
const isInAppEnvironment = ref(false) // 检测是否在APP环境中
|
const isInAppEnvironment = ref(false) // 检测是否在APP环境中
|
||||||
@ -858,7 +859,12 @@ const getTopList = async (params) => {
|
|||||||
|
|
||||||
// 获取我的贡献
|
// 获取我的贡献
|
||||||
const getMyContribution = async () => {
|
const getMyContribution = async () => {
|
||||||
const resWeekMyContribution = await getWeekMyContribution(getUserId())
|
console.log('userInfo.value.id:', userInfo.value)
|
||||||
|
|
||||||
|
let userId = userInfo.value.id
|
||||||
|
console.log('userId:', userId)
|
||||||
|
|
||||||
|
const resWeekMyContribution = await getWeekMyContribution(userId)
|
||||||
console.log('resWeekMyContribution:', resWeekMyContribution)
|
console.log('resWeekMyContribution:', resWeekMyContribution)
|
||||||
|
|
||||||
if (resWeekMyContribution.status && resWeekMyContribution.body) {
|
if (resWeekMyContribution.status && resWeekMyContribution.body) {
|
||||||
@ -886,6 +892,17 @@ const getAllTopOne = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取用户信息
|
||||||
|
const getUserInfo = async () => {
|
||||||
|
if (Object.keys(userInfo.value).length === 0) {
|
||||||
|
const resUserInfo = await getMemberProfile()
|
||||||
|
if (resUserInfo.status && resUserInfo.body) {
|
||||||
|
userInfo.value = resUserInfo.body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getMyContribution() // 获取我的贡献
|
||||||
|
}
|
||||||
|
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const closedPopup = () => {
|
const closedPopup = () => {
|
||||||
helpInfoShow.value = false
|
helpInfoShow.value = false
|
||||||
@ -914,9 +931,9 @@ const observer = new IntersectionObserver((entries) => {
|
|||||||
|
|
||||||
// 刷新页面数据
|
// 刷新页面数据
|
||||||
const updatePageData = () => {
|
const updatePageData = () => {
|
||||||
|
getUserInfo()
|
||||||
getTopList(kingListParams.value) // 获取国王榜单
|
getTopList(kingListParams.value) // 获取国王榜单
|
||||||
getTopList(queenListParams.value) // 获取女王榜单
|
getTopList(queenListParams.value) // 获取女王榜单
|
||||||
getMyContribution() // 获取我的贡献
|
|
||||||
getRewardsAndGifts() //获取本周的礼物和国王和皇后top奖励列表
|
getRewardsAndGifts() //获取本周的礼物和国王和皇后top奖励列表
|
||||||
getAllTopOne() //获取近几个月的榜首国王女王
|
getAllTopOne() //获取近几个月的榜首国王女王
|
||||||
}
|
}
|
||||||
@ -924,7 +941,6 @@ const updatePageData = () => {
|
|||||||
// 组件挂载时检测环境
|
// 组件挂载时检测环境
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
isInAppEnvironment.value = isInApp()
|
isInAppEnvironment.value = isInApp()
|
||||||
usePageInitializationWithConfig('APPLY')
|
|
||||||
|
|
||||||
getCountdown()
|
getCountdown()
|
||||||
timer = setInterval(getCountdown, 1000) //每秒更新
|
timer = setInterval(getCountdown, 1000) //每秒更新
|
||||||
|
|||||||
@ -743,7 +743,7 @@ import TopUser from '@/components/WeeklyStar/topUser.vue'
|
|||||||
import maskLayer from '../../components/MaskLayer.vue'
|
import maskLayer from '../../components/MaskLayer.vue'
|
||||||
import { useDebounce, useThrottle } from '@/utils/useDebounce'
|
import { useDebounce, useThrottle } from '@/utils/useDebounce'
|
||||||
import { usePageInitializationWithConfig } from '@/utils/pageConfig.js'
|
import { usePageInitializationWithConfig } from '@/utils/pageConfig.js'
|
||||||
import { getUserId } from '@/utils/userStore.js'
|
import { getMemberProfile } from '@/api/wallet'
|
||||||
import { showError, showWarning, showInfo, showSuccess } from '@/utils/toast.js'
|
import { showError, showWarning, showInfo, showSuccess } from '@/utils/toast.js'
|
||||||
import {
|
import {
|
||||||
getWeekStarRanking,
|
getWeekStarRanking,
|
||||||
@ -765,6 +765,8 @@ const images = Object.fromEntries(
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const userInfo = ref({})
|
||||||
|
|
||||||
const isInAppEnvironment = ref(false) // 检测是否在APP环境中
|
const isInAppEnvironment = ref(false) // 检测是否在APP环境中
|
||||||
const helpInfoShow = ref(false) //帮助模块
|
const helpInfoShow = ref(false) //帮助模块
|
||||||
const historyShow = ref(false) //历史模块
|
const historyShow = ref(false) //历史模块
|
||||||
@ -959,6 +961,18 @@ const showDetail = (type, quantity) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取用户信息
|
||||||
|
const getUserInfo = async () => {
|
||||||
|
if (Object.keys(userInfo.value).length === 0) {
|
||||||
|
const resUserInfo = await getMemberProfile()
|
||||||
|
if (resUserInfo.status && resUserInfo.body) {
|
||||||
|
userInfo.value = resUserInfo.body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getMyThisWeekRanking() // 获取本周我的排名
|
||||||
|
getThisWeekMyFragment() // 获取本周我的碎片
|
||||||
|
}
|
||||||
|
|
||||||
// 获取本周排名
|
// 获取本周排名
|
||||||
const getThisWeekRanking = async () => {
|
const getThisWeekRanking = async () => {
|
||||||
const resWeekStarRanking = await getWeekStarRanking(RankingLoadParams.value)
|
const resWeekStarRanking = await getWeekStarRanking(RankingLoadParams.value)
|
||||||
@ -988,7 +1002,7 @@ const getHistoryRankingTop1 = async () => {
|
|||||||
// 获取本周我的排名
|
// 获取本周我的排名
|
||||||
const getMyThisWeekRanking = async () => {
|
const getMyThisWeekRanking = async () => {
|
||||||
let data = {
|
let data = {
|
||||||
userId: getUserId(),
|
userId: userInfo.value.id,
|
||||||
type: 'THIS_WEEK',
|
type: 'THIS_WEEK',
|
||||||
}
|
}
|
||||||
const resMyWeekStarRanking = await getMyWeekStarRanking(data)
|
const resMyWeekStarRanking = await getMyWeekStarRanking(data)
|
||||||
@ -1032,7 +1046,7 @@ const getThisWeekExchangeGoods = async () => {
|
|||||||
// 获取本周我拥有的碎片
|
// 获取本周我拥有的碎片
|
||||||
const getThisWeekMyFragment = async () => {
|
const getThisWeekMyFragment = async () => {
|
||||||
let data = {
|
let data = {
|
||||||
userId: getUserId(),
|
userId: userInfo.value.id,
|
||||||
fragmentsIds: ['1968948330210508801'],
|
fragmentsIds: ['1968948330210508801'],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1048,11 +1062,12 @@ const getThisWeekMyFragment = async () => {
|
|||||||
const updatePageData = () => {
|
const updatePageData = () => {
|
||||||
getThisWeekRanking() // 获取本周排名
|
getThisWeekRanking() // 获取本周排名
|
||||||
getHistoryRankingTop1() // 获取历史top1
|
getHistoryRankingTop1() // 获取历史top1
|
||||||
getMyThisWeekRanking() // 获取本周我的排名
|
|
||||||
getThisWeekRewards() // 获取本周奖励
|
getThisWeekRewards() // 获取本周奖励
|
||||||
getThisWeekGifts() // 获取本周礼物
|
getThisWeekGifts() // 获取本周礼物
|
||||||
getThisWeekExchangeGoods() // 获取本周可兑换商品
|
getThisWeekExchangeGoods() // 获取本周可兑换商品
|
||||||
getThisWeekMyFragment() // 获取本周我的碎片
|
|
||||||
|
getUserInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
const debouceGetThisWeekRanking = useThrottle(() => {
|
const debouceGetThisWeekRanking = useThrottle(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user