Files
learning-system-portal/src/components/UcHeader/Index.vue
2022-12-12 19:21:28 +08:00

532 lines
13 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">
<div class="uc-header-box" >
<div class="personalData">
<!-- <div >
<img src="../../../public/images/Avatarwoman.png" alt="">
</div> -->
<div class="uesr-avaer">
<router-link :to="'/home/'+userInfo.aid">
<img v-if="userInfo.avatar !== '' " :src="userInfo.avatar" >
<div v-else class="uavatar">
<div v-if="sex === 1 "><img src="../../../public/images/Avatarman.png" style="width: 100%;" alt=""></div>
<div v-if="sex === 2 "><img src="../../../public/images/Avatarwoman.png" style="width: 100%" alt=""></div>
</div>
</router-link>
</div>
<div class="user-content">
<div>
<div>
<div class="content-top" style="min-width: 260px;">
<h6>{{userInfo.name}}</h6>
<span>{{orgInfo}}</span>
</div>
<div class="grade" style="min-width: 260px;">
<div class="level">{{statData.level}}</div>
<span style="margin-right:15px">经验值{{statData.evalue}}</span>
<span class="content-one-info pointer" style="margin-right:12px;line-height: 30px;"><router-link :to="'/user/Setting'">个人设置</router-link></span>
<span class="content-one-info" style="line-height: 30px;"><router-link :to="'/home/'+userInfo.aid">个人主页</router-link></span>
</div>
</div>
<div style="text-align: center;">
<div>
</div>
<div style="margin-top:10px;">
</div>
</div>
</div>
<div class="content-bottom">
<div class="medal-list">
<div class="medal-info" v-for="(m,midx) in medalList" :key="m.id" v-if="midx<3">
<img v-if="m.medalId != 5" :src="fileBaseUrl+m.medalIcon" alt="">
</div>
</div>
<el-button class="medalbutt" v-if="medalList.length > 0" type="text" @click="toPage('/user/medal')">更多 <i class="el-icon-d-arrow-right"></i> </el-button>
<div style="margin-top:10px">
<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>
<span v-if="identity == 3 || identity == 5" :class="{identity:true,active:curIdentity==3}" @click="setCurIdentity(3)">管理员</span>
</div>
</div>
</div>
</div>
<div class="learningData">
<div class="learning-info">
<div class="learning-qus">当月学习时长</div>
<div class="learning-an"><span>{{statData.monthStudyHour}}</span>h</div>
</div>
<div class="learning-info">
<div class="learning-qus">累计学习时长</div>
<div class="learning-an"><span>{{statData.totalStudyHour}}</span>h</div>
</div>
<div class="learning-border" ></div>
<div class="learning-info">
<div class="learning-qus">当月学习天数</div>
<div class="learning-an"><span>{{statData.monthStudyDays}}</span></div>
</div>
<div class="learning-info">
<div class="learning-qus">累计学习天数</div>
<div class="learning-an"><span>{{statData.totalStudyDays}}</span></div>
</div>
<div class="learning-border" ></div>
<div class="learning-info">
<div class="learning-qus">我的U币累计</div>
<div class="learning-an"><span>{{statData.uvalue}}</span></div>
</div>
<div class="learning-info">
<div @click="jumrank" style="cursor: pointer;" class="ranking-link"> BOE 排行榜 >></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'
import testUser from '@/utils/testUsers.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,
isTest:false,
statData:{
evalue: 0,//经验值
level: "LV1",//级别
monthStudyHour:0,//
totalStudyHour: 0, //累计学习时长
monthStudyDays:0, //当月学习天数
totalStudyDays:0, //累计学习天数
uvalue:0 //U币数量
},
medalList:[],//勋章信息
orgInfo:'',
sex:''
}
},
mounted() {
this.sex = this.userInfo.sex;
//console.log(this.sex,'this.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.loadUserStat();
this.$bus.$on('u-Currency',(num)=>{
this.statData.uvalue = num;
})
//console.log(this.userInfo.loginName,'this.userInfo.loginName')
if(testUser.isTest(this.userInfo.loginName)){
this.isTest=true;
}
},
methods:{
loadUserStat(){//获取经验值和等级
let $this=this;
apiStart.getUserStatTotalInfo(this.userInfo.aid).then(res=>{
if(res.status == 200) {
this.statData.evalue = res.result.evalue;
this.statData.level = res.result.level;
this.statData.monthStudyHour = res.result.monthStudyHour;
this.statData.totalStudyHour = res.result.totalStudyHour;
this.statData.monthStudyDays = res.result.monthStudyDays;
this.statData.totalStudyDays = res.result.totalStudyDays;
this.statData.uvalue = res.result.uvalue;
$this.medalList=[];
res.result.medalList.forEach(aa=>{
if(aa.medalId!=5){
$this.medalList.push(aa);
}
})
}
});
},
setCurIdentity(iden){
this.$store.dispatch('SetCurIdentity',iden);
this.$router.push('/manager/index');
// if(this.isTest){
// //this.$router.push('/manage/learningpath');
// location.href='/manage/learningpath';
// }else{
// this.$router.push('/manager/index');
// }
},
jumrank(){
this.$router.push('/user/ranking');
},
toPage(url){
this.$router.push({path:url})
},
}
}
</script>
<style lang="scss" scoped>
.level{
float: left;
width: 57px;
margin-top: 5px;
margin-right: 8px;
height: 24px;
line-height: 24px;
text-align: center;
background-image: url(../../../public/images/lvbg.png);
background-repeat: no-repeat;
background-size:100%;
}
.content-one-info{
display: inline-block;
line-height: 30px;
width: 80px;
height: 30px;
text-align: center;
border-radius: 20px;
padding: 0;
border: 1px solid #619DFF !important;
font-size: 14px;
color: #387DF7 !important;
}
.ranking-link{
font-size: 16px;
font-weight: 600;
color: #333333;
margin-top: 20px;
}
.learningData{
padding-top: 70px;
box-sizing: border-box;
margin-left:auto;
.learning-info{
float: left;
margin-left: 20px;
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: 10px;
display: flex;
.medal-list{
//float: left;
display: flex;
.medal-info{
img{
width: 36px;
height: 40px;
margin-right: 10px;
vertical-align: top;
}
}
}
.medalbutt{
color: #333333;
font-size: 14px;
margin-right: 40px;
// float: left;
margin-top: 6px;
}
}
.personalData{
flex: 1;
padding-top: 40px;
box-sizing: border-box;
display: flex;
.uesr-avaer{
width: 120px;
height: 120px;
margin-right: 20px;
.uavatar{
width: 120px;
height: 120px;
}
img{
width: 100%;
height: 100%;
border-radius: 50%;
vertical-align: top;
}
}
.user-content{
flex: 1;
.grade{
margin-top: 10px;
// display: inline-block;
div{
font-weight: 600;
float: left;
width: 58px;
height: 24px;
// text-align: center;
color: #9D6110 ;
}
span{
font-size: 14px;
color: #A3680A;
line-height: 32px;
}
}
.content-top{
// margin-top: 10px;
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{
width: 97px;
height: 30px;
line-height: 10px;
border-radius: 4px;
border: 1px solid #588afc;
font-size: 14px;
color: #588afc;
}
.uc-header-box{
display: flex;
justify-content: space-between;
height: 210px;
margin: 0 auto;
}
.uc-header{
height: 210px;
background-color: #fff;
background-image: url('../../../public/images/userbgimg.png') ;
background-repeat: no-repeat;
background-size:445px 210px;
background-position: right 0;
}
.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;
width: 76px;
height: 30px;
// border: 1px solid #fcfcfc;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
color: #9D6110;;
background-color: rgba($color: #FFECC7, $alpha: 0.54);
margin: 5px;
}
.active{
background-color: #F99000;
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;
}
}
@media screen and (max-width: 1366px){
.uc-header-box {
width: 1160px;
}
.learningData{
margin-left:auto;
.learning-info{
margin-left: 10px;
margin-right: 10px;
.learning-qus{
font-size: 12px;
}
.learning-an{
font-size: 12px;
}
}
}
.personalData{
.uesr-avaer{
margin-right: 10px;
}
.user-content{
.content-top{
.grade{
div{
width: 48px;
}
span{
font-size: 14px;
}
}
h6{
font-size: 26px;
}
span{
font-size: 14px;
margin-left: 5px;
margin-right: 10px;
}
.editbutt{
width: 80px;
height: 25px;
line-height: 5px;
text-align: center;
font-size: 12px;
}
}
}
}
.content-bottom{
.medalbutt{
margin-right: 20px;
}
}
}
@media screen and (max-width: 1680px) and (min-width:1367px){
.uc-header-box {
width: 1300px;
}
.learningData{
margin-left:auto;
.learning-info{
margin-left: 10px;
margin-right: 12px;
}
}
.personalData{
.uesr-avaer{
margin-right: 10px;
}
.user-content{
.content-top{
.grade{
div{
width: 48px;
}
span{
font-size: 14px;
}
}
h6{
font-size: 26px;
}
span{
font-size: 14px;
margin-left: 5px;
margin-right: 15px;
}
.editbutt{
width: 80px;
height: 25px;
line-height: 5px;
text-align: center;
font-size: 12px;
}
}
}
}
}
@media screen and (max-width: 1920px) and (min-width: 1681px){
.uc-header-box {
width: 1600px;
}
.learningData{
margin-left:auto;
.learning-info{
margin-left: 20px;
margin-right: 22px;
}
}
}
@media screen and (min-width: 1921px){
.uc-header-box {
width: 1800px;
}
.learningData{
margin-left:auto;
.learning-info{
margin-left: 30px;
margin-right: 30px;
}
}
}
</style>