Files
learning-system-portal/src/components/UcHeader/Index.vue
2022-09-16 11:52:07 +08:00

385 lines
11 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="uc-header xcontent">
<div class="header-box" >
<div class="personalData">
<!-- <div >
<img src="../../../public/images/Avatarwoman.png" alt="">
</div> -->
<div class="uesr-avaer">
<img :src="userInfo.avatar" v-if="userInfo.avatar !== '' ">
<div v-else class="uavatar">
<div v-if="sex === 1 "><img src="../../../public/images/Avatarman.png" alt=""></div>
<div v-else><img src="../../../public/images/Avatarwoman.png" alt=""></div>
</div>
</div>
<div class="user-content">
<div class="content-top">
<h6><router-link to="/homePage"> {{userInfo.name}}</router-link>
</h6>
<span>{{orgInfo}}</span>
<el-link @click="toPage('/user/Setting')" type="info" :underline="false"> <el-button class="editbutt" icon="el-icon-edit" type="text">编辑资料</el-button></el-link>
</div>
<div class="content-bottom">
<div class="medal">
<img src="../../../public/images/grade.png" alt="">
<img src="../../../public/images/grade.png" alt="">
<img src="../../../public/images/grade.png" alt="">
</div>
<el-button class="medalbutt" type="text">更多 <i class="el-icon-d-arrow-right"></i> </el-button>
<div class="grade">
<div>LV.1</div>
<span>经验值367</span>
</div>
</div>
</div>
</div>
<div class="learningData">
<div class="learning-info">
<div class="learning-qus">当月学习时长</div>
<div class="learning-an"><span>{{uinfo.monthStudy}}</span>h</div>
</div>
<div class="learning-info">
<div class="learning-qus">累计学习时长</div>
<div class="learning-an"><span>{{uinfo.monthTotal}}</span>h</div>
</div>
<div class="learning-border" ></div>
<div class="learning-info" style="margin-left:22px">
<div class="learning-qus">当月学习天数</div>
<div class="learning-an"><span>{{uinfo.monthDay}}</span></div>
</div>
<div class="learning-info">
<div class="learning-qus">累计学习天数</div>
<div class="learning-an"><span>{{uinfo.monthTotalDay}}</span></div>
</div>
<div class="learning-border" ></div>
<div class="learning-info" style="margin-left:22px">
<div class="learning-qus">我的U币累计</div>
<div class="learning-an"><span>{{uinfo.uCurrency}}</span></div>
</div>
<div class="list">
BOE 排行榜 >>
</div>
</div>
<!-- <div style="display: flex;justify-content: flex-start;">
<div style="padding-left: 15px;">
<div style="height: 38px;padding-left: 5px;">
<span style="font-size: 20px;font-weight: 500;color: #333;">{{userInfo.name}}</span>
<span style="padding-left: 10px;color: #888888;font-size: 12px;cursor: pointer;">
<el-link @click="toPage('/user/Setting')" icon="el-icon-setting" type="info" :underline="false">个人设置</el-link>
</span>
</div>
<div style="height: 35px;padding-left: 5px;color:#7a7a7a;">
<span style="color: #7a7a7a;padding-right: 15px;" v-if="orgInfo">{{orgInfo}}</span>
目前海没有实时更新的策略暂未处理
<span>学习时长{{userInfo.studyTotalH}}小时</span>
</div>
<div>
<router-link to="/study/index"><span :class="{identity:true,active:curIdentity==1}" @click="setCurIdentity(1)">学员</span></router-link>
<router-link to="/teacher/index"><span v-if="identity == 2 || identity == 5" :class="{identity:true,active:curIdentity==2}" @click="setCurIdentity(2)">教师</span></router-link>
<router-link to="/manager/index"><span v-if="identity == 3 || identity == 5" :class="{identity:true,active:curIdentity==3}" @click="setCurIdentity(3)">管理员</span></router-link>
</div>
</div>
</div> -->
<!-- <div style="display: flex;justify-content: flex-end;padding-top: 35px;"> -->
<!-- q1没有课程表所以这里先隐藏
<div v-if="curIdentity==2" style="padding: 0px 40px 0px 0px;color: #1EA0FA;text-align: center;">
<div><i style="font-size: 40px;" class="el-icon-date"></i> <br/>授课表</div>
</div>
-->
<!---->
<!-- <div>
<div tabindex="1" class="upicon" @click="toPage('/user/myshare')">
<i class="el-icon-share"></i>
<div>我分享的</div>
</div>
</div>
<div>
<div tabindex="2" class="upicon" @click="toPage('/user/toshare')">
<i class="el-icon-s-promotion"></i>
<div>分享给我的</div>
</div>
</div>
<div>
<div tabindex="3" class="upicon" @click="toPage('/user/favorites')">
<i class="el-icon-star-on"></i>
<div>我的收藏</div>
</div>
</div> -->
<!-- </div> -->
</div>
</div>
</template>
<script>
import {userAvatarText,cutFullName} from "@/utils/tools.js";
import { mapGetters } from 'vuex'
import apiStart from '@/api/phase2/stat.js'
export default {
name: 'UcHeader',
computed:{
...mapGetters(['curIdentity','identity','userInfo']),
avatarText(){
return userAvatarText(this.userInfo.name);
}
},
data(){
return {
fileBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
uinfo:{
monthStudy:0,//当月学习时长
monthTotal: 0,
monthDay:0,
monthTotalDay:0,
uCurrency:0
},
orgInfo:'',
sex:'',
}
},
mounted() {
this.sex = this.userInfo.sex;
// 判断路由是进入的学员默认页面就重置setCurIdentity
if(this.$route.path == '/uc/study/task' || this.$route.path == '/study/index'){
this.setCurIdentity(1);
}
//let testName='京东方科技集团股份有限公司/北京中祥英科技有限公司/技术中心';
//this.orgInfo=cutFullName(testName,1);
this.orgInfo=cutFullName(this.userInfo.departFullName,1);
this.getInfo();
},
methods:{
getInfo(){
apiStart.userTotal(this.userInfo.aid,[10,11,30]).then(res=>{
if(res.status == 200 && res.result.length > 0) {
res.result.forEach(item => {
if(item.statType == 10) {
this.uinfo.monthStudy = item.months;
this.uinfo.monthTotal = item.total;
}
if(item.statType == 11) {
this.uinfo.monthDay = item.months;
this.uinfo.monthTotalDay = item.total;
}
if(item.statType == 30) {
this.uinfo.uCurrency = item.total;
}
});
}
})
},
setCurIdentity(iden){
this.$store.dispatch('SetCurIdentity',iden);
},
toPage(url){
this.$router.push({path:url})
},
}
}
</script>
<style lang="scss" scoped>
.list{
font-size: 16px;
font-weight: 600;
color: #333333;
margin-top: 20px;
}
.learningData{
width: 50%;
padding-top: 70px;
box-sizing: border-box;
margin-left:auto;
.learning-info{
float: left;
margin-right: 22px;
.learning-qus{
font-size: 14px;
color: #666660;
margin-bottom: 24px;
}
.learning-an{
color: #999999;
text-align: center;
font-size: 14px;
span{
font-weight: 600;
font-size: 22px;
color: #0060FF;
margin-right: 6px;
}
}
}
.learning-border{
width: 1px;
height: 49px;
opacity: 0.3;
border: 1px solid #AAA6A6;
float: left;
margin-top: 10px;
}
}
.content-bottom{
margin-top: 30px;
.medal{
float: left;
img{
width: 36px;
height: 40px;
margin-right: 10px;
vertical-align: top;
}
}
.medalbutt{
color: #333333;
font-size: 14px;
float: left;
margin-top: 10px;
}
.grade{
float: left;
margin-top: 10px;
div{
margin-left: 22px;
font-weight: 600;
float: left;
width: 70px;
height: 30px;
text-align: center;
line-height: 30px;
color: #9D6110 ;
background: url('../../../public/images/lvbg.png') no-repeat;
}
span{
font-size: 14px;
color: #A3680A;
line-height: 32px;
margin-left: 13px;
}
}
}
.personalData{
flex: 1;
padding-top: 40px;
padding-left: 115px;
box-sizing: border-box;
display: flex;
.uesr-avaer{
width: 120px;
height: 120px;
margin-right: 20px;
img{
width: 100%;
height: 100%;
border-radius: 50%;
vertical-align: top;
}
}
.user-content{
flex: 1;
.content-top{
margin-top: 15px;
line-height: 25px;
h6{
color: #333333;
font-size: 26px;
margin:0;
float: left;
}
span{
color: #999999;
font-size: 14px;
margin-left: 5px;
margin-right: 24px;
}
.editbutt{
font-size: 14px;
color: #333333;
}
}
}
}
.header-box{
display: flex;
justify-content: space-between;
height: 210px;
background: url('../../../public/images/userbgimg.png') no-repeat;
background-size:445px 210px;
background-position: right 0;
}
.uc-header{
height: 210px;
margin: 0 auto;
background: #fff;
// background-color: #c9c2c2;
}
.upicon{
text-align: center;
cursor: pointer;
margin-top: 10px;
margin-left: 15px;
font-size: 14px;
i{font-size: 30px;color: #ffb30f;}
div{color: #7b7b7b;padding: 5px 0px 10px 0px;}
}
.upicon:focus div{
color: #588afc;
}
.identity{
padding: 5px 10px;
border: 1px solid #fcfcfc;
border-radius: 8px;
cursor: pointer;
background-color: #ffffff;
margin: 5px;
}
.active{
background-color: #ffb30f;
color: #FFFFFF;
border: 1px solid #ffb30f;
}
.uc-alert{
margin: 10px;
text-align: center;
padding: 0px 50x;
.uc-alert-label{
color: #3f3f3f;
}
.uc-alert-value{
padding-top: 10px;
color: #aa0000;
}
}
.uavatar{
border-radius: 50%;
// border: 1px solid #73adfe;
// color: #73adfe;
text-align: center;
font-size: 30px;
line-height: 100px;
width: 100px;
height: 100px;
border-radius: 50%;
// background: #d9e9ff;
div{
border-radius: 50%;
img{
border-radius: 50%;
width: 100px;
height: 100px;
}
}
}
</style>