添加考试周期

This commit is contained in:
@fawn-nine
2024-09-04 17:11:14 +08:00
parent 3aa551853d
commit ff5748b5a5
4 changed files with 281 additions and 155 deletions

4
.gitignore vendored
View File

@@ -15,3 +15,7 @@ selenium-debug.log
*.ntvs* *.ntvs*
*.njsproj *.njsproj
*.sln *.sln
# common
common/common.vue

View File

@@ -49,10 +49,18 @@
:http-request="handleRequest" :http-request="handleRequest"
> >
<!-- accept=".xlsx,.xls" --> <!-- accept=".xlsx,.xls" -->
<el-button size="small" type="primary" plain :loading="showLoadIcon" :disabled="showLoadIcon" <el-button
size="small"
type="primary"
plain
:loading="showLoadIcon"
:disabled="showLoadIcon"
>导入考题 {{ loadText }}</el-button >导入考题 {{ loadText }}</el-button
> >
</el-upload> </el-upload>
<el-button size="small" type="danger" @click="clearQuestion()"
>清空题库</el-button
>
<!-- </el-form-item> --> <!-- </el-form-item> -->
<!-- <div :loading="showLoadIcon">{{loadText}}</div> --> <!-- <div :loading="showLoadIcon">{{loadText}}</div> -->
</el-form> </el-form>
@@ -245,7 +253,7 @@ export default {
resList: [], resList: [],
resListVisible: false, resListVisible: false,
optCourse: {}, optCourse: {},
currentFile:{} currentFile: {}
}; };
}, },
components: { components: {
@@ -262,6 +270,38 @@ export default {
this.getTreeList(this.urlList.sociologyList, 2); this.getTreeList(this.urlList.sociologyList, 2);
}, },
methods: { 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) { numberToABCD(num) {
let result = ""; let result = "";
let mod; let mod;
@@ -300,49 +340,36 @@ export default {
this.showLoadIcon = true; this.showLoadIcon = true;
this.loadText = "正在上传中"; this.loadText = "正在上传中";
}, },
handleSuccess(file, fileList) { // handleSuccess(file, fileList) {
this.showLoadIcon = false; // this.showLoadIcon = false;
this.loadText = ""; // this.loadText = "";
console.log("fileurl", this.course.id, file.url); // console.log("fileurl", this.course.id, file.url);
this.getQuestList(file.url, this.course.id); // this.getQuestList(file.url, this.course.id);
// this.form.imageList.push('file.url',file.url); // // 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: { // 请求自动生成接口
// //默认 无 说明:请求头 // getQuestList(url, courseId) {
// "Content-Type": "application/json" // this.$http({
// } // url: this.$http.adornUrl("/common/classExam/importSubject"),
// method: "post",
// data: this.$http.adornData({
// courseId: courseId,
// file: url
// }) // })
this.$http({ // })
url: this.$http.adornUrl("/common/classExam/importSubject"), // .then(res => {
method: "post", // console.log("reschenggong", res);
data: this.$http.adornData({ // // if (res.data.code == 0) {
courseId: courseId, // // this.$message.success("操作成功!");
file: url
})
})
.then(res => {
console.log("reschenggong", res);
// if (res.data.code == 0) {
// this.$message.success("操作成功!");
// } // // }
}) // })
.catch(e => { // .catch(e => {
this.$message.error("获取课程信息失败"); // this.$message.error("获取课程信息失败");
_info = null; // _info = null;
}); // });
}, // },
handleRemoveNovel() { handleRemoveNovel() {
console.log("删除文件"); console.log("删除文件");
}, },
@@ -472,7 +499,7 @@ export default {
console.log("🚀 ~ handleRequest ~ formdata:", formdata); console.log("🚀 ~ handleRequest ~ formdata:", formdata);
this.showLoadIcon = true; this.showLoadIcon = true;
this.loadText = '正在上传文件' this.loadText = "正在上传文件";
// onProgress() // onProgress()
axios axios
.post(this.baseUrl + "/common/classExam/importSubject", formdata, { .post(this.baseUrl + "/common/classExam/importSubject", formdata, {
@@ -481,11 +508,11 @@ export default {
const percentCompleted = Math.round( const percentCompleted = Math.round(
(progressEvent.loaded * 100) / progressEvent.total (progressEvent.loaded * 100) / progressEvent.total
); );
if(percentCompleted == 100){ if (percentCompleted == 100) {
that.$message.success('文件上传成功,正在写入数据') that.$message.success("文件上传成功,正在写入数据");
that.loadText = '文件上传成功,正在写入数据' that.loadText = "文件上传成功,正在写入数据";
}else{ } else {
that.loadText = `${percentCompleted}%` that.loadText = `${percentCompleted}%`;
} }
console.log(`Upload Progress: ${percentCompleted}%`); console.log(`Upload Progress: ${percentCompleted}%`);
} }
@@ -497,21 +524,21 @@ export default {
// that.fileList[that.fileList.length - 1].status = "done"; // that.fileList[that.fileList.length - 1].status = "done";
// clearInterval(that.uploadTimer); // clearInterval(that.uploadTimer);
that.showLoadIcon = false; that.showLoadIcon = false;
that.loadText = '' that.loadText = "";
that.currentFile = {}; that.currentFile = {};
onSuccess(); onSuccess();
that.getDataList() that.getDataList();
} else { } else {
// that.fileList[that.fileList.length - 1].ststus = "error"; // that.fileList[that.fileList.length - 1].ststus = "error";
that.$message.error(res.data.msg); that.$message.error(res.data.msg);
onError(); onError();
that.showLoadIcon = false; that.showLoadIcon = false;
that.loadText = '' that.loadText = "";
} }
}) })
.catch(e => { .catch(e => {
that.$message.error(e.data.msg); that.$message.error(e.data.msg);
that.loadText = '' that.loadText = "";
}); });
// var prom = new Promise((resolve, reject) => {}); // var prom = new Promise((resolve, reject) => {});
// prom.abort = () => {}; // prom.abort = () => {};

View File

@@ -41,7 +41,12 @@
教学时长:<span style="color:red">*</span> 教学时长:<span style="color:red">*</span>
</div> </div>
<el-form-item label="" prop="days" label-width="0"> <el-form-item label="" prop="days" label-width="0">
<el-input type="number" v-model="ClassModelForm.days" :disabled="classModel && classModel.id ? true : false"><template slot="append"></template></el-input> <el-input
type="number"
v-model="ClassModelForm.days"
:disabled="classModel && classModel.id ? true : false"
><template slot="append"></template></el-input
>
</el-form-item> </el-form-item>
<div style="margin:15px 0; font-size:14px; color:#606266"> <div style="margin:15px 0; font-size:14px; color:#606266">
平时分模块:<span style="color:red">*</span> 平时分模块:<span style="color:red">*</span>
@@ -52,39 +57,96 @@
<el-radio :label="1">包含</el-radio> <el-radio :label="1">包含</el-radio>
<el-radio :label="0">不包含</el-radio> <el-radio :label="0">不包含</el-radio>
</el-radio-group> </el-radio-group>
<el-input type="number" v-show="ClassModelForm.isTask == 1" v-model="ClassModelForm.taskScore" ><template slot="append">% 分数占比</template></el-input> <el-input
type="number"
v-show="ClassModelForm.isTask == 1"
v-model="ClassModelForm.taskScore"
><template slot="append">% 分数占比</template></el-input
>
</el-form-item> </el-form-item>
<div class="line"></div> <div class="line"></div>
<el-form-item label="医案模块" prop="isMedicalcase" label-width="150"> <el-form-item
label="医案模块"
prop="isMedicalcase"
label-width="150"
>
<el-radio-group v-model="ClassModelForm.isMedicalcase"> <el-radio-group v-model="ClassModelForm.isMedicalcase">
<el-radio :label="1">包含</el-radio> <el-radio :label="1">包含</el-radio>
<el-radio :label="0">不包含</el-radio> <el-radio :label="0">不包含</el-radio>
</el-radio-group> </el-radio-group>
<el-input type="number" v-show="ClassModelForm.isMedicalcase == 1" v-model="ClassModelForm.medicalcaseScore" ><template slot="append">% 分数占比</template></el-input> <el-input
type="number"
v-show="ClassModelForm.isMedicalcase == 1"
v-model="ClassModelForm.medicalcaseScore"
><template slot="append">% 分数占比</template></el-input
>
</el-form-item> </el-form-item>
<div class="line"></div> <div class="line"></div>
<el-form-item label="心得模块" prop="isExperience" label-width="150"> <el-form-item
label="心得模块"
prop="isExperience"
label-width="150"
>
<el-radio-group v-model="ClassModelForm.isExperience"> <el-radio-group v-model="ClassModelForm.isExperience">
<el-radio :label="1">包含</el-radio> <el-radio :label="1">包含</el-radio>
<el-radio :label="0">不包含</el-radio> <el-radio :label="0">不包含</el-radio>
</el-radio-group> </el-radio-group>
<el-input type="number" v-show="ClassModelForm.isExperience == 1" v-model="ClassModelForm.experienceScore" ><template slot="append">% 分数占比</template></el-input> <el-input
type="number"
v-show="ClassModelForm.isExperience == 1"
v-model="ClassModelForm.experienceScore"
><template slot="append">% 分数占比</template></el-input
>
</el-form-item> </el-form-item>
<div class="line"></div> <div class="line"></div>
<el-form-item label="思考题模块" prop="isQuestion" label-width="150"> <el-form-item
<el-radio-group v-model="ClassModelForm.isQuestion" > label="思考题模块"
prop="isQuestion"
label-width="150"
>
<el-radio-group v-model="ClassModelForm.isQuestion">
<el-radio :label="1" disabled>包含</el-radio> <el-radio :label="1" disabled>包含</el-radio>
<el-radio :label="0" disabled>不包含</el-radio> <el-radio :label="0" disabled>不包含</el-radio>
</el-radio-group> </el-radio-group>
<el-input type="number" v-show="ClassModelForm.isQuestion == 1" v-model="ClassModelForm.questionScore" ><template slot="append">% 分数占比</template></el-input> <el-input
type="number"
v-show="ClassModelForm.isQuestion == 1"
v-model="ClassModelForm.questionScore"
><template slot="append">% 分数占比</template></el-input
>
</el-form-item> </el-form-item>
<div class="line"></div> <div class="line"></div>
<el-form-item label="考试模块" prop="isExam" label-width="150"> <el-form-item label="考试模块" prop="isExam" label-width="150">
<el-radio-group v-model="ClassModelForm.isExam" > <el-radio-group v-model="ClassModelForm.isExam">
<el-radio :label="1" >包含</el-radio> <el-radio :label="1">包含</el-radio>
<el-radio :label="0" >不包含</el-radio> <el-radio :label="0">不包含</el-radio>
</el-radio-group> </el-radio-group>
<el-input type="number" v-show="ClassModelForm.isExam == 1" v-model="ClassModelForm.examScore" ><template slot="append">% 分数占比</template></el-input> <div class="flexBox">
<div>
<el-input
type="number"
v-show="ClassModelForm.isExam == 1"
v-model="ClassModelForm.examScore"
><template slot="append">% 分数占比</template></el-input
>
</div>
<div style="padding-left:10px">
<el-input
type="number"
@focus="showExameDays = false"
v-model="ClassModelForm.examDays"
:disabled="classModel && classModel.id ? true : false"
><template slot="append">考试周期</template></el-input
>
<div v-show="showExameDays">
<span
style="color:red; font-size :12px; display: inline;"
>请设置考试周期需要的天数</span
>
</div>
</div>
</div>
</el-form-item> </el-form-item>
</div> </div>
<div style="margin:15px 0; font-size:14px; color:#606266"> <div style="margin:15px 0; font-size:14px; color:#606266">
@@ -165,8 +227,15 @@
</div> </div>
</el-form> </el-form>
<div style="text-align:center; margin-top:15px"> <div style="text-align:center; margin-top:15px">
<el-button type="primary" @click="submitModel" v-if="ClassModelForm.id"> </el-button> <el-button
<el-button type="primary" @click="submitModel" v-else>立即创建</el-button> type="primary"
@click="submitModel"
v-if="ClassModelForm.id"
> </el-button
>
<el-button type="primary" @click="submitModel" v-else
>立即创建</el-button
>
</div> </div>
</div> </div>
</el-drawer> </el-drawer>
@@ -211,17 +280,18 @@ export default {
props: ["classModel"], props: ["classModel"],
data() { data() {
return { return {
showExameDays: false,
baseUrl: global.baseUrl, baseUrl: global.baseUrl,
drawer: true, drawer: true,
ClassModelRules: { ClassModelRules: {
title: [{ required: true, message: "必填项", trigger: "blur" }], title: [{ required: true, message: "必填项", trigger: "blur" }],
courseIds: [{ 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, remoteMethodLoading: false,
ClassModelForm: { ClassModelForm: {
title: "", title: "",
days:undefined, // 天数 days: undefined, // 天数
id: undefined, id: undefined,
content: "", content: "",
courseIds: undefined, courseIds: undefined,
@@ -237,7 +307,8 @@ export default {
isExperience: 1, isExperience: 1,
experienceScore: 10, experienceScore: 10,
examScore: 60, examScore: 60,
isExam:1 isExam: 1,
exameDays: undefined // 考试天数
}, },
courseList: [], courseList: [],
typeOptions: [ typeOptions: [
@@ -282,7 +353,7 @@ export default {
}; };
}, },
mounted() { mounted() {
console.log('激活了',this.classModel) console.log("激活了", this.classModel);
if (this.classModel) { if (this.classModel) {
console.log("编辑", this.classModel); console.log("编辑", this.classModel);
this.$nextTick(() => { this.$nextTick(() => {
@@ -298,19 +369,18 @@ export default {
if (this.classModel.director) { if (this.classModel.director) {
this.userList.push(this.classModel.director); this.userList.push(this.classModel.director);
} }
if(this.classModel.directorId == 0){ if (this.classModel.directorId == 0) {
this.ClassModelForm.directorId = null this.ClassModelForm.directorId = null;
} }
if (this.classModel.ddirector) { if (this.classModel.ddirector) {
this.userList.push(this.classModel.ddirector); this.userList.push(this.classModel.ddirector);
} }
if(this.classModel.ddirectorId == 0){ if (this.classModel.ddirectorId == 0) {
this.ClassModelForm.ddirectorId = null this.ClassModelForm.ddirectorId = null;
} }
}); });
} else { } else {
console.log("添加",this.ClassModelForm); console.log("添加", this.ClassModelForm);
} }
// this.getCourseList(); // this.getCourseList();
}, },
@@ -320,22 +390,41 @@ export default {
"this.ClassModelForm.ddirectorId", "this.ClassModelForm.ddirectorId",
this.ClassModelForm.ddirectorId this.ClassModelForm.ddirectorId
); );
if(this.ClassModelForm.days <= 0){ if (this.ClassModelForm.isExam == 1) {
this.$message.error('学习时长不可为0') if(!this.ClassModelForm.exameDays || this.ClassModelForm.exameDays == 0) {
return this.$message.error("请设置考试周期需要的天数");
this.showExameDays = true;
return;
} }
if(this.ClassModelForm.directorId == (this.ClassModelForm.ddirectorId + "") && this.ClassModelForm.ddirectorId != null){ } else {
this.$message.error('主任和副主任不可为同一人!') this.ClassModelForm.exameDays = 0;
return
} }
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 (valid) {
if (this.ClassModelForm.type == '0' && this.ClassModelForm.courseIds.length > 1){ if (
this.$message.error('普通小班模型只可以绑定一门课程哦') this.ClassModelForm.type == "0" &&
return this.ClassModelForm.courseIds.length > 1
) {
this.$message.error("普通小班模型只可以绑定一门课程哦");
return;
} }
var url = '' var url = "";
this.ClassModelForm.id ? url = '/common/class/editClassModel' : url = '/common/class/addClassModel' this.ClassModelForm.id
? (url = "/common/class/editClassModel")
: (url = "/common/class/addClassModel");
this.$http({ this.$http({
url: this.$http.adornUrl(url), url: this.$http.adornUrl(url),
method: "post", method: "post",
@@ -357,20 +446,20 @@ export default {
experienceScore: parseInt(this.ClassModelForm.experienceScore), experienceScore: parseInt(this.ClassModelForm.experienceScore),
isExam: this.ClassModelForm.isExam, isExam: this.ClassModelForm.isExam,
examScore: parseInt(this.ClassModelForm.examScore), examScore: parseInt(this.ClassModelForm.examScore),
exameDays:parseInt(this.ClassModelForm.exameDays), // 考试周期天数
}) })
}) }).then(({ data }) => {
.then(({ data }) => {
if (data && data.code == 0) { if (data && data.code == 0) {
this.$message.success("操作成功"); this.$message.success("操作成功");
this.$nextTick(() => { this.$nextTick(() => {
this.handleClose(); this.handleClose();
}); });
}else{ } else {
this.$message.error(data.msg); this.$message.error(data.msg);
} }
}) });
} }
}) });
}, },
shwoUpMsg() { shwoUpMsg() {
this.$message.success("正在上传"); this.$message.success("正在上传");
@@ -380,7 +469,7 @@ export default {
url: this.$http.adornUrl("/common/class/getClassModelCourseList"), url: this.$http.adornUrl("/common/class/getClassModelCourseList"),
method: "post", method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
title:query, title: query
// page: 1, // page: 1,
// limit: 10, // limit: 10,
// courseName: query, //关键字 // courseName: query, //关键字
@@ -481,11 +570,18 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.partsBox{padding: 10px; background: #eee; border-radius: 10px; .partsBox {
.el-form-item{ padding: 10px;
background: #fff; padding: 10px 15px; background: #eee;
border-radius: 10px;
.el-form-item {
background: #fff;
padding: 10px 15px;
} }
} }
.flexBox {
display: flex;
}
.editorUploader { .editorUploader {
display: none; display: none;
} }

View File

@@ -10,7 +10,7 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="班级类型"> <el-form-item label="班级类型">
<el-select v-model="dataForm.status" placeholder="请选择"> <el-select v-model="dataForm.type" placeholder="请选择">
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
@@ -150,7 +150,7 @@ export default {
return { return {
dataForm: { dataForm: {
key: "", key: "",
status:'0' type:''
}, },
courseId: {}, courseId: {},
course: null, course: null,
@@ -248,9 +248,8 @@ export default {
data: this.$http.adornData({ data: this.$http.adornData({
page: this.pageIndex, page: this.pageIndex,
limit: this.pageSize, limit: this.pageSize,
title: this.dataForm.key, title: this.dataForm.key,
// status: dataForm.status type: this.dataForm.type
}) })
// params: this.$http.adornParams({ // params: this.$http.adornParams({
// 'page': 1, // 'page': 1,