调整用户统计数据,用户勋章

This commit is contained in:
daihh
2022-10-10 12:32:24 +08:00
parent 168d11bf49
commit d74e487e49
4 changed files with 134 additions and 137 deletions

View File

@@ -126,7 +126,7 @@ const getRanking = function(queryData) {
* @param {String} aid 用户的id * @param {String} aid 用户的id
*/ */
const getUserStatTotalInfo = function(aid) { const getUserStatTotalInfo = function(aid) {
return ajax.get(baseURL,'/xboe/m/stat/user/getUserStatTotalInfo?aid='+aid); return ajax.get(baseURL,'/xboe/m/stat/user/statinfo?aid='+aid);
} }

View File

@@ -20,16 +20,16 @@
<h6>{{userInfo.name}}</h6> <h6>{{userInfo.name}}</h6>
<span>{{orgInfo}}</span> <span>{{orgInfo}}</span>
<div class="grade"> <div class="grade">
<div>{{userData.level}}</div> <div>{{statData.level}}</div>
<span>经验值{{userData.evalue}}</span> <span>经验值{{statData.evalue}}</span>
</div> </div>
<el-link @click="toPage('/user/Setting')" type="info" :underline="false"> <el-button class="editbutt">编辑资料</el-button></el-link> <el-link @click="toPage('/user/Setting')" type="info" :underline="false"> <el-button class="editbutt">编辑资料</el-button></el-link>
</div> </div>
<div class="content-bottom"> <div class="content-bottom">
<div class="medal"> <div class="medal-list">
<img src="../../../public/images/grade.png" alt=""> <div class="medal-info" v-for="(m,midx) in medalList" :key="m.id" v-if="midx<3">
<img src="../../../public/images/grade.png" alt=""> <img :src="fileBaseUrl+m.medalIcon" alt="">
<img src="../../../public/images/grade.png" alt=""> </div>
</div> </div>
<el-button class="medalbutt" type="text" @click="toPage('/user/medal')">更多 <i class="el-icon-d-arrow-right"></i> </el-button> <el-button class="medalbutt" type="text" @click="toPage('/user/medal')">更多 <i class="el-icon-d-arrow-right"></i> </el-button>
<div style="margin-top:10px"> <div style="margin-top:10px">
@@ -43,25 +43,25 @@
<div class="learningData"> <div class="learningData">
<div class="learning-info"> <div class="learning-info">
<div class="learning-qus">当月学习时长</div> <div class="learning-qus">当月学习时长</div>
<div class="learning-an"><span>{{uinfo.monthStudy}}</span>h</div> <div class="learning-an"><span>{{statData.monthStudyHour}}</span>h</div>
</div> </div>
<div class="learning-info"> <div class="learning-info">
<div class="learning-qus">累计学习时长</div> <div class="learning-qus">累计学习时长</div>
<div class="learning-an"><span>{{uinfo.monthTotal}}</span>h</div> <div class="learning-an"><span>{{statData.totalStudyHour}}</span>h</div>
</div> </div>
<div class="learning-border" ></div> <div class="learning-border" ></div>
<div class="learning-info"> <div class="learning-info">
<div class="learning-qus">当月学习天数</div> <div class="learning-qus">当月学习天数</div>
<div class="learning-an"><span>{{uinfo.monthDay}}</span></div> <div class="learning-an"><span>{{statData.monthStudyDays}}</span></div>
</div> </div>
<div class="learning-info"> <div class="learning-info">
<div class="learning-qus">累计学习天数</div> <div class="learning-qus">累计学习天数</div>
<div class="learning-an"><span>{{uinfo.monthTotalDay}}</span></div> <div class="learning-an"><span>{{statData.totalStudyDays}}</span></div>
</div> </div>
<div class="learning-border" ></div> <div class="learning-border" ></div>
<div class="learning-info"> <div class="learning-info">
<div class="learning-qus">我的U币累计</div> <div class="learning-qus">我的U币累计</div>
<div class="learning-an"><span>{{uinfo.uCurrency}}</span></div> <div class="learning-an"><span>{{statData.uvalue}}</span></div>
</div> </div>
<div class="learning-info"> <div class="learning-info">
<div @click="jumrank" style="cursor: pointer;" class="ranking-link"> BOE 排行榜 >></div> <div @click="jumrank" style="cursor: pointer;" class="ranking-link"> BOE 排行榜 >></div>
@@ -86,19 +86,18 @@ import {userAvatarText,cutFullName} from "@/utils/tools.js";
data(){ data(){
return { return {
fileBaseUrl:process.env.VUE_APP_FILE_BASE_URL, fileBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
uinfo:{ statData:{
monthStudy:0,//当月学习时长 evalue: 0,//经验值
monthTotal: 0, level: "LV1",//级别
monthDay:0, monthStudyHour:0,//当月学习时长
monthTotalDay:0, totalStudyHour: 0, //累计学习时长
uCurrency:0 monthStudyDays:0, //当月学习天数
totalStudyDays:0, //累计学习天数
uvalue:0 //U币数量
}, },
medalList:[],//勋章信息
orgInfo:'', orgInfo:'',
sex:'', sex:''
userData:{
evalue: 0,
level: "",
}
} }
}, },
mounted() { mounted() {
@@ -110,37 +109,25 @@ import {userAvatarText,cutFullName} from "@/utils/tools.js";
//let testName='京东方科技集团股份有限公司/北京中祥英科技有限公司/技术中心'; //let testName='京东方科技集团股份有限公司/北京中祥英科技有限公司/技术中心';
//this.orgInfo=cutFullName(testName,1); //this.orgInfo=cutFullName(testName,1);
this.orgInfo=cutFullName(this.userInfo.departFullName,1); this.orgInfo=cutFullName(this.userInfo.departFullName,1);
this.getInfo(); this.loadUserStat();
this.getLevel();
}, },
methods:{ methods:{
getLevel(){//获取经验值和等级 loadUserStat(){//获取经验值和等级
apiStart.getUserStatTotalInfo(this.userInfo.aid).then(res=>{ apiStart.getUserStatTotalInfo(this.userInfo.aid).then(res=>{
if(res.status == 200) { if(res.status == 200) {
this.userData.evalue = res.result.experienceValue; this.statData.evalue = res.result.evalue;
this.userData.level = res.result.level; 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;
} }
}); });
}, },
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){ setCurIdentity(iden){
this.$store.dispatch('SetCurIdentity',iden); this.$store.dispatch('SetCurIdentity',iden);
}, },
@@ -199,14 +186,18 @@ import {userAvatarText,cutFullName} from "@/utils/tools.js";
.content-bottom{ .content-bottom{
margin-top: 30px; margin-top: 30px;
display: flex; display: flex;
.medal{ .medal-list{
// float: left; //float: left;
img{ display: flex;
width: 36px; .medal-info{
height: 40px; img{
margin-right: 10px; width: 36px;
vertical-align: top; height: 40px;
} margin-right: 10px;
vertical-align: top;
}
}
} }
.medalbutt{ .medalbutt{
@@ -427,7 +418,7 @@ import {userAvatarText,cutFullName} from "@/utils/tools.js";
margin-right: 12px; margin-right: 12px;
} }
} }
.personalData{ .personalData{
.uesr-avaer{ .uesr-avaer{
margin-right: 10px; margin-right: 10px;

View File

@@ -10,16 +10,16 @@
<div class="medal-list" v-if="medalData.length > 0"> <div class="medal-list" v-if="medalData.length > 0">
<div class="medal-index" v-for="item in medalData" :key="item.id"> <div class="medal-index" v-for="item in medalData" :key="item.id">
<medal-img :item="item"></medal-img> <medal-img :item="item"></medal-img>
<p class="index-title">{{item.medalName}}</p> <p class="index-title">{{item.medalName}}</p>
<p class="index-text">您已超过{{item.exceed}}</p> <p class="index-text">您已超过{{item.exceed}}</p>
<el-button class="btn" type="primary" @click="goView(item)">查看详情</el-button> <el-button class="btn" type="primary" @click="goView(item)">查看详情</el-button>
</div> </div>
</div> </div>
<div v-else class="home-no-list"> <div v-else class="home-no-list">
<img class="img" style="width:360px;height:226px" src="/images/homeWu/no-madel.png" alt="" srcset=""> <img class="img" style="width:360px;height:226px" src="/images/homeWu/no-madel.png" alt="" srcset="">
<p class="text" style="color: #333333;margin-top:50px;font-size: 14px">你目前还没有勋章哦</p> <p class="text" style="color: #333333;margin-top:50px;font-size: 14px">你目前还没有勋章哦</p>
</div> </div>
<el-dialog class="medal-dialog" title="提示" :visible.sync="dialogVisible" width="657px" top="200px"> <el-dialog class="medal-dialog" title="提示" :visible.sync="dialogVisible" width="657px" top="200px">
<div class="medal-box"> <div class="medal-box">
<div class="medal-top"> <div class="medal-top">
@@ -40,28 +40,18 @@
<el-table <el-table
:data="rules" :data="rules"
style="width: 100%;height:200px;overflow-y: auto;"> style="width: 100%;height:200px;overflow-y: auto;">
<el-table-column <el-table-column prop="name" angin="center" label="勋章" width="80">
prop="name" angin="center"
label="勋章"
width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<img style="width:40px;height:40px" src="/images/medal.png" alt="" srcset=""> <img style="width:40px;height:40px" src="/images/medal.png" alt="" srcset="">
<!-- <medal-img class="table-medal" style="width:46px;height:52px" :item="medal"></medal-img> --> <!-- <medal-img class="table-medal" style="width:46px;height:52px" :item="medal"></medal-img> -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="level" angin="center" label="等级" width="80">
prop="level" angin="center"
label="等级"
width="80">
<template slot-scope="scope">LV{{scope.row.level}}</template> <template slot-scope="scope">LV{{scope.row.level}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="remark" angin="center" label="获得条件">
prop="remark" angin="center"
label="获得条件">
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="num" angin="center" width="120" label="获得人数">
prop="num" angin="center" width="120"
label="获得人数">
<template slot-scope="scope">{{scope.row.num?scope.row.num:0}}</template> <template slot-scope="scope">{{scope.row.num?scope.row.num:0}}</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -69,7 +59,7 @@
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import apiStat from '@/api/phase2/stat.js'; import apiStat from '@/api/phase2/stat.js';
import MedalImg from '@/components/Portal/medalImg.vue'; import MedalImg from '@/components/Portal/medalImg.vue';
@@ -127,7 +117,7 @@
goView(item) { goView(item) {
this.dialogVisible = true; this.dialogVisible = true;
this.medal = item; this.medal = item;
let data = this.medalConfig.find(it=>it.id ==item.medalId); let data = this.medalConfig.find(it=>it.id ==item.medalId);
this.rules = JSON.parse(data.rules); this.rules = JSON.parse(data.rules);
apiStat.userMedalLevelInfo(item.medalId).then(res=>{ apiStat.userMedalLevelInfo(item.medalId).then(res=>{
@@ -160,7 +150,7 @@
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .table-medal{ ::v-deep .table-medal{
.medal-text{ .medal-text{
@@ -174,7 +164,7 @@
.medal-dialog{ .medal-dialog{
::v-deep .el-dialog__header{ ::v-deep .el-dialog__header{
display: none; display: none;
} }
::v-deep .el-dialog__body{ ::v-deep .el-dialog__body{
background: rgba(216, 216, 216, 0.1); background: rgba(216, 216, 216, 0.1);
padding: 0; padding: 0;
@@ -216,7 +206,7 @@
.el-step__line{ .el-step__line{
background-color: #387DF7; background-color: #387DF7;
} }
} }
::v-deep .el-step__title.is-finish{ ::v-deep .el-step__title.is-finish{
font-size: 16px; font-size: 16px;
@@ -275,7 +265,7 @@
} }
} }
} }
.medal-box{ .medal-box{
padding: 30px 70px; padding: 30px 70px;
.medal-list{ .medal-list{
@@ -286,8 +276,8 @@
width: 144px; width: 144px;
margin: 40px 60px 0 60px; margin: 40px 60px 0 60px;
text-align: center; text-align: center;
.index-title{ .index-title{
margin-top: 26px; margin-top: 26px;
font-size: 18px; font-size: 18px;
@@ -339,4 +329,3 @@
} }
} }
</style> </style>

View File

@@ -117,7 +117,7 @@
</div> </div>
<!-- 课程单元 --> <!-- 课程单元 -->
<div class="course-units" v-if="tab == 1"> <div class="course-units" v-if="tab == 1">
<div style="min-height: 200px;overflow-y: auto;"> <div style="max-height: 500px;overflow-y: auto;">
<div class="catalog" v-if="courseInfo.type == 20"> <div class="catalog" v-if="courseInfo.type == 20">
<div v-for="(item, index) in catalogTree" :key="index" :name="index"> <div v-for="(item, index) in catalogTree" :key="index" :name="index">
<div style="margin: 10px 0px;font-weight: 700;">{{item.section.name}}</div> <div style="margin: 10px 0px;font-weight: 700;">{{item.section.name}}</div>
@@ -326,6 +326,8 @@
completed: [], completed: [],
tab: 1, tab: 1,
notetab: 1, notetab: 1,
localTimeKey:'boeu-study-time' ,//本地存储的学习时长的key json格式
localTimeValue:0,//计算的时间
} }
}, },
mounted() { mounted() {
@@ -369,6 +371,21 @@
} }
}, },
methods: { methods: {
/**
* 定时保存学习时长,每5秒保存在本地每1分钟保存到服务端清空本地数据
* 如果一进入,本地数据存在,就先保存到服务器,然后再重新计算时长
*/
autoLocalStudying(){
},
autoSaveStudying(){
let timeStr = localStorage.getItem(this.localTimeKey);
if(timeStr){
let timeJson=JSON.parse(timeStr);
}
},
//关注功能
toFollow(item) { toFollow(item) {
apiFollow.save(item.teacherId).then(res => { apiFollow.save(item.teacherId).then(res => {
if (res.status == 200) { if (res.status == 200) {
@@ -378,16 +395,19 @@
} }
}) })
}, },
//笔记组件触发,播放指定时间
onPlayVideo(contentId,time){ onPlayVideo(contentId,time){
//这里需要根据contentId,是否切换到对应的内容的视频的时间 //这里需要根据contentId,是否切换到对应的内容的视频的时间
//如果 contentId已经不存在需要提示
this.playerBoxShow = false; this.playerBoxShow = false;
this.notePlay = null; this.notePlay = null;
let $this=this;
setTimeout(() => { setTimeout(() => {
this.notePlay = time; $this.notePlay = time;
}, 1000) }, 500)
}, },
// 笔记功能 //笔记组件触发,记录当前播放时间
videoLocation() { // 记录笔记视频位置 videoLocation() {
//this.$store.dispatch("SetIntTimeNote", this.intTimeNote); //this.$store.dispatch("SetIntTimeNote", this.intTimeNote);
console.log(this.contentData.id+'='+this.intTimeNote,'设置视频播放时间') console.log(this.contentData.id+'='+this.intTimeNote,'设置视频播放时间')
this.$refs.mynote.setVideoTime(this.contentData.id,this.intTimeNote); this.$refs.mynote.setVideoTime(this.contentData.id,this.intTimeNote);
@@ -712,9 +732,48 @@
} }
}); });
}, },
ctabChange(e) {
//当前已经不再使用 onPlayerPlay() {
//console.log(e); //console.log("开始播放");
this.playerBoxShow = false;
let $this = this;
//console.log(this.contentData.status,'this.contentData.status');
// if(this.contentData.status<9){
// let completeType=this.curriculumData.completeSetup;
// //console.log(completeType,'completeType');
// if(completeType==0){
// //默认5秒后学习完成.
// $this.handleTimeout= setTimeout(function() {$this.saveStudyInfo();}, 5000); //5秒后记录学习完成
// }else{
// //先记录进行中的学习内容
// this.saveStudyItem();
// }
// }
},
onFullscreen(full) {
let divId = 'videowatermark';
var div = document.getElementById('myVideoPlayer')
if (full) {
var div3 = document.createElement("div");
div3.id = divId;
div3.setAttribute("class", "fullmark");
div3.innerHTML = '';
//从父组件传过来的水印内容
//div3.innerText =this.userInfo.name+this.userInfo.code;
for (var i = 0; i < 8; i++) {
div3.innerHTML +=
'<div style="color:#ffffff;width: 40%;height: 155px;padding-left:60px;padding-top:50px; display: flex;justify-content: center; transform: rotate(-36deg);font-size:20px;">' +
this.userInfo.name + this.userInfo.loginName + '</div>';
}
div3.style.cssText =
"position:absolute;pointer-events: none; width: 100%;height: 100%;top:0;left:0;bottom: 0;right: 0; display: flex;justify-content: center;flex-wrap: wrap;overflow: hidden; opacity:0.3;padding-top:10px";
div.appendChild(div3);
} else {
var markDiv = div.querySelector("#" + divId);
if (markDiv) {
div.removeChild(markDiv);
}
}
}, },
onPlayerPause() { onPlayerPause() {
//console.log("暂停"); //console.log("暂停");
@@ -1016,6 +1075,7 @@
} }
//首先从本地读取 //首先从本地读取
let duration = studyUtil.getStudyDuration(); let duration = studyUtil.getStudyDuration();
//追加学习时间 //追加学习时间
let $this = this; let $this = this;
if (this.appendStartTime == null) { if (this.appendStartTime == null) {
@@ -1063,48 +1123,7 @@
$this.appendStudyTime(); $this.appendStudyTime();
}, $this.appentInterval); }, $this.appentInterval);
}, },
onPlayerPlay() {
//console.log("开始播放");
this.playerBoxShow = false;
let $this = this;
//console.log(this.contentData.status,'this.contentData.status');
// if(this.contentData.status<9){
// let completeType=this.curriculumData.completeSetup;
// //console.log(completeType,'completeType');
// if(completeType==0){
// //默认5秒后学习完成.
// $this.handleTimeout= setTimeout(function() {$this.saveStudyInfo();}, 5000); //5秒后记录学习完成
// }else{
// //先记录进行中的学习内容
// this.saveStudyItem();
// }
// }
},
onFullscreen(full) {
let divId = 'videowatermark';
var div = document.getElementById('myVideoPlayer')
if (full) {
var div3 = document.createElement("div");
div3.id = divId;
div3.setAttribute("class", "fullmark");
div3.innerHTML = '';
//从父组件传过来的水印内容
//div3.innerText =this.userInfo.name+this.userInfo.code;
for (var i = 0; i < 8; i++) {
div3.innerHTML +=
'<div style="color:#ffffff;width: 40%;height: 155px;padding-left:60px;padding-top:50px; display: flex;justify-content: center; transform: rotate(-36deg);font-size:20px;">' +
this.userInfo.name + this.userInfo.loginName + '</div>';
}
div3.style.cssText =
"position:absolute;pointer-events: none; width: 100%;height: 100%;top:0;left:0;bottom: 0;right: 0; display: flex;justify-content: center;flex-wrap: wrap;overflow: hidden; opacity:0.3;padding-top:10px";
div.appendChild(div3);
} else {
var markDiv = div.querySelector("#" + divId);
if (markDiv) {
div.removeChild(markDiv);
}
}
},
finishStudyItem() { //设置完成学习的内容,针对于音视频的内容 finishStudyItem() { //设置完成学习的内容,针对于音视频的内容
if (!this.contentData.studyItemId) { if (!this.contentData.studyItemId) {
//这种可能没有不过这里也是为了万中那个1 //这种可能没有不过这里也是为了万中那个1
@@ -1164,10 +1183,7 @@
}, },
heartabtwo() { heartabtwo() {
this.tab = 2 this.tab = 2
}, }
notetab1(num) {
this.notetab = num
},
}, },
} }
</script> </script>
@@ -1740,13 +1756,14 @@
height: 60px; height: 60px;
line-height: 60px; line-height: 60px;
font-size: 16px; font-size: 16px;
cursor: pointer;
} }
.units-active { .units-active {
background: #F6F6F6; background: #F6F6F6;
color: #387DF7; color: #387DF7;
font-weight: 600; font-weight: 600;
cursor: text;
img { img {
width: 18px; width: 18px;
height: 20px; height: 20px;