2024-01-29 18:26:51 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="container">
|
|
|
|
|
|
<div class="top">
|
2024-02-01 15:16:38 +08:00
|
|
|
|
|
|
|
|
|
|
<h4>当前等级: {{userInfo.level}}-{{ userInfo.levelName }}</h4>
|
|
|
|
|
|
<h4>当前钱钱: {{userInfo.money}}</h4>
|
2024-01-29 18:26:51 +08:00
|
|
|
|
<div class="title">
|
|
|
|
|
|
<div class="left">当前等级经验:</div>
|
|
|
|
|
|
<div class="right">
|
2024-02-01 15:16:38 +08:00
|
|
|
|
<el-progress :percentage="(userInfo.experience/nextExperience).toFixed(2)*100" :stroke-width="15" striped striped-flow />
|
|
|
|
|
|
<div>{{userInfo.experience}}/{{ nextExperience }}</div>
|
2024-01-29 18:26:51 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="bottom">
|
2024-02-01 15:16:38 +08:00
|
|
|
|
<el-input-number v-model="moneyNum" :min="1" :max="10000" />
|
2024-01-29 18:26:51 +08:00
|
|
|
|
|
2024-02-01 15:16:38 +08:00
|
|
|
|
<el-button @click="onUpgradeClick" type="primary">升级</el-button>
|
2024-01-29 18:26:51 +08:00
|
|
|
|
|
2024-02-01 15:16:38 +08:00
|
|
|
|
<span>所需钱钱:{{ moneyNum }}</span>
|
2024-01-29 18:26:51 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table :data="levelData" border style="width: 100%" >
|
|
|
|
|
|
<el-table-column prop="currentLevel" label="等级" width="80" align="center" />
|
|
|
|
|
|
<el-table-column prop="name" label="称号" width="180" align="center" />
|
|
|
|
|
|
<el-table-column prop="minExperience" label="所需经验" width="180" align="center" />
|
|
|
|
|
|
<el-table-column prop="nick" label="其他" align="center" />
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
2024-02-01 15:16:38 +08:00
|
|
|
|
import {getList,upgrade} from '@/apis/levelApi.js'
|
|
|
|
|
|
import {getBbsUserProfile} from '@/apis/userApi.js'
|
|
|
|
|
|
import { ref,onMounted, reactive,computed } from 'vue'
|
|
|
|
|
|
import useAuths from '@/hooks/useAuths.js';
|
2024-02-26 18:44:11 +08:00
|
|
|
|
import useUserStore from "@/stores/user";
|
|
|
|
|
|
const { isLogin } = useAuths();
|
2024-02-01 15:16:38 +08:00
|
|
|
|
const userInfo=ref({});
|
2024-02-26 18:44:11 +08:00
|
|
|
|
const currentUserInfo=useUserStore();
|
2024-01-29 18:26:51 +08:00
|
|
|
|
const levelData =ref([]);
|
2024-02-01 15:16:38 +08:00
|
|
|
|
const moneyNum=ref(1);
|
2024-01-29 18:26:51 +08:00
|
|
|
|
|
|
|
|
|
|
const query=reactive({
|
|
|
|
|
|
skipCount:0,
|
|
|
|
|
|
maxResultCount:20
|
|
|
|
|
|
})
|
2024-02-01 15:16:38 +08:00
|
|
|
|
|
|
|
|
|
|
const nextExperience=computed(()=>{
|
|
|
|
|
|
return levelData.value?.filter(x=>x.currentLevel==userInfo.value.level+1)[0]?.minExperience
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const onUpgradeClick=async ()=>{
|
|
|
|
|
|
await upgrade(moneyNum.value);
|
|
|
|
|
|
await loadLevelData();
|
|
|
|
|
|
await loadUserInfoData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-29 18:26:51 +08:00
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
await loadLevelData();
|
2024-02-01 15:16:38 +08:00
|
|
|
|
await loadUserInfoData();
|
2024-01-29 18:26:51 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const loadLevelData= async () => {
|
2024-02-01 15:16:38 +08:00
|
|
|
|
moneyNum.value=1;
|
2024-01-29 18:26:51 +08:00
|
|
|
|
const {data:{items}} = await getList(query);
|
|
|
|
|
|
levelData.value = items;
|
|
|
|
|
|
}
|
2024-02-01 15:16:38 +08:00
|
|
|
|
const loadUserInfoData=async()=>{
|
|
|
|
|
|
if(isLogin)
|
|
|
|
|
|
{
|
2024-02-26 18:44:11 +08:00
|
|
|
|
const {data}= await getBbsUserProfile(currentUserInfo.id);
|
2024-02-01 15:16:38 +08:00
|
|
|
|
userInfo.value=data;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-01-29 18:26:51 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped >
|
|
|
|
|
|
.container{
|
|
|
|
|
|
padding: 20px 20px;
|
|
|
|
|
|
.title{
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
.left{
|
|
|
|
|
|
width: 15%;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right{
|
|
|
|
|
|
width: 60%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.bottom{
|
|
|
|
|
|
margin: 20px 0px;
|
|
|
|
|
|
.el-button{
|
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>>
|