添加考试周期

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*
*.njsproj
*.sln
# common
common/common.vue

View File

@@ -49,10 +49,18 @@
:http-request="handleRequest"
>
<!-- 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
>
</el-upload>
<el-button size="small" type="danger" @click="clearQuestion()"
>清空题库</el-button
>
<!-- </el-form-item> -->
<!-- <div :loading="showLoadIcon">{{loadText}}</div> -->
</el-form>
@@ -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);
},
// 请求自动生成接口
getQuestList(url, courseId) {
// this.$http
// .request({
// url: this.$http.adornUrl('/common/classExam/importSubject'),
// method: "POST",
// data: {
// courseId: courseId,
// file:url
// this.getQuestList(file.url, this.course.id);
// // this.form.imageList.push('file.url',file.url);
// },
// header: {
// //默认 无 说明:请求头
// "Content-Type": "application/json"
// }
// 请求自动生成接口
// getQuestList(url, courseId) {
// 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"),
method: "post",
data: this.$http.adornData({
courseId: courseId,
file: url
})
})
.then(res => {
console.log("reschenggong", res);
// if (res.data.code == 0) {
// this.$message.success("操作成功!");
// })
// .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 = () => {};

View File

@@ -41,7 +41,12 @@
教学时长:<span style="color:red">*</span>
</div>
<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>
<div style="margin:15px 0; font-size:14px; color:#606266">
平时分模块:<span style="color:red">*</span>
@@ -52,39 +57,96 @@
<el-radio :label="1">包含</el-radio>
<el-radio :label="0">不包含</el-radio>
</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>
<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 :label="1">包含</el-radio>
<el-radio :label="0">不包含</el-radio>
</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>
<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 :label="1">包含</el-radio>
<el-radio :label="0">不包含</el-radio>
</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>
<div class="line"></div>
<el-form-item label="思考题模块" prop="isQuestion" label-width="150">
<el-radio-group v-model="ClassModelForm.isQuestion" >
<el-form-item
label="思考题模块"
prop="isQuestion"
label-width="150"
>
<el-radio-group v-model="ClassModelForm.isQuestion">
<el-radio :label="1" disabled>包含</el-radio>
<el-radio :label="0" disabled>不包含</el-radio>
</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>
<div class="line"></div>
<el-form-item label="考试模块" prop="isExam" label-width="150">
<el-radio-group v-model="ClassModelForm.isExam" >
<el-radio :label="1" >包含</el-radio>
<el-radio :label="0" >不包含</el-radio>
<el-radio-group v-model="ClassModelForm.isExam">
<el-radio :label="1">包含</el-radio>
<el-radio :label="0">不包含</el-radio>
</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>
</div>
<div style="margin:15px 0; font-size:14px; color:#606266">
@@ -165,8 +227,15 @@
</div>
</el-form>
<div style="text-align:center; margin-top:15px">
<el-button type="primary" @click="submitModel" v-if="ClassModelForm.id"> </el-button>
<el-button type="primary" @click="submitModel" v-else>立即创建</el-button>
<el-button
type="primary"
@click="submitModel"
v-if="ClassModelForm.id"
> </el-button
>
<el-button type="primary" @click="submitModel" v-else
>立即创建</el-button
>
</div>
</div>
</el-drawer>
@@ -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();
},
@@ -320,22 +390,41 @@ export default {
"this.ClassModelForm.ddirectorId",
this.ClassModelForm.ddirectorId
);
if(this.ClassModelForm.days <= 0){
this.$message.error('学习时长不可为0')
return
if (this.ClassModelForm.isExam == 1) {
if(!this.ClassModelForm.exameDays || this.ClassModelForm.exameDays == 0) {
this.$message.error("请设置考试周期需要的天数");
this.showExameDays = true;
return;
}
if(this.ClassModelForm.directorId == (this.ClassModelForm.ddirectorId + "") && this.ClassModelForm.ddirectorId != null){
this.$message.error('主任和副主任不可为同一人!')
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
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'
var url = "";
this.ClassModelForm.id
? (url = "/common/class/editClassModel")
: (url = "/common/class/addClassModel");
this.$http({
url: this.$http.adornUrl(url),
method: "post",
@@ -357,20 +446,20 @@ export default {
experienceScore: parseInt(this.ClassModelForm.experienceScore),
isExam: this.ClassModelForm.isExam,
examScore: parseInt(this.ClassModelForm.examScore),
exameDays:parseInt(this.ClassModelForm.exameDays), // 考试周期天数
})
})
.then(({ data }) => {
}).then(({ data }) => {
if (data && data.code == 0) {
this.$message.success("操作成功");
this.$nextTick(() => {
this.handleClose();
});
}else{
} 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 {
</script>
<style lang="less" scoped>
.partsBox{padding: 10px; background: #eee; border-radius: 10px;
.el-form-item{
background: #fff; padding: 10px 15px;
.partsBox {
padding: 10px;
background: #eee;
border-radius: 10px;
.el-form-item {
background: #fff;
padding: 10px 15px;
}
}
.flexBox {
display: flex;
}
.editorUploader {
display: none;
}

View File

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