安全教育(添加试题):单选多选处理
This commit is contained in:
parent
24e4448ea6
commit
7e5ce78c26
@ -41,8 +41,8 @@ if (process.env.NODE_ENV == 'development') {
|
||||
// tag: 本地
|
||||
// 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.216:6023/' // 邱平毅本地
|
||||
// axios.defaults.baseURL ='http://124.71.67.160:8088/' //中建四局线上
|
||||
// axios.defaults.baseURL = 'http://192.168.34.216:6023/' // 邱平毅本地
|
||||
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.216:18070/' // 邱平毅本地
|
||||
// axios.defaults.baseURL = 'http://192.168.34.231:6023/'; //杨思瑞本地
|
||||
|
||||
@ -173,11 +173,36 @@
|
||||
</el-form-item>
|
||||
<!-- 试题选项及答案 -->
|
||||
<el-form-item :label="$t('message.safetyEducation.optionsAndAnswers')"> </el-form-item>
|
||||
<!-- 单选 -->
|
||||
<el-radio-group v-model="radio1" @change="checkedVal">
|
||||
<el-form-item
|
||||
prop="lsit"
|
||||
v-for="(item, index) in addEditForm.optionList"
|
||||
:key="index"
|
||||
v-if="addEditForm.questionType != '2'"
|
||||
>
|
||||
<template slot="label">
|
||||
<p>
|
||||
<el-radio :label="index"
|
||||
:value="item.correctType"
|
||||
>{{ indexList[index] }}、</el-radio
|
||||
>
|
||||
</p>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="item.optionName"
|
||||
:placeholder="$t('message.workType.placeholder')"
|
||||
></el-input>
|
||||
<i class="el-icon-remove" @click="removeOptions(index)"></i>
|
||||
</el-form-item>
|
||||
</el-radio-group>
|
||||
<!-- 多选 -->
|
||||
<el-form-item
|
||||
:label="'A、'"
|
||||
prop="lsit"
|
||||
v-for="(item, index) in addEditForm.optionList"
|
||||
:key="index"
|
||||
v-if="addEditForm.questionType == '2'"
|
||||
>
|
||||
<template slot="label">
|
||||
<p>
|
||||
@ -285,6 +310,7 @@ export default {
|
||||
props:['eduId','classifyId'],
|
||||
data() {
|
||||
return {
|
||||
radio1:'',
|
||||
styleType: 1,
|
||||
ruleForm: {
|
||||
eduAddr: "",
|
||||
@ -521,6 +547,10 @@ export default {
|
||||
});
|
||||
|
||||
},
|
||||
checkedVal(val){
|
||||
console.log('当前选择的值',val)
|
||||
console.log('当前绑定的值',this.radio1)
|
||||
},
|
||||
saveQuesFn() {
|
||||
this.$refs['addEditForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
@ -532,12 +562,17 @@ export default {
|
||||
return;
|
||||
}
|
||||
var correctNum = 0
|
||||
var correctOne = 0
|
||||
optionList.forEach((element,index) => {
|
||||
if(element.optionName==''){
|
||||
// 请输入选项内容
|
||||
this.$message.error(this.$t('message.safetyEducation.rulesB2'))
|
||||
return;
|
||||
}
|
||||
if(index == this.radio1){
|
||||
correctOne = 1
|
||||
data.optionList[index].correctType=1
|
||||
}
|
||||
if(element.correctType===true||element.correctType===1){
|
||||
data.optionList[index].correctType=1
|
||||
correctNum++
|
||||
@ -546,12 +581,13 @@ export default {
|
||||
}
|
||||
});
|
||||
console.log(data)
|
||||
if(data.questionType==1&&correctNum==0){
|
||||
if(data.questionType==1&&correctNum==0&&correctOne==0){
|
||||
// 请选中正确选项
|
||||
this.$message.error(this.$t('message.safetyEducation.rulesB3'))
|
||||
return;
|
||||
}
|
||||
if(data.questionType==1&&correctNum>1){
|
||||
if(data.questionType==1&&correctOne>1){
|
||||
console.log('当前是有几个',correctNum)
|
||||
// 正确选项只能是1个
|
||||
this.$message.error(this.$t('message.safetyEducation.rulesB4'))
|
||||
return;
|
||||
@ -566,7 +602,7 @@ export default {
|
||||
}else{
|
||||
this.ruleForm.questionList[this.questionIndex]=data
|
||||
}
|
||||
|
||||
this.radio1=''
|
||||
this.dialogVisible=false
|
||||
this.computeTotalScore()
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user