This commit is contained in:
zhaofang
2022-09-08 15:07:30 +08:00
parent 47fb524702
commit b0dc1a2227
4 changed files with 165 additions and 3 deletions

View File

@@ -333,6 +333,7 @@
import pdfPreview from "@/components/PdfPreview/index.vue";
import audioPlayer from '@/components/AudioPlayer/index.vue';
import videoPlayer from '@/components/VideoPlayer/index.vue';
import { deepClone, param } from "../../utils";
export default{
props: {
reset:{
@@ -389,6 +390,7 @@
setupTage:0,
},
homework:{courseId: '', name:'', content:'', file:'', deadTime: '', submitMode: 3},
homeworkChange:{},
exam:{
courseId:'',
contentId:'',
@@ -408,7 +410,9 @@
info:'',//考试说明
paperContent:'',//试题的json字符串
},
examChange:{},
onlyQuestion:true,
examPaperChange:{},
examPaper:{items:[]},
assess:{
countType:'权重配置',
@@ -515,6 +519,7 @@
apiCourse.getHomework(this.content.id).then(res=>{
if(res.status==200){
this.homework=res.result;
this.homeworkChange = deepClone(res.result);
}else if(res.status==404){
//没有找到作业信息
}else{
@@ -527,6 +532,8 @@
if(res.status==200){
this.exam=res.result;
this.examPaper=JSON.parse(res.result.paperContent);
this.examChange = deepClone(res.result);
this.examPaperChange = deepClone(JSON.parse(res.result.paperContent));
}else if(res.status==404){
//没有找到作业信息
}else{

View File

@@ -156,7 +156,7 @@
</el-form-item>
</el-col>
<el-col :span="14">
<div @click="checkCourse"><weikeContent :reset="weikeReset" :contents="contentInfo.list" :course="courseInfo" min-height="644px"></weikeContent></div>
<div @click="checkCourse"><weikeContent ref="weikeContent" :reset="weikeReset" :contents="contentInfo.list" :course="courseInfo" min-height="644px"></weikeContent></div>
</el-col>
<!-- <el-form-item label="完成规则" v-if="!weike.onlyRequired"><el-input maxlength="50" v-model="courseInfo.passFormula" placeholder="可基于组织树或受众选择"></el-input></el-form-item> -->
<!-- <el-form-item label="开放权限" v-if="!weike.onlyRequired"><el-input maxlength="50" v-model="courseInfo.openObject" placeholder="可基于组织树或受众选择"></el-input></el-form-item> -->
@@ -350,7 +350,7 @@
</div>
</el-aside>
<el-main style="padding: 0px;">
<catalog-courseware :reset="onlineReset" :content="curContent" :course="courseInfo" @save="saveCurContent" @remove="delCurContent"></catalog-courseware>
<catalog-courseware ref="courseware" :reset="onlineReset" :content="curContent" :course="courseInfo" @save="saveCurContent" @remove="delCurContent"></catalog-courseware>
</el-main>
</el-container>
</el-tab-pane>
@@ -1036,7 +1036,94 @@ export default {
this.btnLoading = false;
});
},
// 判断是否有未保存的内容
unsavedContent() {
const courseware = this.$refs.courseware;
let pass = true;
if(this.curContent.id == '') {// 新增
if(this.curContent.contentType == 60) { // 判断作业是否保存
if(courseware.homework.content || courseware.homework.name || courseware.homework.deadTime){
pass = false;
}
} else if(this.curContent.contentType == 61) { //考试
if(courseware.examPaper.items.length>1) {
pass = false;
}
if(courseware.examPaper.items[0].content != '点击编辑试题内容') {
pass = false;
}
}else if(this.curContent.contentType == 41) { //图文
if(courseware.htmlContent.length > 7){
pass = false;
}
}else if(this.curContent.contentType == 52) { //外部链接
if(courseware.linkInfo.url != '') {
pass = false;
}
}
} else {// 编辑
if(this.curContent.contentType == 60) { // 判断作业是否保存
if(JSON.stringify(courseware.homeworkChange) !== JSON.stringify(courseware.homework)) {
pass = false;
}
} else if(this.curContent.contentType == 61) { //考试
if(JSON.stringify(courseware.examPaper) !== JSON.stringify(courseware.examPaperChange ||
JSON.stringify(courseware.exam)) !== JSON.stringify(courseware.examChange)) {
pass = false;
}
} else if(this.curContent.contentType == 41) { //图文
if(this.curContent.content !== courseware.htmlContent) {
pass = false;
}
} else if(this.curContent.contentType == 52) { //外部链接
if(this.curContent.content !== JSON.stringify(courseware.linkInfo)) {
pass = false;
}
} else if(this.curContent.contentType == 10 || this.curContent.contentType == 20) {// 视频
if(this.curContent.content !== JSON.stringify(courseware.curriculumData)) {
pass = false;
}
}
}
return pass;
},
unsavedWeiContent() {
// console.log(this.contentInfo.list,'contentInfo.list');
// console.log(this.courseInfo,'courseInfo');
// console.log(this.$refs.weikeContent,'weikeContent');
const courseware = this.$refs.weikeContent;
// console.log(this.catalogTree,'this.catalogTree');
let pass = true;
// if(this.curContent.contentType == 60) { // 判断作业是否保存
if(JSON.stringify(courseware.homeworkChange.info) !== JSON.stringify(courseware.homework.info)) {
pass = false;
}
// } else if(this.curContent.contentType == 61) { //考试
// if(JSON.stringify(courseware.exam.info) !== JSON.stringify(courseware.examChange.info)) {
// console.log("2222");
// pass = false;
// }
// } else {
// if(courseware.cware.content.content !== courseware.cwareChange.content.content) {
// console.log('333');
// pass = false;
// }
// if(courseware.cware.linkInfo.content !== courseware.cwareChange.content.content) {
// console.log('333');
// pass = false;
// }
// }
return pass;
},
submitCourse() {
if(this.biaoke.dlgShow && !this.unsavedContent()){
this.$message.error('您有未保存的内容,请先保存');
return;
}
if(this.weike.dlgShow && !this.unsavedWeiContent()){
this.$message.error('您有未保存的内容,请先保存');
return;
}
//console.log(this.resOwnerListMap[0],'this.resOwnerListMap[0]');
//return;
let ownerCode=this.resOwnerListMap[0].code;

View File

@@ -529,6 +529,7 @@
import apiCourseFile from '../../api/modules/courseFile.js';
import audioPlayer from '@/components/AudioPlayer/index.vue';
import {getType} from '../../utils/tools.js';
import { deepClone } from "../../utils";
export default{
components:{WxEditor,simplePaper,FileUpload,pdfPreview,audioPlayer},
props: {
@@ -576,6 +577,23 @@
// {id:'5',type:'scorm',name:'SCORM(Q2)',img:'el-icon-suitcase',resType: 50},
{id:'6',type:'link',name:'外部连接',img:'el-icon-link', resType: 52}
],
cwareChange:{
show:1,//1表新添加2表选择
content:{id:'',contentType:0,sortIndex:1,contentRefId:'',pdfPath:''},
findShow:false,//是否显示查询
curType:{type:'jpg',name:''},//这一项要去掉的
linkInfo:{
openType:1,
url:''
},
curriculumData:{
url:'',
isDrag:true,
completeSetup:0,
second:5,
setupTage:0,
},
},
cware:{
show:1,//1表新添加2表选择
content:{id:'',contentType:0,sortIndex:1,contentRefId:'',pdfPath:''},
@@ -609,6 +627,48 @@
submitMode: 3,
}
},
homeworkChange:{
show:1,
content:{id:'',contentType:60,sortIndex:2},
dtime:'',
info:{
id:'',
courseId: '',
name:'',
content:'',
file:'',
deadTime: '',
submitMode: 3,
}
},
examChange:{
show:1,
content:{id:'',contentType:61,sortIndex:3},
paperJson:{items:[]},
paperShow:false,
customerShow:false,
onlyQuestion:true,
info:{
courseId:'',
contentId:'',
testName:this.course.name,
testDuration:30,
showAnalysis:false,
showAnswer:false,
times:1,
qnum:0,//试题数量,只是模式是随机生成试题时才会有
arrange:0,
scoringType:1,
passLine:60,
randomMode:false,
percentScore:true,
paperType:1,//自定义试卷
paperId:'',//试卷的id,只有paperType为2的时间才会有值
info:'',//考试说明
paperContent:'',//试题的json字符串
}
},
exam:{
show:1,
content:{id:'',contentType:61,sortIndex:3},
@@ -713,6 +773,7 @@
$this.cware.curriculumData.url=con.content;
}
}
$this.cwareChange = deepClone($this.cware);
}else if(con.sortIndex==2){
$this.homework.content=con;
//查询作业信息,并显示
@@ -758,6 +819,7 @@
if(res.status==200){
this.homework.info=res.result;
this.homework.show=3;//显示作业内容
this.homeworkChange = deepClone(this.homework);
}else if(res.status==404){
//没有找到作业信息
this.homework.info.id='';
@@ -773,6 +835,7 @@
this.exam.info=res.result;
this.exam.paperJson=JSON.parse(res.result.paperContent);
this.exam.show=9;
this.examChange = deepClone(this.exam);
}else if(res.status==404){
//没有找到作业信息
//this.exam.paperJson={items:[]};
@@ -890,22 +953,26 @@
}
if(index==1){
postData.content=this.cware.content;
this.cwareChange.content = deepClone(this.cware.content)
if(this.cware.content.contentType==52){
if(this.cware.linkInfo.url==''){
this.$message.error("请填写外连URL地址");
return;
}
postData.content.content=JSON.stringify(this.cware.linkInfo);
this.cwareChange.linkInfo = deepClone(this.cware.linkInfo)
}else if(this.cware.content.contentType==10 || this.cware.content.contentType==20){
if(this.cware.curriculumData.url==''){
this.$message.error("请选择课件");
return;
}
postData.content.content=JSON.stringify(this.cware.curriculumData);
this.cwareChange.curriculumData = deepClone(this.cware.curriculumData)
}
}else if(index==2){
postData.content=this.homework.content;
postData.homework=this.homework.info;
this.homeworkChange = deepClone(this.homework)
}else if(index==3){
postData.content=this.exam.content;
//检查是不是所有的试题都有了答案
@@ -932,6 +999,7 @@
}
this.exam.info.paperContent=JSON.stringify(this.exam.paperJson);
postData.exam=this.exam.info;
this.examChange = deepClone(this.exam);
}else if(index==4){
this.assess.content.content=JSON.stringify(this.assess.json);
postData.content=this.assess.content;

View File

@@ -479,11 +479,11 @@ export default {
}
}
},
// 分类
changeType(num) {
this.types.oneSubList = [];
this.types.subOne = "0";
this.types.subTow = "0";
this.types.towSubList = [];
let list = {};
if (num !== 0) {