Browse Source

Merge branch 'master' of https://git.cocorobo.cn/CocoRoboLabs/pbl-app

lsc 1 year ago
parent
commit
a13bcb3249
1 changed files with 18 additions and 2 deletions
  1. 18 2
      src/views/testDetail/components/choice.vue

+ 18 - 2
src/views/testDetail/components/choice.vue

@@ -19,13 +19,23 @@
       <div class="choices">
         <div class="choice" v-for="(item, index) in checkJson.array" :key="index">
           <div class="choice_c" v-if="checkJson.type == 2">
-            <el-checkbox v-model="checkJson.answer2" :label="index" :disabled="checktype == 2"></el-checkbox
+            <el-checkbox
+              v-model="checkJson.answer2"
+              :label="index"
+              @change="changeJson"
+              :disabled="checktype == 2"
+            ></el-checkbox
             ><span :class="{ right: see && cJson.answer.indexOf(index) != -1 }" @click="check(checkJson.type, index)">{{
               item.option
             }}</span>
           </div>
           <div class="choice_c" v-if="checkJson.type == 1">
-            <el-radio v-model="checkJson.answer2[0]" :label="index" :disabled="checktype == 2"></el-radio
+            <el-radio
+              v-model="checkJson.answer2[0]"
+              :label="index"
+              @change="changeJson"
+              :disabled="checktype == 2"
+            ></el-radio
             ><span :class="{ right: see && cJson.answer.indexOf(index) != -1 }" @click="check(checkJson.type, index)">{{
               item.option
             }}</span>
@@ -94,6 +104,11 @@ export default {
     }
   },
   methods: {
+    changeJson() {
+      this.$forceUpdate()
+      this.$emit('update:cJson', this.checkJson)
+      this.$forceUpdate()
+    },
     depthCopy(s) {
       return JSON.parse(JSON.stringify(s))
     },
@@ -110,6 +125,7 @@ export default {
       } else if (type == 1) {
         this.checkJson.answer2[0] = index
       }
+      this.$emit('update:cJson', this.checkJson)
       this.$forceUpdate()
     }
   },