YNUtdPlatform/pages/YNEduApp/user/user.vue

235 lines
5.8 KiB
Vue
Raw Normal View History

2024-08-07 14:53:53 +08:00
<template>
2024-08-26 21:46:08 +08:00
<view class="page">
2024-08-07 14:53:53 +08:00
<view class="user-edit">
<view class="user-avatar">
2024-08-26 21:46:08 +08:00
<image :src="facePath"></image>
2024-08-07 14:53:53 +08:00
</view>
2024-08-28 17:23:03 +08:00
<view class="user-info" style="height: 120px;">
2024-08-26 21:46:08 +08:00
<span style="font-size: 24px">{{ userName }}</span>
2024-08-28 17:23:03 +08:00
<span style="font-size: 12px; color: #8a8a8b; overflow: auto;">{{ className }}</span>
2024-08-07 14:53:53 +08:00
</view>
<view class="edit-btn">
2024-08-27 13:32:10 +08:00
<view @click="handleEdit">修改资料</view>
2024-08-07 14:53:53 +08:00
</view>
</view>
<view class="learn-infos">
2024-08-26 21:46:08 +08:00
<!-- <view>
2024-08-07 14:53:53 +08:00
<span>{{ learnStats.selfLearn }}</span>
<span>我的自学</span>
2024-08-26 21:46:08 +08:00
</view> -->
2024-08-07 14:53:53 +08:00
<view>
2024-08-26 21:46:08 +08:00
<span>{{ allDuration }}</span>
2024-08-07 14:53:53 +08:00
<span>累计学时</span>
</view>
<view>
2024-08-26 21:46:08 +08:00
<span>{{ value }}</span>
2024-08-07 14:53:53 +08:00
<span>已获证书</span>
</view>
</view>
<view class="secs">
2024-08-26 21:46:08 +08:00
<view class="single-sec" v-for="(item, index) in secList" :key="item.id" @click="jumpUrl(item.path)">
2024-08-07 14:53:53 +08:00
<view class="lef-icon">
<image :src="item.src"></image>
</view>
<view style="margin-left: 2vw">{{ item.title }}</view>
</view>
</view>
<m-tabbar fixed fill :current="1" :tabbar="tabbar"></m-tabbar>
2024-08-26 21:46:08 +08:00
</view>
2024-08-07 14:53:53 +08:00
</template>
<script>
2024-08-26 21:46:08 +08:00
import TabbarConfig from '@/tabbar.js'
import config from '@/config'
export default {
data() {
return {
2024-08-28 09:51:05 +08:00
userName: uni.getStorageSync('userName'),
className: uni.getStorageSync('className'),
2024-08-28 17:23:03 +08:00
facePath: config.fileUrl + uni.getStorageSync('facePath'),
2024-08-26 21:46:08 +08:00
tabbar: TabbarConfig,
// 信息参数
learnStats: {
selfLearn: 17,
totalHrs: 218,
totalCer: 26
},
allDuration: 0,
2024-08-27 13:32:10 +08:00
value: 0, //
2024-08-26 21:46:08 +08:00
secList: [
2024-08-29 11:20:37 +08:00
// { id: 1, title: '切换门户', src: '/static/eduImg/changeGate.png', path: 'changeGate' },
2024-08-26 21:46:08 +08:00
{ id: 2, title: '人脸识别', src: '/static/eduImg/faceScan.png', path: 'faceScan' },
{ id: 3, title: '我的消息', src: '/static/eduImg/myMsg.png', path: 'myMsg' },
2024-08-29 11:20:37 +08:00
// { id: 4, title: '设置', src: '/static/eduImg/settings.png', path: 'settings' }
2024-08-26 21:46:08 +08:00
],
2024-08-28 09:51:05 +08:00
token: uni.getStorageSync('access_token')
2024-08-26 21:46:08 +08:00
}
},
onLoad() {
2024-08-27 13:32:10 +08:00
// this.token = uni.getStorageSync('App-Token')
console.log('🚀 ~ onLoad ~ this.token:', this.token)
2024-08-30 17:35:33 +08:00
console.log('🚀 ~ onLoad ~ this.facePath:', this.facePath)
2024-08-26 21:46:08 +08:00
this.getLearnStats()
},
methods: {
jumpUrl(path) {
uni.navigateTo({
url: `/pages/YNEduApp/user/${path}`
})
},
// 获取自学-学时-证书
getLearnStats() {
2024-08-28 09:51:05 +08:00
console.log('🚀 ~ getLearnStats ~ this.token:',uni.getStorageSync('access_token'))
2024-09-06 14:53:49 +08:00
this.$verificationToken()
2024-08-26 21:46:08 +08:00
uni.request({
url: config.baseUrl + '/exam-student/personalCenter/getStudyAndCer',
method: 'post',
header: {
2024-08-28 09:51:05 +08:00
Authorization: uni.getStorageSync('access_token')
// Authorization: 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozMSwidXNlcl9rZXkiOiIzNTFmNDJjMS00YTM4LTRlMDMtOWQxYy0wMWM2YjMwY2Y3OTUiLCJ1c2VybmFtZSI6IuaWueS6riJ9.4OatIEFwP5ZgrtH0CPR5yc1-dPUCGFlXrhwmFgvcH3jXuA0PSt5JiJgcw8nMnyPIbuDBktY3c2JalZXm-_RJTQ'
2024-08-26 21:46:08 +08:00
},
data: {},
success: res => {
2024-08-28 09:51:05 +08:00
console.log('🚀 ~ getLearnStats ~ res:', res.data)
res = res.data
if (res.code == 200) {
this.allDuration = (res.data && res.data.allDuration) || 0
this.value = (res.data && res.data.value) || 0
}
2024-08-26 21:46:08 +08:00
}
})
2024-08-27 13:32:10 +08:00
},
// 修改资料
handleEdit() {
const params = {
userName: this.userName,
className: this.className
}
uni.navigateTo({
url: '/pages/YNEduApp/user/editProfile?params=' + JSON.stringify(params)
})
2024-08-26 21:46:08 +08:00
}
}
}
2024-08-07 14:53:53 +08:00
</script>
<style lang="scss">
2024-08-26 21:46:08 +08:00
.page {
width: 100vw;
height: 100vh;
background: linear-gradient(#eaf0f7, #f8f8f8);
box-sizing: border-box;
padding: 15vh 8vw;
.user-edit {
width: 100%;
height: 10vh;
display: flex;
align-items: center;
margin-bottom: 3vh;
.user-avatar {
width: 8vh;
height: 8vh;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
2024-08-07 14:53:53 +08:00
2024-08-26 21:46:08 +08:00
.user-info {
width: 50%;
height: 100%;
box-sizing: border-box;
padding: 5%;
2024-08-07 14:53:53 +08:00
display: flex;
2024-08-26 21:46:08 +08:00
flex-direction: column;
justify-content: space-around;
}
2024-08-07 14:53:53 +08:00
2024-08-26 21:46:08 +08:00
.edit-btn {
flex: 1;
display: flex;
2024-08-07 14:53:53 +08:00
2024-08-26 21:46:08 +08:00
view {
width: 100%;
background: linear-gradient(90deg, #6dcdfa, #4ba2f9);
color: #fff;
2024-08-07 14:53:53 +08:00
box-sizing: border-box;
2024-08-26 21:46:08 +08:00
padding: 12rpx 0;
margin: auto;
border-radius: 20px;
2024-08-07 14:53:53 +08:00
display: flex;
2024-08-26 21:46:08 +08:00
justify-content: center;
align-items: center;
font-size: 12px;
2024-08-07 14:53:53 +08:00
}
}
2024-08-26 21:46:08 +08:00
}
2024-08-07 14:53:53 +08:00
2024-08-26 21:46:08 +08:00
.learn-infos {
width: 100%;
height: 12vh;
background: #fff;
border-radius: 15rpx;
box-shadow: #f1f1f2 2px 2px;
display: flex;
justify-content: space-around;
align-items: center;
margin-bottom: 2vh;
view {
width: 25%;
height: 50%;
2024-08-07 14:53:53 +08:00
display: flex;
2024-08-26 21:46:08 +08:00
flex-direction: column;
2024-08-07 14:53:53 +08:00
justify-content: space-around;
align-items: center;
2024-08-26 21:46:08 +08:00
span:first-child {
font-size: 20px;
font-weight: bold;
2024-08-07 14:53:53 +08:00
}
2024-08-26 21:46:08 +08:00
span:last-child {
font-size: 12px;
color: #767676;
}
2024-08-07 14:53:53 +08:00
}
2024-08-26 21:46:08 +08:00
}
2024-08-07 14:53:53 +08:00
2024-08-26 21:46:08 +08:00
.secs {
width: 100%;
background-color: #fff;
border-radius: 15rpx;
box-sizing: border-box;
padding: 4vh 3vw;
color: #727272;
2024-08-07 14:53:53 +08:00
2024-08-26 21:46:08 +08:00
.single-sec {
2024-08-07 14:53:53 +08:00
width: 100%;
box-sizing: border-box;
2024-08-26 21:46:08 +08:00
padding: 10px 0;
font-size: 14px;
display: flex;
align-items: center;
border-bottom: 1px solid #f6f6f6;
2024-08-07 14:53:53 +08:00
2024-08-26 21:46:08 +08:00
.lef-icon {
width: 5%;
height: 2vh;
2024-08-07 14:53:53 +08:00
2024-08-26 21:46:08 +08:00
image {
width: 100%;
height: 100%;
2024-08-07 14:53:53 +08:00
}
}
}
}
2024-08-26 21:46:08 +08:00
}
2024-08-07 14:53:53 +08:00
</style>