更新h5新的api

This commit is contained in:
yziiy
2025-11-29 11:33:18 +08:00
parent 5ed0c676b2
commit edd856475e
170 changed files with 531 additions and 49 deletions

View File

@@ -13,6 +13,9 @@
<view @click="cutTabPage(1)" :class="currentIndex == 1 ? 'active' : ''">
魅力等级
</view>
<view v-if="userSinger" @click="cutTabPage(2)" :class="currentIndex == 2 ? 'active' : ''">
歌手等级
</view>
</view>
<view class="icon-image">
</view>
@@ -37,7 +40,7 @@
</view>
</view>
<view v-if="currentIndex == 1" style="width: 196rpx;height: 196rpx;">
<view v-if="[1,2].includes(currentIndex)" style="width: 196rpx;height: 196rpx;">
<img :src="levelActiveData[0].rights_icon" alt="" />
</view>
</view>
@@ -72,19 +75,22 @@
<!-- 每日奖励等 -->
<view class="content-view" v-if="detailData">
<view class="font-32 color-3 font-w500">
{{`如何获得${currentIndex ? '魅力' : '财富'}值?`}}
{{`如何获得${currentIndex === 1 ? '魅力' : currentIndex === 2 ? '歌手经验' : '财富'}值?`}}
</view>
<view class="mt-24 color-3 font-w400" style="font-size: 28rpx;">
{{`${currentIndex ? `在平台收到的所有打赏均可转化为魅力值,具体比例为1金币=${detailData.coin_charm_exp}魅力值。` : `在平台的所有打赏均可转化为财富值具体比例为1金币=${detailData.coin_wealth_exp}财富值。`}`}}
{{`${currentIndex === 1 ? `在平台收到的所有打赏均可转化为魅力值,具体比例为1金币=${detailData.coin_charm_exp}魅力值。` : currentIndex === 2 ? `在平台的所有打赏均可转化为歌手经验值具体比例为1金币=${detailData.singer_coin_exp}经验值` : `在平台的所有打赏均可转化为财富值具体比例为1金币=${detailData.coin_wealth_exp}财富值。`}`}}
</view>
<!-- 财富等级 -->
<view class="mt-24">
<template v-if="!currentIndex" class="mt-24">
<img :src="$config.wealth_url" alt="" />
</template>
<template v-else class="mt-24">
<template v-if="currentIndex == 1" class="mt-24">
<img :src="$config.charm_url" alt="" />
</template>
<template v-if="currentIndex == 2" class="mt-24">
<img :src="$config.singer_url" alt="" />
</template>
</view>
</view>
@@ -118,7 +124,9 @@
levelList: [],
levelCurrent: 0,
nextLevelData: null,
userSinger:false,
currentSelectedLevel: 2,
userSingerLevel:0
}
},
onLoad(options) {
@@ -132,23 +140,43 @@
uni.setStorageSync('token', id)
this.statusBarHeight = h
uni.setStorageSync('BarHeight', h)
if (uni.getStorageSync('token')) this.getData()
if (uni.getStorageSync('token')) {
this.getData()
this.getSingInfo()
}
},
methods: {
getData() {
this.levelActiveData = []
if (this.currentIndex) {
if (this.currentIndex === 1) {
// 魅力等级
this.getCharmLevel()
} else {
} else if (this.currentIndex === 0) {
// 财富等级
this.getWealthLevel()
}
} else if(this.currentIndex === 2) {
console.log('歌手等级')
this.getSingerLevel()
}
},
cutTabPage(index) {
this.currentIndex = index
this.getData()
},
async getSingInfo() {
http.get('/api/Level/is_singer', {
token: uni.getStorageSync('token') || ''
}).then(response => {
const {
data,
code
} = response
this.userSinger = data.status ? true : false
this.userSingerLevel = Number(data.level)
}).catch(error => {
this.userSinger = false
});
},
async getCharmLevel() {
http.get('/api/Level/get_level_rule', {
token: uni.getStorageSync('token') || ''
@@ -220,6 +248,36 @@
}).catch(error => {
this.errorPage = true
});
},
async getSingerLevel() {
http.get('/api/Level/get_singer_level', {
token: uni.getStorageSync('token') || ''
}).then(response => {
const {
data,
code
} = response
if (code) {
console.log(data)
this.detailData = data
this.levelList = data.level.map(ele => {
return {
...ele,
title: ele.name
}
})
this.levelCurrent = Number(data.user.level)
this.nextLevelData = data.level.filter(ele => {
return ele.level === Number(data.user.level) + 1
})
this.levelActiveData = data.level.filter(ele => {
return ele.level === Number(data.user.level)
})
}
this.errorPage = false
}).catch(error => {
this.errorPage = true
});
}
}
}