fix: 调整接口参数,并修复图片和history弹窗的展示问题
This commit is contained in:
parent
1f9ff39a9d
commit
844175ba6c
@ -15,9 +15,9 @@ export const getWeekTopList = async (data) => {
|
||||
}
|
||||
|
||||
// 获取我本周贡献
|
||||
export const getWeekMyContribution = async () => {
|
||||
export const getWeekMyContribution = async (userId) => {
|
||||
try {
|
||||
const response = await get(`/activity/king-queen/user-contribute`)
|
||||
const response = await get(`/activity/king-queen/user-contribute?userId=${userId}`)
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('Failed to get week my contribution:', error)
|
||||
|
||||
@ -15,9 +15,11 @@ export const getWeekStarRanking = async (data) => {
|
||||
}
|
||||
|
||||
// 获取我的排名
|
||||
export const getMyWeekStarRanking = async (type) => {
|
||||
export const getMyWeekStarRanking = async (data) => {
|
||||
try {
|
||||
const response = await get(`/activity/week-star/my-rank?type=${type}`)
|
||||
const response = await get(
|
||||
`/activity/week-star/my-rank?type=${data.type}&userId=${data.userId}`
|
||||
)
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('Failed to get my week star ranking:', error)
|
||||
|
||||
@ -633,6 +633,7 @@ import { isInApp } from '../../utils/appBridge.js'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import borderImg from '../../components/TopList/borderImg.vue'
|
||||
import maskLayer from '../../components/MaskLayer.vue'
|
||||
import { getUserId } from '@/utils/userStore.js'
|
||||
import {
|
||||
getWeekTopList,
|
||||
getWeekMyContribution,
|
||||
@ -656,20 +657,23 @@ const isInAppEnvironment = ref(false) // 检测是否在APP环境中
|
||||
|
||||
const historyList = ref([]) // 榜首历史记录
|
||||
const showTopOne = computed(() => {
|
||||
let topNew = []
|
||||
if (historyList.value[historyIndex.value].wealth)
|
||||
topNew.push({
|
||||
type: 'topKing',
|
||||
Frame: images.kingFrame,
|
||||
userInfo: historyList.value[historyIndex.value].wealth || {},
|
||||
})
|
||||
if (historyList.value[historyIndex.value].charm) {
|
||||
topNew.push({
|
||||
type: 'topQueen',
|
||||
Frame: images.queenFrame,
|
||||
userInfo: historyList.value[historyIndex.value].charm || {},
|
||||
})
|
||||
}
|
||||
return {
|
||||
group: historyList.value[historyIndex.value].group,
|
||||
top: [
|
||||
{
|
||||
type: 'topKing',
|
||||
Frame: images.kingFrame,
|
||||
userInfo: historyList.value[historyIndex.value].wealth,
|
||||
},
|
||||
{
|
||||
type: 'topQueen',
|
||||
Frame: images.queenFrame,
|
||||
userInfo: historyList.value[historyIndex.value].charm,
|
||||
},
|
||||
],
|
||||
top: topNew,
|
||||
}
|
||||
})
|
||||
const historyIndex = ref(0)
|
||||
@ -677,6 +681,9 @@ const historyIndex = ref(0)
|
||||
const changeHistoryIndex = (num) => {
|
||||
let index = historyIndex.value + num
|
||||
let length = historyList.value.length
|
||||
console.log('index:', index)
|
||||
console.log('length:', length)
|
||||
|
||||
if (index >= 0 && index < length) {
|
||||
historyIndex.value = index
|
||||
}
|
||||
@ -814,7 +821,7 @@ const getTopList = async (params) => {
|
||||
|
||||
// 获取我的贡献
|
||||
const getMyContribution = async () => {
|
||||
const resWeekMyContribution = await getWeekMyContribution()
|
||||
const resWeekMyContribution = await getWeekMyContribution(getUserId())
|
||||
console.log('resWeekMyContribution:', resWeekMyContribution)
|
||||
|
||||
if (resWeekMyContribution.status && resWeekMyContribution.body) {
|
||||
|
||||
@ -853,7 +853,7 @@ const handleImageError = (e, type) => {
|
||||
// 头像资源出错处理
|
||||
const defaultAvatarUrl = (e) => {
|
||||
console.log('头像资源出错')
|
||||
e.target.src = images.defaultAvatar
|
||||
e.target.src = '/src/assets/images/WeeklyStar/defaultAvatar.png'
|
||||
}
|
||||
|
||||
// 选中要兑换的商品
|
||||
@ -964,7 +964,7 @@ const getThisWeekRanking = async () => {
|
||||
if (
|
||||
resWeekStarRanking.status &&
|
||||
resWeekStarRanking.body &&
|
||||
resWeekStarRanking.body.rankUsers.records
|
||||
resWeekStarRanking.body.rankUsers?.records
|
||||
) {
|
||||
let rankUsers = resWeekStarRanking.body.rankUsers
|
||||
Ranking.value.push(...rankUsers.records)
|
||||
@ -985,7 +985,11 @@ const getHistoryRankingTop1 = async () => {
|
||||
|
||||
// 获取本周我的排名
|
||||
const getMyThisWeekRanking = async () => {
|
||||
const resMyWeekStarRanking = await getMyWeekStarRanking('THIS_WEEK')
|
||||
let data = {
|
||||
userId: getUserId(),
|
||||
type: 'THIS_WEEK',
|
||||
}
|
||||
const resMyWeekStarRanking = await getMyWeekStarRanking(data)
|
||||
console.log('resMyWeekStarRanking:', resMyWeekStarRanking)
|
||||
if (resMyWeekStarRanking.status && resMyWeekStarRanking.body) {
|
||||
myRanking.value = resMyWeekStarRanking.body
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user