Files
yusheng-h5/pages/other/grade.vue

493 lines
12 KiB
Vue
Raw Normal View History

2025-08-11 11:06:07 +08:00
<template>
2025-10-23 16:04:28 +08:00
<view class="view-page" v-if="levelActiveData && detailData">
2025-08-11 11:06:07 +08:00
<view class="top-view">
<view class="navbar" :style="{'margin-top' : `${statusBarHeight || 0}px`}">
<view class="">
<img @click="closeWeb" class="icon-image" src="@/static/image/grade/back.png" alt="" />
<!-- <img v-else class="icon-image" src="@/static/image/grade/back1.png" alt="" /> -->
</view>
<view class="tab">
<view @click="cutTabPage(0)" :class="currentIndex == 0 ? 'active' : ''">
财富等级
</view>
<view @click="cutTabPage(1)" :class="currentIndex == 1 ? 'active' : ''">
魅力等级
</view>
2025-11-29 11:33:18 +08:00
<view v-if="userSinger" @click="cutTabPage(2)" :class="currentIndex == 2 ? 'active' : ''">
歌手等级
</view>
2025-08-11 11:06:07 +08:00
</view>
2025-10-23 16:04:28 +08:00
<view class="icon-image">
2025-08-11 11:06:07 +08:00
</view>
</view>
<view class="swiper-view" v-if="levelActiveData.length">
2025-10-23 16:04:28 +08:00
<view class="swiper-image" :style="{ 'background-image' : `url('${levelActiveData[0].bg_image}')` }">
2025-08-11 11:06:07 +08:00
<view class="view-level">
<view class="">
<view class="level-str" :style="{textShadow : `0px 0px 5px ${levelActiveData[0].color}`}">
{{levelActiveData[0].name}}
</view>
<view class="color-9 flex-line" style="font-size: 20rpx;">
<span
2025-10-23 16:04:28 +08:00
style="white-space: nowrap">{{`lv.${levelActiveData[0].level}`}}</span><progress
2025-08-11 11:06:07 +08:00
style="width: 200rpx;margin: 0 24rpx;" :border-radius="52" :percent="3"
:activeColor="levelActiveData[0].color" stroke-width="3" />
<span
2025-10-23 16:04:28 +08:00
style="white-space: nowrap">{{`lv.${nextLevelData[0].level}`}}</span>
2025-08-11 11:06:07 +08:00
</view>
<view class="color-9 mt-24" style="font-size: 20rpx;">
距离下一个段位还差{{detailData.user.next_exp}}经验值
</view>
2025-10-23 16:04:28 +08:00
</view>
2025-11-29 11:33:18 +08:00
<view v-if="[1,2].includes(currentIndex)" style="width: 196rpx;height: 196rpx;">
2025-10-23 16:04:28 +08:00
<img :src="levelActiveData[0].rights_icon" alt="" />
2025-08-11 11:06:07 +08:00
</view>
</view>
</view>
</view>
<!-- 0 -->
<view class="LevelProgress-view">
<LevelProgress :currentIndex="levelCurrent" :lvList="levelList" />
</view>
<!-- -->
<view class="w-fill flex-line business-card">
<view class="">
<view class="font-36 color-0D">
{{detailData.user.exp || 0}}
</view>
<view class="font-24 color-f">
当前经验
</view>
</view>
<view class="head-sculpture">
<img :src="detailData.user.user_avatar || logo" alt="" />
</view>
<view class="">
<view class="font-36 color-0D">
{{detailData.user.next_exp}}
</view>
<view class="font-24 color-f">
下个等级
</view>
</view>
</view>
2025-10-23 16:04:28 +08:00
<!-- 每日奖励等 -->
<view class="content-view" v-if="detailData">
<view class="font-32 color-3 font-w500">
2025-11-29 11:33:18 +08:00
{{`如何获得${currentIndex === 1 ? '魅力' : currentIndex === 2 ? '歌手经验' : '财富'}值?`}}
2025-08-11 11:06:07 +08:00
</view>
2025-10-23 16:04:28 +08:00
<view class="mt-24 color-3 font-w400" style="font-size: 28rpx;">
2025-11-29 11:33:18 +08:00
{{`${currentIndex === 1 ? `在平台收到的所有打赏均可转化为魅力值,具体比例为1金币=${detailData.coin_charm_exp}魅力值。` : currentIndex === 2 ? `在平台的所有打赏均可转化为歌手经验值具体比例为1金币=${detailData.singer_coin_exp}经验值` : `在平台的所有打赏均可转化为财富值具体比例为1金币=${detailData.coin_wealth_exp}财富值。`}`}}
2025-10-23 16:04:28 +08:00
</view>
<!-- 财富等级 -->
<view class="mt-24">
<template v-if="!currentIndex" class="mt-24">
<img :src="$config.wealth_url" alt="" />
</template>
2025-11-29 11:33:18 +08:00
<template v-if="currentIndex == 1" class="mt-24">
2025-10-23 16:04:28 +08:00
<img :src="$config.charm_url" alt="" />
</template>
2025-11-29 11:33:18 +08:00
<template v-if="currentIndex == 2" class="mt-24">
<img :src="$config.singer_url" alt="" />
</template>
2025-08-11 11:06:07 +08:00
</view>
2025-10-23 16:04:28 +08:00
</view>
2025-08-11 11:06:07 +08:00
</view>
2025-10-23 16:04:28 +08:00
2025-08-11 11:06:07 +08:00
</view>
</template>
<script>
import http from '@/until/http.js';
import logo from '@/static/image/logo.png';
2025-10-30 18:27:45 +08:00
// import SwiperView from '@/component/swiper.vue';
2025-08-11 11:06:07 +08:00
import headerHeight from '@/component/headerHeight.vue';
import LevelProgress from '@/component/LevelProgress.vue'
export default {
components: {
headerHeight,
2025-10-30 18:27:45 +08:00
// SwiperView,
2025-08-11 11:06:07 +08:00
LevelProgress
},
data() {
return {
logo,
detailData: null,
statusBarHeight: 0,
errorPage: true,
tabs: [],
listData: [],
currentIndex: 0,
levelActiveData: null,
levelList: [],
levelCurrent: 0,
nextLevelData: null,
2025-11-29 11:33:18 +08:00
userSinger:false,
2025-08-11 11:06:07 +08:00
currentSelectedLevel: 2,
2025-11-29 11:33:18 +08:00
userSingerLevel:0
2025-08-11 11:06:07 +08:00
}
},
onLoad(options) {
this.errorPage = true
const {
id,
type,
h
} = options
this.currentIndex = type !== undefined ? +type : 0
uni.setStorageSync('token', id)
this.statusBarHeight = h
uni.setStorageSync('BarHeight', h)
2025-11-29 11:33:18 +08:00
if (uni.getStorageSync('token')) {
this.getData()
this.getSingInfo()
}
2025-08-11 11:06:07 +08:00
},
methods: {
getData() {
this.levelActiveData = []
2025-11-29 11:33:18 +08:00
if (this.currentIndex === 1) {
2025-08-11 11:06:07 +08:00
// 魅力等级
this.getCharmLevel()
2025-11-29 11:33:18 +08:00
} else if (this.currentIndex === 0) {
2025-08-11 11:06:07 +08:00
// 财富等级
this.getWealthLevel()
2025-11-29 11:33:18 +08:00
} else if(this.currentIndex === 2) {
console.log('歌手等级')
this.getSingerLevel()
}
2025-08-11 11:06:07 +08:00
},
cutTabPage(index) {
this.currentIndex = index
this.getData()
},
2025-11-29 11:33:18 +08:00
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
});
},
2025-08-11 11:06:07 +08:00
async getCharmLevel() {
http.get('/api/Level/get_level_rule', {
2025-10-23 16:04:28 +08:00
token: uni.getStorageSync('token') || ''
2025-08-11 11:06:07 +08:00
}).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 = data.user.level
this.nextLevelData = data.level.filter(ele => {
return ele.level === data.user.level + 1
})
this.levelActiveData = data.level.filter(ele => {
return ele.level === data.user.level
})
}
this.errorPage = false
}).catch(error => {
this.errorPage = true
});
},
closeWeb() {
// 关闭页面
const platform = uni.getSystemInfoSync().platform;
if (platform === 'ios') {
window.webkit.messageHandlers.nativeHandler.postMessage({
'action': 'closeWeb'
});
} else if (platform === 'android') {
window.Android.closeWeb();
}
},
async getWealthLevel() {
http.get('/api/Level/get_wealth_rule', {
2025-10-23 16:04:28 +08:00
token: uni.getStorageSync('token') || ''
2025-08-11 11:06:07 +08:00
}).then(response => {
const {
data,
code
} = response
if (code) {
this.detailData = data
this.levelList = data.level.map(ele => {
return {
...ele,
title: ele.name
}
})
this.levelCurrent = data.user.level
this.nextLevelData = data.level.filter(ele => {
return ele.level === data.user.level + 1
})
this.levelActiveData = data.level.filter(ele => {
return ele.level === data.user.level
})
}
this.errorPage = false
}).catch(error => {
this.errorPage = true
});
2025-11-29 11:33:18 +08:00
},
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
});
2025-08-11 11:06:07 +08:00
}
}
}
</script>
<style scoped lang="scss">
@font-face {
font-family: 'MyCustomFont';
src: url('@/static/youshe.ttf') format('truetype');
}
.level-str {
font-family: 'MyCustomFont', sans-serif;
font-weight: 400;
font-size: 60rpx;
color: #FFFFFF;
font-style: normal;
text-transform: none;
text-align: left;
}
.view-page {
width: 100vw;
height: 100vh;
overflow-x: hidden;
background: #F3F5F9;
display: inline-flex;
flex-wrap: wrap;
.LevelProgress-view {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #fff;
/* 整体字体颜色 */
// margin-top: 60px;
// background-color: #000; /* 模拟背景 */
// min-height: 100vh;
display: flex;
width: 100%;
flex-direction: column;
align-items: center;
justify-content: flex-start;
}
.top-view {
width: 100vw;
min-height: 50vh;
background-image: url('@/static/image/grade/Maskgroupx.png');
background-repeat: no-repeat;
2025-10-23 16:04:28 +08:00
position: relative;
2025-08-11 11:06:07 +08:00
.navbar {
display: inline-flex;
justify-content: space-around;
align-items: center;
height: 96rpx;
width: 100%;
.icon-image {
width: 48rpx;
height: 48rpx;
}
.tab {
display: inline-flex;
align-items: center;
view {
padding: 0 24rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.7);
}
.active {
font-weight: 500;
// font-size: 36rpx;
color: #FFFFFF;
}
}
}
.swiper-view {
width: 100%;
display: inline-flex;
justify-content: center;
.swiper-image {
width: 80%;
height: 266rpx;
background-repeat: no-repeat;
background-size: 100%;
margin-top: 24rpx;
display: inline-flex;
justify-content: center;
.view-level {
width: 93%;
display: inline-flex;
align-items: center;
justify-content: space-between;
.icon {
width: 220rpx;
height: 156rpx;
}
}
}
}
.business-card {
justify-content: space-around;
align-items: flex-end;
margin: 50rpx 0;
view {
text-align: center;
}
.head-sculpture {
width: 122rpx;
height: 122rpx;
border-radius: 50%;
img {
border-radius: 50%;
}
}
}
}
.content-view {
min-height: 46vh;
2025-10-23 16:04:28 +08:00
// width: 100%;
width: calc(100% - 64rpx);
padding:32rpx;
// position: absolute;
// top: 50%;
border-radius: 32rpx 32rpx 0 0;
background-color: #fff;
2025-08-11 11:06:07 +08:00
.card-view {
// padding: 24rpx 0;
.card-title {
padding: 24rpx 0;
font-family: Source Han Sans CN, Source Han Sans CN;
}
.card-body {
width: 100%;
min-height: 154rpx;
background-color: #fff;
border-radius: 20rpx;
.coin {
height: 134rpx;
width: 180rpx;
margin: 0 20rpx;
}
.receive-button {
width: 172rpx;
height: 56rpx;
background: #0DFFB9;
border-radius: 106rpx 106rpx 106rpx 106rpx;
justify-content: center;
}
}
.flex-container {
display: flex;
/* 启用 Flex 布局 */
flex-wrap: wrap;
/* 允许换行 */
}
.flex-item {
flex: 0 0 calc(25% - 10px);
/* 基础宽度25% 减去间隔 */
margin: 5px;
2025-10-23 16:04:28 +08:00
min-height: 260rpx;
2025-08-11 11:06:07 +08:00
padding: 20rpx 0;
/* 元素间距 */
box-sizing: border-box;
/* 包含内边距和边框 */
border-radius: 14rpx;
/* 样式美化(可选) */
background-color: #fff;
// padding: 20rpx;
text-align: center;
.image{
width: 100%;
height: 60%;
2025-10-23 16:04:28 +08:00
margin-bottom: 14rpx;
2025-08-11 11:06:07 +08:00
img{
width: 80%;
}
}
2025-10-23 16:04:28 +08:00
.title{
max-width: 60px;
}
2025-08-11 11:06:07 +08:00
}
}
}
}
</style>