YNUtdPlatform/pages/YNEduApp/user/user.vue

248 lines
5.7 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>
<view class="user-info">
2024-08-26 21:46:08 +08:00
<span style="font-size: 24px">{{ userName }}</span>
<span style="font-size: 12px; color: #8a8a8b">{{ className }}</span>
2024-08-07 14:53:53 +08:00
</view>
<view class="edit-btn">
<view @click="jumpUrl('editProfile')">修改资料</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 {
userName: '',
className: '',
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: ''
}
},
onLoad() {
this.token = uni.getStorageSync('App-Token')
this.getUserInfo()
this.getLearnStats()
},
methods: {
jumpUrl(path) {
uni.navigateTo({
url: `/pages/YNEduApp/user/${path}`
})
},
// 获取用户信息
getUserInfo() {
const params = {
username: uni.getStorageSync('userPhone'),
jwtToken: uni.getStorageSync('jwtToken')
2024-08-07 14:53:53 +08:00
}
2024-08-26 21:46:08 +08:00
uni.request({
url: config.login + '/login',
method: 'POST',
data: JSON.stringify(params),
header: {
'Content-Type': 'application/json'
},
success: res => {
console.log(res)
let req = res.data
console.log('🚀 ~ getUserInfo ~ req:', req)
this.userName = req.data.loginUser.userName
this.className = req.data.loginUser.sysUser.className
this.facePath = config.fileUrl + req.data.loginUser.sysUser.facePath
uni.setStorageSync('facePath', this.facePath)
console.log('🚀 ~ getUserInfo ~ this.facePath:', this.facePath)
},
fail: err => {
console.log(err)
}
})
},
// 获取自学-学时-证书
getLearnStats() {
uni.request({
url: config.baseUrl + '/exam-student/personalCenter/getStudyAndCer',
method: 'post',
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: this.token
},
data: {},
success: res => {
console.log('🚀 ~ getLearnStats ~ res:', res)
this.allDuration = res.data.data.allDuration
this.value = res.data.data.value
}
})
}
}
}
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>