From ff5748b5a50e4262c4eb2d001716d121555296e6 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Wed, 4 Sep 2024 17:11:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=80=83=E8=AF=95=E5=91=A8?= =?UTF-8?q?=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + .../course/examination/questionBank.vue | 133 ++++---- src/views/modules/miniClass/classAddType.vue | 290 ++++++++++++------ src/views/modules/miniClass/miniClassType.vue | 9 +- 4 files changed, 281 insertions(+), 155 deletions(-) diff --git a/.gitignore b/.gitignore index 1ad26e5..ed15cb7 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,7 @@ selenium-debug.log *.ntvs* *.njsproj *.sln + + +# common +common/common.vue \ No newline at end of file diff --git a/src/views/modules/course/examination/questionBank.vue b/src/views/modules/course/examination/questionBank.vue index cb4575c..035f936 100644 --- a/src/views/modules/course/examination/questionBank.vue +++ b/src/views/modules/course/examination/questionBank.vue @@ -40,7 +40,7 @@ 新增考题 - - 导入考题 {{ loadText }} + 清空题库 @@ -245,7 +253,7 @@ export default { resList: [], resListVisible: false, optCourse: {}, - currentFile:{} + currentFile: {} }; }, components: { @@ -262,6 +270,38 @@ export default { this.getTreeList(this.urlList.sociologyList, 2); }, methods: { + clearQuestion() { + let that = this + this.$confirm("即将清空本课程下的题库, 是否继续?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }) + .then(() => { + this.dataListLoading = true + this.$http({ + url: this.$http.adornUrl("/common/classExam/delSubjectByCourseId"), + method: "post", + data: this.$http.adornData({ + courseId: this.course.id + }) + }) + .then(res => { + if (res.data.code == 0) { + that.$message.success("操作成功!"); + that.getDataList() + }else{ + that.$message.error(res.data.msg); + } + }) + .catch(e => { + that.$message.error(e.data.msg); + _info = null; + }); + }) + .catch(() => {}); + }, + numberToABCD(num) { let result = ""; let mod; @@ -300,49 +340,36 @@ export default { this.showLoadIcon = true; this.loadText = "正在上传中"; }, - handleSuccess(file, fileList) { - this.showLoadIcon = false; - this.loadText = ""; - console.log("fileurl", this.course.id, file.url); + // handleSuccess(file, fileList) { + // this.showLoadIcon = false; + // this.loadText = ""; + // console.log("fileurl", this.course.id, file.url); - this.getQuestList(file.url, this.course.id); - // this.form.imageList.push('file.url',file.url); - }, + // this.getQuestList(file.url, this.course.id); + // // this.form.imageList.push('file.url',file.url); + // }, // 请求自动生成接口 - getQuestList(url, courseId) { - // this.$http - // .request({ - // url: this.$http.adornUrl('/common/classExam/importSubject'), - // method: "POST", - // data: { - // courseId: courseId, - // file:url - // }, - // header: { - // //默认 无 说明:请求头 - // "Content-Type": "application/json" - // } - // }) - this.$http({ - url: this.$http.adornUrl("/common/classExam/importSubject"), - method: "post", - data: this.$http.adornData({ - courseId: courseId, - file: url - }) - }) - .then(res => { - console.log("reschenggong", res); - // if (res.data.code == 0) { - // this.$message.success("操作成功!"); + // getQuestList(url, courseId) { + // this.$http({ + // url: this.$http.adornUrl("/common/classExam/importSubject"), + // method: "post", + // data: this.$http.adornData({ + // courseId: courseId, + // file: url + // }) + // }) + // .then(res => { + // console.log("reschenggong", res); + // // if (res.data.code == 0) { + // // this.$message.success("操作成功!"); - // } - }) - .catch(e => { - this.$message.error("获取课程信息失败"); - _info = null; - }); - }, + // // } + // }) + // .catch(e => { + // this.$message.error("获取课程信息失败"); + // _info = null; + // }); + // }, handleRemoveNovel() { console.log("删除文件"); }, @@ -472,7 +499,7 @@ export default { console.log("🚀 ~ handleRequest ~ formdata:", formdata); this.showLoadIcon = true; - this.loadText = '正在上传文件' + this.loadText = "正在上传文件"; // onProgress() axios .post(this.baseUrl + "/common/classExam/importSubject", formdata, { @@ -481,11 +508,11 @@ export default { const percentCompleted = Math.round( (progressEvent.loaded * 100) / progressEvent.total ); - if(percentCompleted == 100){ - that.$message.success('文件上传成功,正在写入数据') - that.loadText = '文件上传成功,正在写入数据' - }else{ - that.loadText = `${percentCompleted}%` + if (percentCompleted == 100) { + that.$message.success("文件上传成功,正在写入数据"); + that.loadText = "文件上传成功,正在写入数据"; + } else { + that.loadText = `${percentCompleted}%`; } console.log(`Upload Progress: ${percentCompleted}%`); } @@ -497,21 +524,21 @@ export default { // that.fileList[that.fileList.length - 1].status = "done"; // clearInterval(that.uploadTimer); that.showLoadIcon = false; - that.loadText = '' + that.loadText = ""; that.currentFile = {}; onSuccess(); - that.getDataList() + that.getDataList(); } else { // that.fileList[that.fileList.length - 1].ststus = "error"; that.$message.error(res.data.msg); onError(); that.showLoadIcon = false; - that.loadText = '' + that.loadText = ""; } }) .catch(e => { that.$message.error(e.data.msg); - that.loadText = '' + that.loadText = ""; }); // var prom = new Promise((resolve, reject) => {}); // prom.abort = () => {}; diff --git a/src/views/modules/miniClass/classAddType.vue b/src/views/modules/miniClass/classAddType.vue index 19b17c5..3888fea 100644 --- a/src/views/modules/miniClass/classAddType.vue +++ b/src/views/modules/miniClass/classAddType.vue @@ -41,7 +41,12 @@ 教学时长:* - +
平时分模块:* @@ -49,51 +54,108 @@
- 包含 - 不包含 - - + 包含 + 不包含 + +
- + - 包含 - 不包含 - - + 包含 + 不包含 + +
- + - 包含 - 不包含 - - + 包含 + 不包含 + +
- - - 包含 - 不包含 - - + + + 包含 + 不包含 + +
- - 包含 - 不包含 - - + + 包含 + 不包含 + +
+
+ +
+
+ +
+ 请设置考试周期需要的天数 +
+
+
-
+
课程设置: * 请选择一门课程 可选择多门课程 -
+
- + - - + - +
- 保 存 - 立即创建 + 保 存 + 立即创建
@@ -211,17 +280,18 @@ export default { props: ["classModel"], data() { return { + showExameDays: false, baseUrl: global.baseUrl, drawer: true, ClassModelRules: { title: [{ required: true, message: "必填项", trigger: "blur" }], courseIds: [{ required: true, message: "必填项", trigger: "blur" }], - days:[{ required: true, message: "必填项", trigger: "blur" }] + days: [{ required: true, message: "必填项", trigger: "blur" }] }, remoteMethodLoading: false, ClassModelForm: { title: "", - days:undefined, // 天数 + days: undefined, // 天数 id: undefined, content: "", courseIds: undefined, @@ -237,7 +307,8 @@ export default { isExperience: 1, experienceScore: 10, examScore: 60, - isExam:1 + isExam: 1, + exameDays: undefined // 考试天数 }, courseList: [], typeOptions: [ @@ -282,7 +353,7 @@ export default { }; }, mounted() { - console.log('激活了',this.classModel) + console.log("激活了", this.classModel); if (this.classModel) { console.log("编辑", this.classModel); this.$nextTick(() => { @@ -298,19 +369,18 @@ export default { if (this.classModel.director) { this.userList.push(this.classModel.director); } - if(this.classModel.directorId == 0){ - this.ClassModelForm.directorId = null + if (this.classModel.directorId == 0) { + this.ClassModelForm.directorId = null; } if (this.classModel.ddirector) { this.userList.push(this.classModel.ddirector); } - if(this.classModel.ddirectorId == 0){ - this.ClassModelForm.ddirectorId = null + if (this.classModel.ddirectorId == 0) { + this.ClassModelForm.ddirectorId = null; } }); } else { - console.log("添加",this.ClassModelForm); - + console.log("添加", this.ClassModelForm); } // this.getCourseList(); }, @@ -319,58 +389,77 @@ export default { console.log( "this.ClassModelForm.ddirectorId", this.ClassModelForm.ddirectorId - ); - if(this.ClassModelForm.days <= 0){ - this.$message.error('学习时长不可为0') - return - } - if(this.ClassModelForm.directorId == (this.ClassModelForm.ddirectorId + "") && this.ClassModelForm.ddirectorId != null){ - this.$message.error('主任和副主任不可为同一人!') - return + ); + if (this.ClassModelForm.isExam == 1) { + if(!this.ClassModelForm.exameDays || this.ClassModelForm.exameDays == 0) { + this.$message.error("请设置考试周期需要的天数"); + this.showExameDays = true; + return; + } + } else { + this.ClassModelForm.exameDays = 0; } - this.$refs['ClassModelForm'].validate((valid) => { + if (this.ClassModelForm.days <= 0) { + this.$message.error("学习时长不可为0"); + return; + } + if ( + this.ClassModelForm.directorId == + this.ClassModelForm.ddirectorId + "" && + this.ClassModelForm.ddirectorId != null + ) { + this.$message.error("主任和副主任不可为同一人!"); + return; + } + + this.$refs["ClassModelForm"].validate(valid => { if (valid) { - if (this.ClassModelForm.type == '0' && this.ClassModelForm.courseIds.length > 1){ - this.$message.error('普通小班模型只可以绑定一门课程哦') - return - } - var url = '' - this.ClassModelForm.id ? url = '/common/class/editClassModel' : url = '/common/class/addClassModel' - this.$http({ - url: this.$http.adornUrl(url), - method: "post", - data: this.$http.adornData({ - id: this.ClassModelForm.id, - title: this.ClassModelForm.title, - directorId: this.ClassModelForm.directorId, - ddirectorId: this.ClassModelForm.ddirectorId + "", - days: this.ClassModelForm.days, - type: this.ClassModelForm.type, // 班类型 0小班 1联合班 2精英班 - courseIds: this.ClassModelForm.courseIds.join(","), - isQuestion: this.ClassModelForm.isQuestion, - questionScore: parseInt(this.ClassModelForm.questionScore), - isTask: this.ClassModelForm.isTask, - taskScore: parseInt(this.ClassModelForm.taskScore), - isMedicalcase: this.ClassModelForm.isMedicalcase, - medicalcaseScore: parseInt(this.ClassModelForm.medicalcaseScore), - isExperience: this.ClassModelForm.isExperience, - experienceScore: parseInt(this.ClassModelForm.experienceScore), - isExam: this.ClassModelForm.isExam, - examScore: parseInt(this.ClassModelForm.examScore), - }) - }) - .then(({ data }) => { - if (data && data.code == 0) { - this.$message.success("操作成功"); - this.$nextTick(() => { - this.handleClose(); - }); - }else{ - this.$message.error(data.msg); + if ( + this.ClassModelForm.type == "0" && + this.ClassModelForm.courseIds.length > 1 + ) { + this.$message.error("普通小班模型只可以绑定一门课程哦"); + return; } - }) - } - }) + var url = ""; + this.ClassModelForm.id + ? (url = "/common/class/editClassModel") + : (url = "/common/class/addClassModel"); + this.$http({ + url: this.$http.adornUrl(url), + method: "post", + data: this.$http.adornData({ + id: this.ClassModelForm.id, + title: this.ClassModelForm.title, + directorId: this.ClassModelForm.directorId, + ddirectorId: this.ClassModelForm.ddirectorId + "", + days: this.ClassModelForm.days, + type: this.ClassModelForm.type, // 班类型 0小班 1联合班 2精英班 + courseIds: this.ClassModelForm.courseIds.join(","), + isQuestion: this.ClassModelForm.isQuestion, + questionScore: parseInt(this.ClassModelForm.questionScore), + isTask: this.ClassModelForm.isTask, + taskScore: parseInt(this.ClassModelForm.taskScore), + isMedicalcase: this.ClassModelForm.isMedicalcase, + medicalcaseScore: parseInt(this.ClassModelForm.medicalcaseScore), + isExperience: this.ClassModelForm.isExperience, + experienceScore: parseInt(this.ClassModelForm.experienceScore), + isExam: this.ClassModelForm.isExam, + examScore: parseInt(this.ClassModelForm.examScore), + exameDays:parseInt(this.ClassModelForm.exameDays), // 考试周期天数 + }) + }).then(({ data }) => { + if (data && data.code == 0) { + this.$message.success("操作成功"); + this.$nextTick(() => { + this.handleClose(); + }); + } else { + this.$message.error(data.msg); + } + }); + } + }); }, shwoUpMsg() { this.$message.success("正在上传"); @@ -380,7 +469,7 @@ export default { url: this.$http.adornUrl("/common/class/getClassModelCourseList"), method: "post", data: this.$http.adornData({ - title:query, + title: query // page: 1, // limit: 10, // courseName: query, //关键字 @@ -481,11 +570,18 @@ export default {