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

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

View File

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

View File

@@ -117,7 +117,7 @@
</div>
<!-- 课程单元 -->
<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 v-for="(item, index) in catalogTree" :key="index" :name="index">
<div style="margin: 10px 0px;font-weight: 700;">{{item.section.name}}</div>
@@ -326,6 +326,8 @@
completed: [],
tab: 1,
notetab: 1,
localTimeKey:'boeu-study-time' ,//本地存储的学习时长的key json格式
localTimeValue:0,//计算的时间
}
},
mounted() {
@@ -369,6 +371,21 @@
}
},
methods: {
/**
* 定时保存学习时长,每5秒保存在本地每1分钟保存到服务端清空本地数据
* 如果一进入,本地数据存在,就先保存到服务器,然后再重新计算时长
*/
autoLocalStudying(){
},
autoSaveStudying(){
let timeStr = localStorage.getItem(this.localTimeKey);
if(timeStr){
let timeJson=JSON.parse(timeStr);
}
},
//关注功能
toFollow(item) {
apiFollow.save(item.teacherId).then(res => {
if (res.status == 200) {
@@ -378,16 +395,19 @@
}
})
},
//笔记组件触发,播放指定时间
onPlayVideo(contentId,time){
//这里需要根据contentId,是否切换到对应的内容的视频的时间
//如果 contentId已经不存在需要提示
this.playerBoxShow = false;
this.notePlay = null;
let $this=this;
setTimeout(() => {
this.notePlay = time;
}, 1000)
$this.notePlay = time;
}, 500)
},
// 笔记功能
videoLocation() { // 记录笔记视频位置
//笔记组件触发,记录当前播放时间
videoLocation() {
//this.$store.dispatch("SetIntTimeNote", this.intTimeNote);
console.log(this.contentData.id+'='+this.intTimeNote,'设置视频播放时间')
this.$refs.mynote.setVideoTime(this.contentData.id,this.intTimeNote);
@@ -712,9 +732,48 @@
}
});
},
ctabChange(e) {
//当前已经不再使用
//console.log(e);
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);
}
}
},
onPlayerPause() {
//console.log("暂停");
@@ -1016,6 +1075,7 @@
}
//首先从本地读取
let duration = studyUtil.getStudyDuration();
//追加学习时间
let $this = this;
if (this.appendStartTime == null) {
@@ -1063,48 +1123,7 @@
$this.appendStudyTime();
}, $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() { //设置完成学习的内容,针对于音视频的内容
if (!this.contentData.studyItemId) {
//这种可能没有不过这里也是为了万中那个1
@@ -1164,10 +1183,7 @@
},
heartabtwo() {
this.tab = 2
},
notetab1(num) {
this.notetab = num
},
}
},
}
</script>
@@ -1740,13 +1756,14 @@
height: 60px;
line-height: 60px;
font-size: 16px;
cursor: pointer;
}
.units-active {
background: #F6F6F6;
color: #387DF7;
font-weight: 600;
cursor: text;
img {
width: 18px;
height: 20px;