修改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

@ -142,6 +142,7 @@
<div>{{ scope.row.difficulty && levelArr[scope.row.difficulty - 1].name }}</div> <div>{{ scope.row.difficulty && levelArr[scope.row.difficulty - 1].name }}</div>
</template> </template>
</el-table-column> </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="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="createTime" align="center" width="170px" label="创建时间"></el-table-column>
<el-table-column prop="isEnable" align="center" width="100px" label="状态"> <el-table-column prop="isEnable" align="center" width="100px" label="状态">
@ -252,6 +253,7 @@
</div> </div>
</template> </template>
</el-table-column> </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-column align="center" prop="options" label="答案"></el-table-column>
</el-table> </el-table>
@ -807,7 +809,7 @@ export default {
this.personType = 1 this.personType = 1
this.title = "编辑考试"; this.title = "编辑考试";
// console.log(row); // console.log(row);
this.examForm = row this.examForm = JSON.parse(JSON.stringify(row))

View File

@ -75,15 +75,18 @@
<div class="dialogContainer"> <div class="dialogContainer">
<div class="dialogLeft"> <div class="dialogLeft">
<el-form :model="addCourseForm" ref="addCourseForm" label-width="100px" class="demo-addCourseForm"> <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-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-option :label="item.name" :value="item.id" v-for="(item,i) in examSubjectList" :key="i"></el-option>
</el-select> </el-select>
</el-form-item> </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-input v-model="addCourseForm.courseName"></el-input>
</el-form-item> </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> <div>单个文件不超过100M,最多可上传1个附件</div>
<el-upload class="upload-demo" drag multiple name="files" :limit="1" :action="$store.state.UPLOADURL" <el-upload class="upload-demo" drag multiple name="files" :limit="1" :action="$store.state.UPLOADURL"
accept=".mp4" accept=".mp4"
@ -96,7 +99,8 @@
<div class="el-upload__text"><i style="font-size: 18px;" class="el-icon-upload"></i>将文件拖到此处<em>点击上传</em></div> <div class="el-upload__text"><i style="font-size: 18px;" class="el-icon-upload"></i>将文件拖到此处<em>点击上传</em></div>
</el-upload> </el-upload>
</el-form-item> </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" <el-upload :action="$store.state.UPLOADURL" list-type="picture-card" name="files" :limit="1"
:on-remove="(file, fileList) => coverHandleRemove(file, fileList)" :on-remove="(file, fileList) => coverHandleRemove(file, fileList)"
:on-success="(res, file) => coverHandleSuccess(res, file)" :on-success="(res, file) => coverHandleSuccess(res, file)"
@ -163,7 +167,13 @@ export default {
materialFileList: [], // materialFileList: [], //
coverFileList: [], // coverFileList: [], //
addCourseForm: {}, // addCourseForm: {
subjectId:'',
courseName:'',
fileUrl:'',
coverImg:'',
remark:''
}, //
studyCycle: [], // studyCycle: [], //
personType: 1, // personType: 1, //
@ -201,6 +211,14 @@ export default {
}, },
mounted() {}, mounted() {},
watch:{ watch:{
dialogVisible(newV,oldV){
if(newV === false){
this.$refs.addCourseForm.resetFields()
}
if(this.title === '新增课程'){
this.$refs.addCourseForm.resetFields()
}
}
}, },
methods: { methods: {
// //
@ -278,7 +296,20 @@ export default {
} }
}) })
}, },
resetForm(){
this.addCourseForm = {
subjectId:'',
courseName:'',
fileUrl:'',
coverImg:'',
remark:''
}
this.coverFileList = []
this.materialFileList = []
},
async handleOpen(item,title) { // async handleOpen(item,title) { //
this.addCourseForm = {}
this.resetForm()
this.title = title this.title = title
await this.getExamSubjectList() await this.getExamSubjectList()
this.dialogVisible = true this.dialogVisible = true
@ -318,7 +349,7 @@ export default {
} }
}, },
materialExceedFn(files, fileList){ // -- materialExceedFn(files, fileList){ // --
this.$message.warning('已经上传了5个文件啦!'); this.$message.warning('已经上传了1个文件啦!');
}, },
coverHandleRemove(file, coverFileList) { // ---- coverHandleRemove(file, coverFileList) { // ----
this.coverFileList = coverFileList this.coverFileList = coverFileList
@ -351,7 +382,9 @@ export default {
return false; return false;
} }
}, },
submitBtn() { // submitBtn(addCourseForm) { //
this.$refs[addCourseForm].validate((valid) =>{
if(valid){
if(this.studyCycle.length > 0){ if(this.studyCycle.length > 0){
console.log('==========studyCycle-submitBtn==========',this.studyCycle) console.log('==========studyCycle-submitBtn==========',this.studyCycle)
this.addCourseForm.beginTime = this.studyCycle[0] this.addCourseForm.beginTime = this.studyCycle[0]
@ -394,6 +427,10 @@ export default {
}) })
} }
console.log('==========addCourseForm-submitBtn==========',this.addCourseForm) console.log('==========addCourseForm-submitBtn==========',this.addCourseForm)
}
})
}, },
sizeChange(val) { // pageSize sizeChange(val) { // pageSize
this.pagInfo.pageSize = val this.pagInfo.pageSize = val

View File

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