课程打分

This commit is contained in:
daihh
2022-11-17 14:04:40 +08:00
parent f485892025
commit d1a086593e
2 changed files with 108 additions and 10 deletions

View File

@@ -200,6 +200,7 @@
key: "Share",//分享
title: "分享",//分享
parameters:"author:"+authorUserId,//内容的作者
source:"h5",//移动端是2
content: '分享',//事件的内容
objId: this.data.id,//关联的id
objType: this.type,//关联的类型

View File

@@ -398,6 +398,7 @@
import apiResOwner from '@/api/modules/resowner.js'
import apiPraises from "@/api/modules/praises.js";
import apiTrample from "@/api/modules/trample.js";
import apiMessage from '@/api/system/message.js'
import apiFavorites from '@/api/modules/favorites.js'
import {getContentType} from "@/utils/tools.js";
import studyUtil from '@/utils/study.js';
@@ -440,7 +441,6 @@
conLink:{openType:1,url:''},//外连接内容
curriculumData:{url:'',isDrag:true,completeSetup:1,setupTage:0,second:0},// 课件内容
authorInfo:{aid:'',name:'',code:'',orgInfo:''},
sectionList:[],
@@ -463,7 +463,6 @@
appendHandle:null,//追加学习时长的timeout句柄
appentId:'',//当前追加的学习时长的id
appentInterval:5000,//追加学习时间的间隔 3秒加一次
handleTimeout: null,
preTime:-1,
blobUrl:'',//音视频的播放地址
localTimeKey:'boeu-study-time' ,//本地存储的学习时长的key json格式
@@ -538,9 +537,7 @@
},
onHide(){
//清除定时任务
if(this.appendStudyOtherHandle!=null){
window.clearTimeout(this.appendStudyOtherHandle);
}
this.clearTimeHandle();
},
methods:{
...mapActions({
@@ -553,6 +550,17 @@
if(!code){return '';}
return this.sysTypeMap.get(code);
},
clearTimeHandle(){
if(this.appendStudyOtherHandle!=null){
window.clearTimeout(this.appendStudyOtherHandle);
}
if(this.appendHandle!=null){
window.clearTimeout(this.appendHandle);
}
if(this.handleTimeout!=null){
window.clearTimeout(this.handleTimeout);
}
},
loadDetail(){
let $this=this;
uni.showLoading({title:'加载中...'})
@@ -787,6 +795,7 @@
},
//更换播放内容
changePlayRes(con){
this.clearTimeHandle();
// console.log(con,'con');
if(this.videoPlayer){
//console.log('切换视频');
@@ -889,7 +898,7 @@
openScore(){
//显示评分弹窗
if(this.scoreInfo.has){
this.$refs.messager.show({message:'您已评过分',type:'error'});
this.$refs.messager.show({message:'您已评过分',type:'error'});
return;
}
this.scoreInfo.dlgShow=true;
@@ -914,6 +923,21 @@
this.scoreInfo.dlgShow=false;
this.scoreInfo.has=true;
this.$refs.messager.show({message:'评分成功,谢谢您的评分',type:'success'});
//发送评分事件
let event = {
key: "ScoreCourse", //后台的事件key 发布文章且审核通过
title: "完成课程评分", //事件的标题
source:"h5",//移动端是2
parameters: "", //用户自定义参数 name:value,name:value
content: "给课程评分", //事件的内容
objId: this.courseInfo.id, //关联的id
objType: 1, //关联的类型
objInfo: this.courseInfo.name,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name, //当前人的姓名
status: 1 //状态直接写1
}
apiStat.sendEvent(event);
}else{
this.$refs.messager.show({message:'评分分处理失败,请稍后再试',type:'error'});
}
@@ -942,6 +966,10 @@
}
this.loading=true;
uni.showLoading({title:'处理中...'})
let firstTeacher={};
if(this.teachers.length>0){
firstTeacher=this.teachers[0];
}
//需要判断是否已点赞,已点赞的不再加
let postData={
objType:1,
@@ -966,7 +994,24 @@
this.isFavorite=true;
this.$refs.messager.show({message:'已加入收藏',type:'success'});
//发送消息
//this.messageSave(this.data.id,this.data.name,this.userInfo.name,this.data.sysCreateBy,this.data.sysCreateAid,'收藏了我发布的');
let message={
content:this.userInfo.name+'收藏了我的课程-'+this.courseInfo.name,
refId:this.courseInfo.id,
refType:1,
source:1,
pageType:1,
pageParams:this.courseInfo.id,
sendAid:this.userInfo.aid,
sendName:this.userInfo.name,
acceptName:firstTeacher.teacherName,
acceptId:firstTeacher.teacherId,
title:'系统消息',
sendType:1,
conType:this.courseInfo.type,
}
apiMessage.save(message).then(res=>{
if(res.status!=200){ console.log('发送消息失败') }
})
}else{
this.$refs.messager.show({message:'收藏失败',type:'error'});
console.log('加入收藏失败:'+res.message);
@@ -990,6 +1035,11 @@
return;
}
this.interactRuning=true;
let firstTeacher={};
if(this.teachers.length>0){
firstTeacher=this.teachers[0];
}
if(this.isPraise){
apiPraises.remove(1,this.courseInfo.id).then(rs=>{
this.interactRuning=false;
@@ -997,6 +1047,20 @@
this.$refs.messager.show({message:'已取消点赞',type:'success'});
this.isPraise=false;
this.courseInfo.praises--;
let event = {
key: "CancelPraise",//点赞
title: "取消点赞",//事件的标题
parameters:"author:"+firstTeacher.teacherId,//用户自定义参数 name:value,name:value
content: "取消点赞课程",//事件的内容
source:"h5",//移动端是2
objId: this.courseId,//关联的id
objType: "1",//关联的类型
objInfo: this.courseInfo.name,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
}
apiStat.sendEvent(event);
}else{
this.$refs.messager.show({message:'取消点赞失败,请稍后再试',type:'success'});
}
@@ -1008,6 +1072,39 @@
this.$refs.messager.show({message:'点赞成功',type:'success'});
this.isPraise=true;
this.courseInfo.praises++;
let event = {
key: "Praise",//点赞
title: "点赞",//事件的标题
parameters:"author:"+firstTeacher.teacherId,//用户自定义参数 name:value,name:value
content: "点赞了课程",//事件的内容
source:"h5",//移动端是2
objId: this.courseInfo.id,//关联的id
objType: "1",//关联的类型
objInfo: this.courseInfo.name,
aid: this.userInfo.aid, //当前登录人的id
aname: this.userInfo.name,//当前人的姓名
status: 1 //状态直接写1
}
apiStat.sendEvent(event);
let message={
content:this.userInfo.name+'点赞了我的课程-'+this.courseInfo.name,
refId:this.courseInfo.id,
refType:1,
source:1,
pageType:1,
pageParams:this.courseInfo.id,
sendAid:this.userInfo.aid,
sendName:this.userInfo.name,
acceptName:firstTeacher.teacherName,
acceptId:firstTeacher.teacherId,
title:'系统消息',
sendType:1,
conType:this.courseInfo.type,
}
apiMessage.save(message).then(res=>{
if(res.status!=200){ console.log('发送消息失败') }
})
}else{
this.$refs.messager.show({message:'点赞失败,请稍后再试',type:'success'});
}
@@ -1064,8 +1161,8 @@
"parameters":"second:"+duration,//second:value,total:value 本次的学习时长
"content": "学习课程【"+this.courseInfo.name+"】",//事件的内容
"objId": this.courseInfo.id,//课程的id
"objType": "1",//类型
"source":"page",
"objType": "1",//类型
"source":"h5",
"objInfo": ""+this.courseInfo.name,
"aid":this.userInfo.aid, //当前登录人的id
"aname":this.userInfo.name,//当前人的姓名
@@ -1154,7 +1251,7 @@
"content": "学习课程",//事件的内容
"objId": this.courseInfo.id,//课程的id
"objType": "1",//类型
"source":"page",
"source":"h5",
"objInfo": ""+this.courseInfo.name,
"aid":this.userInfo.aid, //当前登录人的id
"aname":this.userInfo.name,//当前人的姓名