Merge branch 'dev'

This commit is contained in:
daihh
2022-07-10 15:59:12 +08:00
10 changed files with 131 additions and 628 deletions

View File

@@ -99,6 +99,15 @@ const queryComments=function(pageSize){
const majorTypes=function (){
return ajax.get('/xboe/m/boe/cases/majorTypes');
}
/**
* 详情新*/
const details = function (id, addView) {
let pars = 'id=' + id;
if (addView) {
pars += '&addView=' + addView
}
return ajax.get('/xboe/m/boe/cases/details?' + pars);
}
export default {
indexList,
@@ -112,5 +121,6 @@ export default {
usernameList,
queryPraises,
queryComments,
majorTypes
majorTypes,
details
}

View File

@@ -89,6 +89,8 @@ export default {
apiArticle.detail(id,false).then(res => {
if (res.status == 200) {
this.addForm = res.result;
// this.addForm.content = res.result.content.trim();
// console.log(this.addForm.content)
if(this.addForm.coverurl){
this.converImage = this.fileBaseUrl + this.addForm.coverurl;
}
@@ -137,6 +139,16 @@ export default {
}
this.loading=true;
this.addForm.status = 2;
let content= this.addForm.content.replace(/<.*?>/ig,"");
console.log(content)
if(content.trim() == ''){
this.$message('您输入的内容为空,无法发布')
type: 'warning'
this.loading=false
return
}
this.addForm.content=content.trim()
console.log(this.addForm.content,'iguighui')
apiArticle.save(this.addForm).then(res => {
if (res.status == 200) {
if(res.message=='服务处理成功'){

View File

@@ -54,7 +54,6 @@
<span slot="title" class="textl">课件管理</span>
</el-menu-item>
</el-submenu>
<el-submenu index="exam" v-show="curIdentity == 3">
<template slot="title">
<svg-icon icon-class="exam" style="font-size:14px"></svg-icon>
@@ -345,6 +344,10 @@ export default {
activeMenu() {
const route = this.$route;
const { meta, path } = route;
console.log(meta)
if(meta.title == '添加受众'){
meta.activeMenu = '/manage/ugroups'
}
if (meta.activeMenu) {
return meta.activeMenu;
}

View File

@@ -117,7 +117,7 @@
</span>
<span class="more"><router-link to="/case">更多&nbsp;></router-link></span>
</div>
<div class="modules-list xrow" style="height: 235px;overflow: hidden;">
<div class="modules-list xrow" style="height: 255px;overflow: hidden;">
<div class="index-course xrow-course" v-for="ca in caseList.list" :key="ca.id">
<div class="casetwo" :body-style="{ padding: '0px' }">
<!-- <div class="case-top"></div> -->
@@ -139,7 +139,7 @@
<div class="case-inter">
<interactBar :type="3" :readonly="true" :data="ca" :shares="false" :views="false"></interactBar>
</div>
<div style="height:40px;margin-top:10px">
<div class="case-orginfo" style="margin-top:10px">
<authorInfo :avatar="ca.authorInfo.avatar" :info="ca.authorInfo.orgInfo" :name="ca.authorInfo.name" :sex="ca.authorInfo.sex"></authorInfo></div>
</div>
</div>
@@ -649,6 +649,10 @@ export default {
</script>
<style scoped lang="scss">
.case-orginfo{
// line-height: 25px;
height: 45px;
}
.three-line-ellipsis {
overflow: hidden;
text-overflow: ellipsis;
@@ -661,7 +665,7 @@ export default {
.casetwo{
border: 1px solid #F0F0F0;
width: 100%;
height: 220px;
height: 245px;
margin-bottom:15px;
position: relative;
background-color: #fff;
@@ -672,12 +676,9 @@ export default {
.case-conent{
width: 100%;
height: 100%;
// box-shadow: 1px 1px 15px #ccc;
// position: absolute;
// top: 5%;
background-color: #fff;
// left: 4%;
padding: 16px;
padding: 15px;
.case-time{
font-size: 12px;
color: #999999;
@@ -688,14 +689,15 @@ export default {
font-size: 20px;
color: #333;
font-weight: bold;
margin-bottom:10px;
margin-bottom:8px;
}
.case-text{
height: 55px;
height: 60px;
font-size: 14px;
overflow: hidden;
color: #888888;
line-height: 18px;
margin-bottom:12px;
// line-height: 18px;
margin-bottom:10px;
}
::v-deep .case-inter{
width: 100%;

View File

@@ -27,7 +27,8 @@
<div class="btn-div clearfix" >
<div style="color:#2974D6;font-weight: 450;" v-if="caseDetail.orgDomain" class="item">{{ orgDomainTranslate(caseDetail.orgDomain) }}</div>
<div style="color:#2974D6;font-weight: 450;" class="item" v-if="caseDetail.orgDomain == '' && caseDetail.orgDomainParent">{{ orgDomainTranslate(caseDetail.orgDomainParent) }}</div>
<div style="color:#2974D6;font-weight: 450;" v-if="caseDetail.majorType" class="item">{{ majorTypeTranslate(caseDetail.majorType) }}</div>
<!-- <div style="color:#2974D6;font-weight: 450;" v-if="caseDetail.majorType" class="item">{{ majorTypeTranslate(caseDetail.majorType) }}</div> -->
<div class="item" style="color:#2974D6;font-weight: 450;" v-for="item,idx in caseDetail.majorType" :key="idx" >{{ majorTypeTranslate(item) }}</div>
<div v-if="caseDetail.keyword1" class="item">{{ caseDetail.keyword1 }}</div>
<div v-if="caseDetail.keyword2" class="item">{{ caseDetail.keyword2 }}</div>
<div v-if="caseDetail.keyword3" class="item">{{ caseDetail.keyword3 }}</div>
@@ -313,6 +314,7 @@ export default {
apiDict.items(key).then(res => {
if (res.status == 200) {
this.Profess = res.result;
// this.Profess = this.Profess.split(",")
}
});
},
@@ -448,10 +450,11 @@ export default {
})
},
getCaseData() {
apiCase.detail(this.resolveId,true).then(res => {
apiCase.details(this.resolveId,true).then(res => {
if (res.status == 200) {
if (JSON.stringify(res.result) != '{}') {
this.caseDetail = res.result;
this.caseDetail = res.result.case;
this.caseDetail.majorType = this.caseDetail.majorType.split(",")
this.getCaseUserDetail();
if(this.caseDetail.filePath){
//this.pdfPath=this.basePath+this.caseDetail.filePath;

View File

@@ -95,7 +95,8 @@
<div class="keyword-text clearfix">
<div style="color:#2974D6;font-weight: 450;" v-if="item.orgDomain">{{ orgDomainTranslate(item.orgDomain) }}</div>
<div style="color:#2974D6;font-weight: 450;" v-if="item.orgDomain == '' && item.orgDomainParent">{{ orgDomainTranslate(item.orgDomainParent) }}</div>
<div style="color:#2974D6;font-weight: 450;" v-if="item.majorType">{{ majorTypeTranslate(item.majorType) }}</div>
<div style="color:#2974D6;font-weight: 450;" v-for="item,idx in item.majorType" :key="idx" >{{ majorTypeTranslate(item) }}</div>
<div v-if="item.keyword1">{{ item.keyword1 }}</div>
<div v-if="item.keyword2">{{ item.keyword2 }}</div>
<div v-if="item.keyword3">{{ item.keyword3 }}</div>
@@ -322,7 +323,6 @@ export default {
mounted() {
if(this.searchTags.length == 0){
console.log('gyigyu')
this.queryCondition.majorType = null;
this.queryCondition.orgDomain = null;
};
@@ -581,7 +581,9 @@ export default {
if (res.status == 200) {
if (res.result.list.length > 0) {
this.isSeach = false;
console.log(res.result.list)
res.result.list.forEach(item => {
item.majorType = item.majorType.split(",");
item.isAll = false;
item.authorInfo = {
aid: "",

View File

@@ -96,13 +96,10 @@
<div v-if="homeworkInfo.info.submitMode==1 || homeworkInfo.info.submitMode==3">
<div class="homework-title">上传作业</div>
<div class="homework-content">
<div v-if="homeworkInfo.filePath!=''">
<el-tag closable type="success" @close="removeHomeworkFile">作业附件</el-tag><span style="margin-left: 10px;">请点击下面的提交</span>
</div>
<div v-else >
<!-- <div v-else >
<el-button type="primary">选择文件并上传</el-button>
<!-- <file-upload dir="files" :isShowTip="false" @success="uploadHomeworkFile" @remove="removeHomeworkFile"></file-upload> -->
</div>
</div> -->
</div>
</div>
<!-- <div style="text-align: center;padding-bottom: 10px;">
@@ -208,7 +205,6 @@
</div>
</div>
<!-- <div style="text-align: center; margin-bottom: 15px" v-if="assessInfo.allowSubmit"><el-button type="primary" @click="assessSubmitFun">提交</el-button></div> -->
</div>
<!-- <div v-else style="text-align: center;padding-top: 20px;color: red;">此课程无评估</div> -->
</div>
@@ -481,10 +477,11 @@ export default {
};
},
mounted() {
this.showQrimage();
this.loadResOwners();
let id = this.$route.query.id;
this.courseInfo.id = id;
this.showQrimage();
let $this = this;
//页面只支取一次,所以先直接写在这里面
apiCoursePortal.detail(id).then(rs => {
@@ -550,8 +547,7 @@ export default {
$this.loadAssessInfo();
}
});
//study info
// this.loadStudyInfo();
} else {
this.$message.error(rs.message);
}
@@ -561,7 +557,7 @@ export default {
showQrimage(row){
this.qrcode = this.webBaseUrl+'/mobile/pages/resource/microDetail?id='+this.courseInfo.id;
this.$nextTick(() => {
this.crateQrcode();
//this.crateQrcode();
});
},
crateQrcode(){
@@ -605,21 +601,6 @@ export default {
//console.log("当前播放11"+itme);
let intTime=parseInt(itme);
this.videoPlayingTime=intTime;
let saveTime=Math.floor(intTime%10);
if(intTime>10 && saveTime==0 && this.coursewareInfo.studyItemId!=''){
//记录播放时间
//console.log('记录播放时间:'+intTime);
let postData={
itemId:this.coursewareInfo.studyItemId,
videoTime:intTime
}
apicourseStudy.studyVideoTime(postData).then(rs=>{
if(rs.status!=200){
console.log('记录播放时间错误');
}
})
}
},
audioPlaying(item){
//console.log("当前播放22"+item);
@@ -651,11 +632,7 @@ export default {
studyId: this.studyId,
contentId: this.homeworkInfo.content.id
};
// apicourseStudy.myHomeworkList(params).then(rs => {
// if (rs.status == 200) {
// this.homeworkInfo.records = rs.result;
// }
// });
}
} else if (tab.name == "test") {
if (this.examInfo.records.length == 0) {
@@ -663,17 +640,6 @@ export default {
studyId: this.studyId,
contentId: this.examInfo.content.id
};
apicourseStudy.myExamList2(params).then(examRs => {
if (examRs.status == 200) {
this.examInfo.records = examRs.result;
let len = examRs.result.length;
if (this.examInfo.info.times > len) {
this.examInfo.allowSubmit = true;
} else {
this.examInfo.allowSubmit = false;
}
}
});
}
} else if (tab.name == "assess") {
//console.log('加载评估信息');,评估只会有一个,所以主直接取
@@ -681,22 +647,8 @@ export default {
studyId: this.studyId,
contentId: this.assessInfo.content.id
};
// apicourseStudy.myAssessList(params).then(res => {
// if (res.status == 200) {
// if (res.result.length > 0) {
// this.assessInfo.allowSubmit = false;
// this.assessInfo.info = JSON.parse(res.result[0].asContent);
// }
// } else {
// this.$message.error(res.message);
// }
// });
} else {
//在课件页面,记录开始时间
//console.log('记录课件学习信息');
if(!this.coursewareInfo.finish){
setTimeout(() => {$this.saveStudyInfo();}, 5000);
}
}
},
saveStudyInfo() {
@@ -708,102 +660,20 @@ export default {
if (this.coursewareInfo.finish) {
return;
}
// let params = {
// studyId: this.studyId, //学习id,
// courseId: this.coursewareInfo.content.courseId, //课程id,
// contentId: this.coursewareInfo.content.id, //内容id,
// contentName: this.coursewareInfo.content.contentName, //内容名称
// progress: 100,
// contentTotal: this.totalContent
// };
// apicourseStudy.studyContent(params).then(res => {
// if (res.status == 200) {
// this.coursewareInfo.finish = true; //课件内容已学习,记录状态
// } else {
// console.log("记录学习失败:" + res.message + "" + res.error);
// }
// });
},
startTest() {
this.examInfo.startTime = new Date();
this.testStart = true;
},
countTest() {
//计算课程的分数
let scoreNum = null;
this.examInfo.paper.items.forEach(item => {
let isFind = true;
if (item.type != 102) {
item.options.forEach(it => {
if (it.answer == true && item.userAnswer == it.id) {
scoreNum += item.score;
}
});
} else {
item.options.forEach(it => {
if (it.answer == false && it.isCheck && it.isCheck == true) {
isFind = false;
}
if (it.answer == true && it.isCheck && it.isCheck == true) {
if (isFind) {
scoreNum += item.score;
}
}
});
}
});
if (scoreNum === null) scoreNum = 0;
return scoreNum;
},
// 提交考试
submitTest() {
let now = new Date();
let testScore = this.countTest();
let postData = {
studyId: this.studyId, //这个哪传来的?
studyItemId: this.examInfo.studyItemId, //前面已经给了
courseId: this.examInfo.info.courseId,
contentId: this.examInfo.info.contentId,
testId: this.examInfo.info.id,
testName: this.courseInfo.name, //应该是课程的名称 + 内容的名称
testDuration: 0,
score: testScore,
arrange: this.examInfo.info.arrange,
passLine: this.examInfo.info.passLine,
randomMode: this.examInfo.info.randomMode,
paperJson: JSON.stringify({ items: this.examInfo.paper.items }) //原来是对象,这里要也要对象
//startTime:formatDate(this.examInfo.startTime),//此时间需要格式化,格式化时间可以放在util中
//endTime:formatDate(now),
};
//计划考试的时长
var dateDiff = now.getTime() - this.examInfo.startTime.getTime(); //时间差的毫秒数
var minutes = Math.floor(dateDiff / 1000); //计算相差秒数,原来是分钟不行
postData.testDuration = minutes;
apicourseStudy.saveExam(postData).then(res => {
if (res.status == 200) {
this.examInfo.records.push(res.result);
this.examInfo.studyItemId = res.result.studyItemId; //设置考试的学习记录id
this.testStart = false;
let len = this.examInfo.records.length;
if (this.examInfo.info.times > len) {
this.examInfo.allowSubmit = true;
} else {
this.examInfo.allowSubmit = false;
}
} else {
this.$message.error(res.message);
}
});
},
showExamAnswer(item) {
//显示试卷的答卷信息
this.examInfo.detailShow=true;
apicourseStudy.myExamPaper(item.id).then(rs=>{
if(rs.status==200){
this.examInfo.detailItems=JSON.parse(rs.result.paper).items
}
});
},
testType(type) {
//此方法移到tools中
@@ -826,145 +696,9 @@ export default {
this.homeworkInfo.filePath = res.result.filePath;
},
removeHomeworkFile() {
this.$confirm("您确定要删除已上传的附件吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.homeworkInfo.filePath = "";
//从服务器端删除
this.$message({ type: "success", message: "删除成功!" });
});
},
submitHomework() {
//提交作业
if (this.homeworkInfo.content.submitMode == 1) {
if (this.homeworkInfo.filePath == "") {
this.$message.error("请上传作业内容");
return;
}
} else if (this.homeworkInfo.content.submitMode == 2) {
if (this.homeworkInfo.answer == "") {
this.$message.error("请先填写作业内容");
return;
}
} else {
if (
this.homeworkInfo.answer == "" &&
this.homeworkInfo.filePath == ""
) {
this.$message.error("请填写或上传作业");
return;
}
}
let pamars = {
studyItemId: this.homeworkInfo.studyItemId, //学习内容记录id,
studyId: this.studyId, //学习id,
courseId: this.courseInfo.id, //课程id,
contentId: this.homeworkInfo.content.id, //内容id,
hwId: this.homeworkInfo.info.id, //作业的id
hwName: this.homeworkInfo.info.name, //作业的名称
//hwContent: this.homeworkInfo.info.content,//作业的内容,先不要此字段了
filePath: this.homeworkInfo.filePath, //文件的路径,可以为空,
hwAnswer: this.homeworkInfo.answer, //文本提交的信息
score: 0
};
apicourseStudy.saveHomework(pamars).then(res => {
if (res.status == 200) {
this.$message.success("作业已提交");
this.homeworkInfo.filePath = "";
this.homeworkInfo.answer = "";
this.homeworkInfo.records.push(res.result);
} else {
this.$message.error(res.message);
}
});
},
appendStudyTime() {
if(this.studyId==''){
return;
}
//追加学习时间
let $this = this;
if (this.appendStartTime == null) {
this.appendStartTime = new Date();
setTimeout(function() {
$this.appendStudyTime();
}, 60000);
return;
}
let now = new Date();
let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数
let sen = parseInt(m / 1000); //计算秒数
if (sen > 0) {
let postData = {
studyId: this.studyId,
courseId: this.courseInfo.id,
contentId: this.coursewareInfo.content.id,
studyInfo:
this.courseInfo.name +
"-" +
this.coursewareInfo.content.contentName,
duration: sen
};
apicourseStudy.appendStudyTime(postData).then(rs => {
if (rs.status == 200) {
$this.appendStartTime = new Date(); //重置开始时间10秒后再记录一次
setTimeout(function() {
$this.appendStudyTime();
}, 60000);
} else {
console.log(rs.message);
}
});
} else {
setTimeout(function() {
$this.appendStudyTime();
}, 60000);
}
},
loadStudyInfo() {
//获取学习信息
let $this = this;
this.loadScorePraiseAndTrample();
apicourseStudy.studyInfo(this.courseInfo.id).then(res => {
if (res.status == 200) {
res.result.signup ? (this.enrollStutas = 2) : (this.enrollStutas = 1);
if(res.result.signup) {
//this.loadScorePraiseAndTrample();
this.appendStudyTime();
this.studyId = res.result.studyId; //设置学习id
//需要判断此内容是否已学习完成,如果已学习完成,不需要再请不说了
res.result.contents.forEach(con => {
if (con.contentId == $this.coursewareInfo.content.id) {
$this.coursewareInfo.finish = true; //课件已学习
$this.coursewareInfo.studyItemId=con.id;
if(con.lastStudyTime!='' && con.lastStudyTime>0){
//当前视频学习的时间
$this.videoPlayingTime=con.lastStudyTime;
//如果视频已经播放完了
}
//console.log()
}else if (con.contentId == $this.homeworkInfo.content.id) {
$this.homeworkInfo.studyItemId = con.id;
}else if (con.contentId ==$this.examInfo.content.id) {
$this.examInfo.studyItemId = con.id;
}else if (con.contentId == $this.assessInfo.content.id) {
$this.assessInfo.studyItemId = con.id;
}
});
if (!$this.coursewareInfo.finish) {
setTimeout(() => {
$this.saveStudyInfo();
}, 5000); //5秒后记录学习
}
}
} else {
this.$message.error(res.message);
}
});
},
loadHomeworkInfo() {
apiCourse.getHomework(this.homeworkInfo.content.id).then(res => {
@@ -1018,137 +752,19 @@ export default {
signType: 1,
signInfo: ""
};
let $this = this;
// apicourseStudy.signup(pamars).then(res => {
// if (res.status == 200) {
// this.$message({ type: "success", message: "报名成功" });
// this.enrollStutas = 2;
// this.appendStudyTime(); //报名成功记录开始时间
// //报名成功后就直接记录课件学习情况5秋后
// setTimeout(() => {
// $this.saveStudyInfo();
// }, 5000);
// } else {
// this.$message.error(res.message);
// }
// });
},
assessSubmitFun() {
let dataJson = JSON.stringify(this.assessInfo.info);
//计算评估得分
let countStr = this.assessInfo.info.resultCount;
let countScore = 0;
let pass = true;
this.assessInfo.info.items.forEach((item, idx) => {
if (item.qType == 1) {
if (item.answer == 0) {
pass = false;
}
var str = "[q" + (idx + 1) + "]";
countStr = countStr.replace(str, item.answer);
}
});
if (!pass) {
this.$message.error("请填写完整再提交");
return;
}
//console.log(countStr);
countScore = eval(countStr);
//console.log(countScore,"countScore");
let pamars = {
studyItemId: this.assessInfo.studyItemId, //学习内容记录id,
studyId: this.studyId, //学习id,
courseId: this.courseInfo.id, //课程id,
contentId: this.assessInfo.content.id, //内容id,
asContent: dataJson, //内容
asScore: countScore //评估得分
};
apicourseStudy.saveAssess(pamars).then(res => {
if (res.status == 200) {
this.assessInfo.allowSubmit = false;
this.$message.success("提交成功,谢谢您的评估");
} else {
this.$message.error(res.message);
}
});
this.enrollStutas = 2;
},
loadScorePraiseAndTrample() {
//加载是否打过分
//if(this.enrollStutas>1){
apiCourseGrade.has(this.courseInfo.id).then(rs => {
if (rs.status == 200 && rs.result) {
this.scoreInfo.has = true;
}
});
//}
apiPraises.has(1, this.courseInfo.id).then(rs => {
if (rs.status == 200 && rs.result) {
this.isPraise = true;
}
});
apiTrample.has(this.courseInfo.id).then(rs => {
if (rs.status == 200 && rs.result) {
this.isTrample = true;
}
});
},
addScore() {
let postData = {
courseId: this.courseInfo.id,
studyId: this.studyId,
score: this.scoreInfo.score
};
if (this.scoreInfo.score > 0) {
apiCourseGrade.grade(postData).then(rs => {
if (rs.status == 200) {
this.$message.success("打分成功,谢谢您的打分");
this.scoreInfo.has = true;
} else {
this.$message.error("打分处理失败,请稍后再试");
}
});
}
},
praiseContent() {
if(this.enrollStutas==1){
this.$message.error("报名学习之后才可以点赞");
return;
}
if(this.isTrample){
this.$message.error("您已踩过了,不能再赞了");
return;
}
let postData = {
objType: 1,
objId: this.courseInfo.id,
title: this.courseInfo.name
};
apiPraises.save(postData).then(rs => {
if (rs.status == 200) {
this.$message.success("点赞成功");
this.isPraise = true;
} else {
this.$message.error("点赞失败,请稍后再试");
}
});
},
treadContent() {
if(this.enrollStutas==1){
this.$message.error("只有报名学习后才可以踩");
return;
}
if(this.isPraise){
this.$message.error("您已赞过了,不能再踩了");
return;
}
apiTrample.trample(this.courseInfo.id).then(rs => {
if (rs.status == 200) {
this.$message.success("已踩");
this.isTrample = true;
} else {
this.$message.error("踩失败,请稍后再试");
}
});
},
loadAuthorInfo(list,ids){ //加载作者信息,头像,机构信息
if(ids.length==0){

View File

@@ -265,26 +265,26 @@ export default {
//console.log("播放结束");
},
onPlayerPlaying(itme){
//console.log("当前播放"+itme);
//console.log("当前播放11"+itme);
if(this.contentData.contentType && this.contentData.contentType==10){
let intTime=parseInt(itme);
this.contentData.lastStudyTime=intTime;
let saveTime=Math.floor(intTime%10);
if(intTime>10 && saveTime==0 && this.contentData.studyItemId!=''){
//记录播放时间
//console.log('记录播放时间:'+intTime);
let postData={
itemId:this.contentData.studyItemId,
videoTime:intTime
}
apiStudy.studyVideoTime(postData).then(rs=>{
if(rs.status!=200){
console.log('记录播放时间错误');
}
})
}
}
// //console.log("当前播放"+itme);
// //console.log("当前播放11"+itme);
// if(this.contentData.contentType && this.contentData.contentType==10){
// let intTime=parseInt(itme);
// this.contentData.lastStudyTime=intTime;
// let saveTime=Math.floor(intTime%10);
// if(intTime>10 && saveTime==0 && this.contentData.studyItemId!=''){
// //记录播放时间
// //console.log('记录播放时间:'+intTime);
// let postData={
// itemId:this.contentData.studyItemId,
// videoTime:intTime
// }
// apiStudy.studyVideoTime(postData).then(rs=>{
// if(rs.status!=200){
// console.log('记录播放时间错误');
// }
// })
// }
// }
},
audioPlaying(item){
@@ -327,88 +327,12 @@ export default {
}
this.contentList=rs.result.contents;
this.totalContent=rs.result.contents.length;
//加载学习的数据
this.loadStudyData();
}else{
this.$message.error(rs.message);
}
})
},
loadStudyData() {
let $this=this;
apiStudy.studyInfo(this.courseId).then(res=>{
if(res.status == 200) {
if(res.result.signup){
// this.loadScorePraiseAndTrample();
this.studyId = res.result.studyId;
//对已学习的内容进行比对,重要的字段, 学习内容id在后缀的
let playIndex=-1;
this.contentList.forEach((con,conIdx)=>{
res.result.contents.forEach((scon,sconIdx)=>{
if(scon.contentId==con.id){
//定位显示的内容
if($this.initContentId!='' && $this.initContentId==scon.contentId){
//定位当前学习的内容,是上一次学习的内容
playIndex=conIdx;
}else{
if(sconIdx==0 && con.contentType<52){
playIndex=conIdx;
}
}
//console.log(scon.contentId,con.id);
con.lastStudyTime=scon.lastStudyTime;
con.status=9;//因为现在是只要有学习过的就代表已学习完成,所以直接设置学习完成状态,
con.studyItemId=scon.id;//这个就是学习内容条目的id
//console.log(scon.id,"scon.id");
//console.log(con,"scon.id");
}
})
});
//如果没有就定位第一项内容
if(playIndex==-1){
this.showRes(this.contentList[0]);
}else{
this.showRes(this.contentList[playIndex]);
}
}else{
// this.$message.error('您还未报名');
// if(this.courseInfo.type==10){
// location.href = this.webBaseUrl + "/course/micro?id="+this.courseId;
// }else{
// location.href = this.webBaseUrl + "/course/detail?id="+this.courseId;
// }
}
} else {
this.$message.error(res.message);
}
})
},
saveStudyInfo() { //记录课件学习信息
if(this.contentData.contentType>=60){
//只有在课件页面停留超过5秒才会记录
return;
}
if(this.contentData.status==9){
//已学习完的,不用再添加
return;
}
let params ={
studyId: this.studyId,//学习id,
courseId: this.courseId,//课程id,
contentId: this.contentData.id,//内容id,
contentName: this.contentData.contentName,//内容名称
progress: 100,
contentTotal:this.totalContent
}
apiStudy.studyContent(params).then(res=>{
if(res.status == 200) {
this.contentData.status=9;//完成
this.contentData.studyItemId=res.result;//学习记录id
}else{
console.log('记录学习失败:'+res.message+''+res.error);
}
})
},
ctabChange(e) {
console.log(e);
},
@@ -439,91 +363,21 @@ export default {
}
}
// else if(r.contentType == 61) {// 考试
// }else if(r.contentType == 60) {// 作业
// }else if(r.contentType == 62) {// 评估
// //评估不需要查找因为内容就是content中
// console.log('评估处理');
// }
this.contentData = r;
// setTimeout(function(){$this.saveStudyInfo();},5000);//5秒后记录学习完成
this.contentData = r;
},
videoEnd() {
//视频播放完成后的处理
},
handleChange(val) {
console.log(val);
},
// loadScorePraiseAndTrample(){
// //加载是否请过分
// apiCourseGrade.has(this.courseId).then(rs=>{
// if(rs.status==200 && rs.result){
// this.scoreInfo.has=true;
// }
// });
// apiPraises.has(1,this.courseId).then(rs=>{
// if(rs.status==200 && rs.result){
// this.isPraise=true;
// }
// });
// apiTrample.has(this.courseId).then(rs=>{
// if(rs.status==200 && rs.result){
// this.isTrample=true;
// }
// });
// },
addScore(){
let postData={
courseId:this.courseInfo.id,
studyId:this.studyId,
score:this.scoreInfo.score
}
if(this.scoreInfo.score>0){
apiCourseGrade.grade(postData).then(rs=>{
if(rs.status==200){
this.$message.success('打分成功,谢谢您的打分');
this.scoreInfo.has=true;
}else{
this.$message.error('打分处理失败,请稍后再试');
}
});
}
},
praiseContent(){
if(this.isTrample){
this.$message.error("您已踩过了不能再赞了");
return;
}
let postData={
objType:1,
objId:this.courseId,
title:this.courseInfo.name
}
apiPraises.save(postData).then(rs=>{
if(rs.status==200){
this.$message.success('点赞成功');
this.isPraise=true;
}else{
this.$message.error('点赞失败,请稍后再试');
}
})
},
treadContent(){
if(this.isPraise){
this.$message.error("您已赞过了,不能再踩了");
return;
}
apiTrample.trample(this.courseId).then(rs=>{
if(rs.status==200){
this.$message.success('已踩');
this.isTrample=true;
}else{
this.$message.error('踩失败,请稍后再试');
}
})
},
loadAuthorInfo(list,ids){ //加载作者信息,头像,机构信息
if(ids.length==0){

View File

@@ -975,7 +975,8 @@ export default {
padding-left: 40px;
.comment-content{
padding-bottom: 0px;
word-break:break-all;
white-space: pre-wrap;
word-break: break-all;
span{
cursor: pointer;
color: #409EFF

View File

@@ -449,17 +449,17 @@ export default {
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();
}
}
// 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();
// }
// }
},
onPlayerPause() {
//console.log("暂停");
@@ -475,15 +475,15 @@ export default {
this.appendStartTime=null;
//console.log("当前播放"+itme);
//console.log("当前播放11"+itme);
if (this.contentData.contentType && this.contentData.contentType == 10) {
if (this.contentData.contentType && this.contentData.contentType == 10){
let intTime = parseInt(itme);
//判断是否完成
let completeType=this.curriculumData.completeSetup;
let completeSecond=this.curriculumData.second;
if(!completeSecond){
if(!completeSecond || completeType==0){
completeSecond=5;//如果没有就采用默认的时间了
}
if(completeType>0 && this.contentData.status<9){ //因为1按进度2按时长都是计算时间所以这里直接大于0处理
if(this.contentData.status<9){ //因为1按进度2按时长都是计算时间所以这里直接大于0处理
if(completeType==1){
let finishPercent=this.curriculumData.setupTage;
let videDuration=this.contentData.duration;
@@ -491,7 +491,7 @@ export default {
if(percent>=finishPercent){
this.finishStudyItem();
}
}else if(completeType==2){
}else{
if(intTime>=completeSecond){
this.finishStudyItem();
}
@@ -520,10 +520,10 @@ export default {
//判断是否完成
let completeType=this.curriculumData.completeSetup;
let completeSecond=this.curriculumData.second;
if(!completeSecond){
if(!completeSecond || completeType==0){
completeSecond=5;//如果没有就采用默认的时间了
}
if(completeType>0 && this.contentData.status<9){ //因为1按进度2按时长都是计算时间所以这里直接大于0处理
if(this.contentData.status<9){ //因为1按进度2按时长都是计算时间所以这里直接大于0处理
if(completeType==1){
let finishPercent=this.curriculumData.setupTage;
let videDuration=this.contentData.duration;
@@ -531,7 +531,7 @@ export default {
if(percent>=finishPercent){
this.finishStudyItem();
}
}else if(completeType==2){
}else{
if(intTime>=completeSecond){
this.finishStudyItem();
}
@@ -556,16 +556,16 @@ export default {
audioPlay() {
//console.log("开始播放");
let $this=this;
if(this.contentData.status!=9){
let completeType=this.curriculumData.completeSetup;
if(completeType==0){
//默认5秒后学习完成.
$this.handleTimeout= setTimeout(function() {$this.saveStudyInfo();}, 5000); //5秒后记录学习完成
}else{
//先记录进行中的学习内容
this.saveStudyItem();
}
}
// if(this.contentData.status!=9){
// let completeType=this.curriculumData.completeSetup;
// if(completeType==0){
// //默认5秒后学习完成.
// $this.handleTimeout= setTimeout(function() {$this.saveStudyInfo();}, 5000); //5秒后记录学习完成
// }else{
// //先记录进行中的学习内容
// this.saveStudyItem();
// }
// }
},
audioPause() {
//console.log("暂停");