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 {
|
try {
|
||||||
const response = await get(`/activity/king-queen/user-contribute`)
|
const response = await get(`/activity/king-queen/user-contribute?userId=${userId}`)
|
||||||
return response
|
return response
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to get week my contribution:', 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 {
|
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
|
return response
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to get my week star ranking:', 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 { 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,
|
||||||
@ -656,20 +657,23 @@ const isInAppEnvironment = ref(false) // 检测是否在APP环境中
|
|||||||
|
|
||||||
const historyList = ref([]) // 榜首历史记录
|
const historyList = ref([]) // 榜首历史记录
|
||||||
const showTopOne = computed(() => {
|
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 {
|
return {
|
||||||
group: historyList.value[historyIndex.value].group,
|
group: historyList.value[historyIndex.value].group,
|
||||||
top: [
|
top: topNew,
|
||||||
{
|
|
||||||
type: 'topKing',
|
|
||||||
Frame: images.kingFrame,
|
|
||||||
userInfo: historyList.value[historyIndex.value].wealth,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'topQueen',
|
|
||||||
Frame: images.queenFrame,
|
|
||||||
userInfo: historyList.value[historyIndex.value].charm,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const historyIndex = ref(0)
|
const historyIndex = ref(0)
|
||||||
@ -677,6 +681,9 @@ const historyIndex = ref(0)
|
|||||||
const changeHistoryIndex = (num) => {
|
const changeHistoryIndex = (num) => {
|
||||||
let index = historyIndex.value + num
|
let index = historyIndex.value + num
|
||||||
let length = historyList.value.length
|
let length = historyList.value.length
|
||||||
|
console.log('index:', index)
|
||||||
|
console.log('length:', length)
|
||||||
|
|
||||||
if (index >= 0 && index < length) {
|
if (index >= 0 && index < length) {
|
||||||
historyIndex.value = index
|
historyIndex.value = index
|
||||||
}
|
}
|
||||||
@ -814,7 +821,7 @@ const getTopList = async (params) => {
|
|||||||
|
|
||||||
// 获取我的贡献
|
// 获取我的贡献
|
||||||
const getMyContribution = async () => {
|
const getMyContribution = async () => {
|
||||||
const resWeekMyContribution = await getWeekMyContribution()
|
const resWeekMyContribution = await getWeekMyContribution(getUserId())
|
||||||
console.log('resWeekMyContribution:', resWeekMyContribution)
|
console.log('resWeekMyContribution:', resWeekMyContribution)
|
||||||
|
|
||||||
if (resWeekMyContribution.status && resWeekMyContribution.body) {
|
if (resWeekMyContribution.status && resWeekMyContribution.body) {
|
||||||
|
|||||||
@ -853,7 +853,7 @@ const handleImageError = (e, type) => {
|
|||||||
// 头像资源出错处理
|
// 头像资源出错处理
|
||||||
const defaultAvatarUrl = (e) => {
|
const defaultAvatarUrl = (e) => {
|
||||||
console.log('头像资源出错')
|
console.log('头像资源出错')
|
||||||
e.target.src = images.defaultAvatar
|
e.target.src = '/src/assets/images/WeeklyStar/defaultAvatar.png'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选中要兑换的商品
|
// 选中要兑换的商品
|
||||||
@ -964,7 +964,7 @@ const getThisWeekRanking = async () => {
|
|||||||
if (
|
if (
|
||||||
resWeekStarRanking.status &&
|
resWeekStarRanking.status &&
|
||||||
resWeekStarRanking.body &&
|
resWeekStarRanking.body &&
|
||||||
resWeekStarRanking.body.rankUsers.records
|
resWeekStarRanking.body.rankUsers?.records
|
||||||
) {
|
) {
|
||||||
let rankUsers = resWeekStarRanking.body.rankUsers
|
let rankUsers = resWeekStarRanking.body.rankUsers
|
||||||
Ranking.value.push(...rankUsers.records)
|
Ranking.value.push(...rankUsers.records)
|
||||||
@ -985,7 +985,11 @@ const getHistoryRankingTop1 = async () => {
|
|||||||
|
|
||||||
// 获取本周我的排名
|
// 获取本周我的排名
|
||||||
const getMyThisWeekRanking = 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)
|
console.log('resMyWeekStarRanking:', resMyWeekStarRanking)
|
||||||
if (resMyWeekStarRanking.status && resMyWeekStarRanking.body) {
|
if (resMyWeekStarRanking.status && resMyWeekStarRanking.body) {
|
||||||
myRanking.value = resMyWeekStarRanking.body
|
myRanking.value = resMyWeekStarRanking.body
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user