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