新增试题多选单选回显问题修复

This commit is contained in:
骆乐 2022-09-29 10:29:01 +08:00
parent da4016a66e
commit 08c3e42165
3 changed files with 41 additions and 16 deletions

BIN
dist.zip

Binary file not shown.

View File

@ -41,7 +41,7 @@ if (process.env.NODE_ENV == 'development') {
// tag: 本地 // tag: 本地
// axios.defaults.baseURL = 'http://192.168.34.174:6023/' // 老大本地 // axios.defaults.baseURL = 'http://192.168.34.174:6023/' // 老大本地
// axios.defaults.baseURL = 'http://192.168.34.125:6023/' //杨意本地 http/1.1 // axios.defaults.baseURL = 'http://192.168.34.125:6023/' //杨意本地 http/1.1
// axios.defaults.baseURL = 'http://192.168.34.216:6023/' // 邱平毅本地 axios.defaults.baseURL = 'http://192.168.34.216:6023/' // 邱平毅本地
// axios.defaults.baseURL ='http://124.71.67.160:8088/' //中建四局线上 // axios.defaults.baseURL ='http://124.71.67.160:8088/' //中建四局线上
// axios.defaults.baseURL = 'http://192.168.34.125:6023/' //杨意本地 http/1.1 // axios.defaults.baseURL = 'http://192.168.34.125:6023/' //杨意本地 http/1.1
// axios.defaults.baseURL ='http://47.97.202.104:6023/' //金林湾线上 // axios.defaults.baseURL ='http://47.97.202.104:6023/' //金林湾线上
@ -50,7 +50,7 @@ if (process.env.NODE_ENV == 'development') {
// axios.defaults.baseURL = 'http://47.97.202.104:6023/'; // axios.defaults.baseURL = 'http://47.97.202.104:6023/';
// axios.defaults.baseURL = 'http://139.9.66.234:8/'; // axios.defaults.baseURL = 'http://139.9.66.234:8/';
// axios.defaults.baseURL = 'http://120.196.217.6:7000/'; // 鹤洲 // axios.defaults.baseURL = 'http://120.196.217.6:7000/'; // 鹤洲
axios.defaults.baseURL = 'http://182.90.224.237:7000/'; // 广西 // axios.defaults.baseURL = 'http://182.90.224.237:7000/'; // 广西
// axios.defaults.baseURL = 'http://120.196.217.6:7000/' //鹤洲 // axios.defaults.baseURL = 'http://120.196.217.6:7000/' //鹤洲
// axios.defaults.baseURL = 'http://117.156.17.59:9090/'; // // axios.defaults.baseURL = 'http://117.156.17.59:9090/'; //

View File

@ -133,9 +133,11 @@
<p>{{ $t("message.safetyEducation.noQuestions") }}</p> <p>{{ $t("message.safetyEducation.noQuestions") }}</p>
</div> </div>
</div> </div>
<!-- $t('message.workType.operate')[type] -->
<el-dialog <el-dialog
:modal-append-to-body="false" :modal-append-to-body="false"
:title="$t('message.workType.operate')[type]"
:title="qusTitle"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="667px" width="667px"
> >
@ -174,12 +176,12 @@
<!-- 试题选项及答案 --> <!-- 试题选项及答案 -->
<el-form-item :label="$t('message.safetyEducation.optionsAndAnswers')"> </el-form-item> <el-form-item :label="$t('message.safetyEducation.optionsAndAnswers')"> </el-form-item>
<!-- 单选 --> <!-- 单选 -->
<el-radio-group v-model="radio1" @change="checkedVal"> <el-radio-group v-model="radio1" v-if="radioShow" @change="checkedVal">
<el-form-item <el-form-item
prop="lsit" prop="lsit"
v-for="(item, index) in addEditForm.optionList" v-for="(item, index) in addEditForm.optionList"
:key="index" :key="index"
v-if="addEditForm.questionType != '2'" v-show="addEditForm.questionType != '2'"
> >
<template slot="label"> <template slot="label">
<p> <p>
@ -202,7 +204,7 @@
prop="lsit" prop="lsit"
v-for="(item, index) in addEditForm.optionList" v-for="(item, index) in addEditForm.optionList"
:key="index" :key="index"
v-if="addEditForm.questionType == '2'" v-show="addEditForm.questionType == '2'"
> >
<template slot="label"> <template slot="label">
<p> <p>
@ -310,7 +312,9 @@ export default {
props:['eduId','classifyId'], props:['eduId','classifyId'],
data() { data() {
return { return {
radio1:'', qusTitle:"添加试题",
radioShow:true,
radio1:-1,
styleType: 1, styleType: 1,
ruleForm: { ruleForm: {
eduAddr: "", eduAddr: "",
@ -453,6 +457,14 @@ export default {
// deep:true, // deep:true,
// } // }
// }, // },
watch:{
'radio1':{
handler(newVal,oldVal){
console.log(newVal,oldVal)
},
immediate:true,
}
},
methods: { methods: {
// //
createQRcode(index){ createQRcode(index){
@ -511,23 +523,36 @@ export default {
this.addEditForm.optionList.splice(index, 1); this.addEditForm.optionList.splice(index, 1);
}, },
editBefore(data,index){ editBefore(data,index){
this.qusTitle = "编辑试题"
this.dialogVisible=true this.dialogVisible=true
console.log(data) console.log('编辑回显的信息',data)
this.$nextTick(()=>{ this.$nextTick(()=>{
this.addEditForm=JSON.parse(JSON.stringify(data)) this.addEditForm=JSON.parse(JSON.stringify(data))
var optionList=data.optionList var optionList=data.optionList
this.questionIndex=index this.questionIndex=index
optionList.forEach((element,index) => { //
if(data.questionType == 2){
optionList.forEach((element,index) => {
if(element.correctType==1){ if(element.correctType==1){
this.addEditForm.optionList[index].correctType=true this.addEditForm.optionList[index].correctType=true
}else{ }else{
this.addEditForm.optionList[index].correctType=false this.addEditForm.optionList[index].correctType=false
} }
}); });
}) }else{
optionList.forEach((item,index) => {
if(item.correctType==1){
this.radioShow =false
this.$nextTick(()=>{
this.radio1 = index
this.radioShow = true
})
}else{
this.radio1 = -1
}
})
}
})
}, },
deleteBefore(index){ deleteBefore(index){
this.$confirm(this.$t('message.safetyEducation.determineDelete'), this.$t('message.safetyEducation.tips'), { this.$confirm(this.$t('message.safetyEducation.determineDelete'), this.$t('message.safetyEducation.tips'), {
@ -548,7 +573,7 @@ export default {
}, },
checkedVal(val){ checkedVal(val){
console.log('当前选择的值',val) // console.log('',val)
console.log('当前绑定的值',this.radio1) console.log('当前绑定的值',this.radio1)
}, },
saveQuesFn() { saveQuesFn() {
@ -602,7 +627,7 @@ export default {
}else{ }else{
this.ruleForm.questionList[this.questionIndex]=data this.ruleForm.questionList[this.questionIndex]=data
} }
this.radio1='' this.radio1=-1
this.dialogVisible=false this.dialogVisible=false
this.computeTotalScore() this.computeTotalScore()
} else { } else {