修改bug

This commit is contained in:
Vce 2024-05-23 22:27:06 +08:00
parent 9b8e002755
commit a838aca210
3 changed files with 99 additions and 61 deletions

View File

@ -138,17 +138,18 @@
</template>
</el-table-column>
<el-table-column prop="difficulty" align="center" width="80px" label="难易程度">
<template slot-scope="scope">
<div>{{ scope.row.difficulty && levelArr[scope.row.difficulty - 1].name }}</div>
</template>
</el-table-column>
<el-table-column prop="options" align="center" width="80px" label="试题答案"></el-table-column>
<el-table-column prop="createTime" align="center" width="170px" label="创建时间"></el-table-column>
<el-table-column prop="isEnable" align="center" width="100px" label="状态">
<template slot-scope="scope">
<div :style="scope.row.isEnable == 1 ? 'color: green' : 'color: red'">{{ scope.row.isEnable == 1 ? "已应用" : "未应用" }}</div>
</template>
</el-table-column>
<template slot-scope="scope">
<div>{{ scope.row.difficulty && levelArr[scope.row.difficulty - 1].name }}</div>
</template>
</el-table-column>
<el-table-column prop="score" align="center" width="80px" label="分数"></el-table-column>
<el-table-column prop="options" align="center" width="80px" label="试题答案"></el-table-column>
<el-table-column prop="createTime" align="center" width="170px" label="创建时间"></el-table-column>
<el-table-column prop="isEnable" align="center" width="100px" label="状态">
<template slot-scope="scope">
<div :style="scope.row.isEnable == 1 ? 'color: green' : 'color: red'">{{ scope.row.isEnable == 1 ? "已应用" : "未应用" }}</div>
</template>
</el-table-column>
</el-table>
<!-- <el-pagination class="pagerBox" @size-change="sizeChange" @current-change="currentChange" :current-page="question.pageNo" :page-sizes="$store.state.PAGESIZRS" :page-size="question.pageSize" layout="total, sizes, prev, pager, next" :total="Number(question.total)" background></el-pagination> -->
</div>
@ -252,6 +253,7 @@
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="score" label="分数" width="100"></el-table-column>
<el-table-column align="center" prop="options" label="答案"></el-table-column>
</el-table>
@ -807,7 +809,7 @@ export default {
this.personType = 1
this.title = "编辑考试";
// console.log(row);
this.examForm = row
this.examForm = JSON.parse(JSON.stringify(row))

View File

@ -75,15 +75,18 @@
<div class="dialogContainer">
<div class="dialogLeft">
<el-form :model="addCourseForm" ref="addCourseForm" label-width="100px" class="demo-addCourseForm">
<el-form-item label="科目类型" prop="subjectId" required>
<el-form-item label="科目类型" prop="subjectId"
:rules="[{required:true,message:'必填',trigger:'change'}]">
<el-select v-model="addCourseForm.subjectId" placeholder="请选择">
<el-option :label="item.name" :value="item.id" v-for="(item,i) in examSubjectList" :key="i"></el-option>
</el-select>
</el-form-item>
<el-form-item label="课程名称" prop="courseName" required>
<el-form-item label="课程名称" prop="courseName"
:rules="[{required:true,message:'必填',trigger:'change'}]">
<el-input v-model="addCourseForm.courseName"></el-input>
</el-form-item>
<el-form-item label="课程视频" prop="fileUrl" required>
<el-form-item label="课程视频" prop="fileUrl"
:rules="[{required:true,message:' ',trigger:['blur','change']}]">
<div>单个文件不超过100M,最多可上传1个附件</div>
<el-upload class="upload-demo" drag multiple name="files" :limit="1" :action="$store.state.UPLOADURL"
accept=".mp4"
@ -96,7 +99,8 @@
<div class="el-upload__text"><i style="font-size: 18px;" class="el-icon-upload"></i>将文件拖到此处<em>点击上传</em></div>
</el-upload>
</el-form-item>
<el-form-item label="课程封面" prop="coverImg" required>
<el-form-item label="课程封面" prop="coverImg"
:rules="[{required:true,message:' ',trigger:['blur','change']}]">
<el-upload :action="$store.state.UPLOADURL" list-type="picture-card" name="files" :limit="1"
:on-remove="(file, fileList) => coverHandleRemove(file, fileList)"
:on-success="(res, file) => coverHandleSuccess(res, file)"
@ -163,7 +167,13 @@ export default {
materialFileList: [], //
coverFileList: [], //
addCourseForm: {}, //
addCourseForm: {
subjectId:'',
courseName:'',
fileUrl:'',
coverImg:'',
remark:''
}, //
studyCycle: [], //
personType: 1, //
@ -201,6 +211,14 @@ export default {
},
mounted() {},
watch:{
dialogVisible(newV,oldV){
if(newV === false){
this.$refs.addCourseForm.resetFields()
}
if(this.title === '新增课程'){
this.$refs.addCourseForm.resetFields()
}
}
},
methods: {
//
@ -278,7 +296,20 @@ export default {
}
})
},
resetForm(){
this.addCourseForm = {
subjectId:'',
courseName:'',
fileUrl:'',
coverImg:'',
remark:''
}
this.coverFileList = []
this.materialFileList = []
},
async handleOpen(item,title) { //
this.addCourseForm = {}
this.resetForm()
this.title = title
await this.getExamSubjectList()
this.dialogVisible = true
@ -318,7 +349,7 @@ export default {
}
},
materialExceedFn(files, fileList){ // --
this.$message.warning('已经上传了5个文件啦!');
this.$message.warning('已经上传了1个文件啦!');
},
coverHandleRemove(file, coverFileList) { // ----
this.coverFileList = coverFileList
@ -351,49 +382,55 @@ export default {
return false;
}
},
submitBtn() { //
if(this.studyCycle.length > 0){
console.log('==========studyCycle-submitBtn==========',this.studyCycle)
this.addCourseForm.beginTime = this.studyCycle[0]
this.addCourseForm.endTime = this.studyCycle[1]
}
this.addCourseForm.projectSn = this.$store.state.projectSn;
// this.addCourseForm.coverImg = this.coverFileList
// this.addCourseForm.fileList = this.materialFileList
if(!this.addCourseForm.subjectId){
this.$message.error('请选择科目类型')
return
}
if(!this.addCourseForm.courseName){
this.$message.error('请输入课程名称')
return
}
if(!this.addCourseForm.fileUrl){
this.$message.error('请上传视频文件')
return
}
if(!this.addCourseForm.coverImg){
this.$message.error('请上传课程封面')
return
}
if(this.title === '新增课程'){
addCourseApi(this.addCourseForm).then((res)=>{
if (res.code == 200) {
this.handleClose()
this.$message.success(res.result);
this.getPageCourseApi();
submitBtn(addCourseForm) { //
this.$refs[addCourseForm].validate((valid) =>{
if(valid){
if(this.studyCycle.length > 0){
console.log('==========studyCycle-submitBtn==========',this.studyCycle)
this.addCourseForm.beginTime = this.studyCycle[0]
this.addCourseForm.endTime = this.studyCycle[1]
}
})
}else{
editCourseApi(this.addCourseForm).then((res)=>{
if (res.code == 200) {
this.handleClose()
this.$message.success('编辑成功');
this.getPageCourseApi();
this.addCourseForm.projectSn = this.$store.state.projectSn;
// this.addCourseForm.coverImg = this.coverFileList
// this.addCourseForm.fileList = this.materialFileList
if(!this.addCourseForm.subjectId){
this.$message.error('请选择科目类型')
return
}
})
}
console.log('==========addCourseForm-submitBtn==========',this.addCourseForm)
if(!this.addCourseForm.courseName){
this.$message.error('请输入课程名称')
return
}
if(!this.addCourseForm.fileUrl){
this.$message.error('请上传视频文件')
return
}
if(!this.addCourseForm.coverImg){
this.$message.error('请上传课程封面')
return
}
if(this.title === '新增课程'){
addCourseApi(this.addCourseForm).then((res)=>{
if (res.code == 200) {
this.handleClose()
this.$message.success(res.result);
this.getPageCourseApi();
}
})
}else{
editCourseApi(this.addCourseForm).then((res)=>{
if (res.code == 200) {
this.handleClose()
this.$message.success('编辑成功');
this.getPageCourseApi();
}
})
}
console.log('==========addCourseForm-submitBtn==========',this.addCourseForm)
}
})
},
sizeChange(val) { // pageSize
this.pagInfo.pageSize = val

View File

@ -99,8 +99,7 @@ export default {
},
watch:{
dialogVisible(newVal,oldVal){
// this.getExamSubjectList()
// if(newVal === false) this.subjectInfo = {}
}
},
computed: {