Jelajahi Sumber

提交预览

1
mo 3 tahun lalu
induk
melakukan
675cd85f3a

+ 2 - 0
src/views/setQuestions/operation.vue

@@ -414,6 +414,7 @@ export default {
         title: null,
         againCommitFlag: 1,
         questionnaireQuestionList: [{ questionnaireQuestionItemList: [{}] }],
+        commitType:null
       },
       disabled: false,
       questionStatus: false,
@@ -581,6 +582,7 @@ export default {
       if (!val) {
         this.form.commitType = 0;
       }
+
     },
   },
 };

+ 12 - 8
src/views/setQuestions/questionManger/component/Continuous.vue

@@ -23,7 +23,7 @@
           <van-field
             v-if="item['type'] != 'textarea'"
             :border="false"
-            :name="item.id + ''"
+            :name="item.ids + ''"
             :rules="[
               {
                 required: item['isRequire'] ? true : false,
@@ -34,7 +34,7 @@
             <template #input>
               <div style="width: 100%">
                 <van-radio-group
-                  v-model="form[item.id]"
+                  v-model="forms[item.ids]"
                   v-if="item['type'] == 'radio'"
                 >
                   <van-cell-group :border="false">
@@ -45,10 +45,10 @@
                       :key="item.id"
                       :title="item.answerValue"
                       class="teacher-item"
-                      @click="toggle(item.id || item.answerValue)"
+                      @click="toggle(item.answerValue)"
                     >
                       <template #right-icon>
-                        <van-radio :name="item.id || item.answerValue">
+                        <van-radio :name="item.answerValue">
                           <template #icon="props">
                             <!-- <img
                           class="img-icon"
@@ -71,7 +71,7 @@
                   </van-cell-group>
                 </van-radio-group>
                 <van-checkbox-group
-                  v-model="form[item.id]"
+                  v-model="forms[item.ids]"
                   v-if="item['type'] == 'checkbox'"
                 >
                   <van-cell-group :border="false">
@@ -81,7 +81,7 @@
                         'questionnaireQuestionItemList'
                       ]"
                       :clickable="true"
-                      :key="item.id || item.answerValue"
+                      :key="item.ids"
                       :title="item.answerValue"
                       class="teacher-item"
                       @click="toggle(index)"
@@ -90,7 +90,7 @@
                         <van-checkbox
                           shape="square"
                           :name="
-                            item.id ? item.id.toString() : item.answerValue
+                            item.ids ? item.ids.toString() : item.answerValue
                           "
                           ref="checkboxes"
                         >
@@ -300,11 +300,15 @@ export default {
       templateType: 2,
       questionList: [{ type: "", content: "" }],
       list: "",
+      forms:{}
     };
   },
   async mounted() {
     this.templateType = this.form.templateType;
-    this.questionList = this.form.questionnaireQuestionList;
+    this.questionList = this.form.questionnaireQuestionList.map(item=>{
+      item.ids = item.id || new Date().valueOf()+Math.random();
+      return item
+    });
   },
   computed: {
     planStatus() {

+ 25 - 8
src/views/setQuestions/questionManger/component/Progressive.vue

@@ -6,7 +6,7 @@
           <van-loading type="spinner" size="20" />
         </template>
       </van-image>
-      <h2 class="title">{{form.title}}</h2>
+      <h2 class="title">{{ form.title }}</h2>
     </div>
     <studentInfo v-if="form.loginFlag" class="studentInfo" />
     <div class="questions">
@@ -32,13 +32,13 @@
                     'questionnaireQuestionItemList'
                   ]"
                   :clickable="true"
-                  :key="item.id"
+                  :key="item.answerValue"
                   :title="item.answerValue"
                   class="teacher-item"
-                  @click="toggle(item.id||item.answerValue)"
+                  @click="toggle( item.answerValue)"
                 >
                   <template #right-icon>
-                    <van-radio :name="item.id||item.answerValue">
+                    <van-radio :name=" item.answerValue">
                       <template #icon="props">
                         <!-- <img
                           class="img-icon"
@@ -69,7 +69,7 @@
                     'questionnaireQuestionItemList'
                   ]"
                   :clickable="true"
-                  :key="item.id||item.answerValue"
+                  :key="item.answerValue"
                   :title="item.answerValue"
                   class="teacher-item"
                   @click="toggle(index)"
@@ -77,7 +77,7 @@
                   <template #right-icon>
                     <van-checkbox
                       shape="square"
-                      :name="item.id ? item.id.toString() : item.answerValue"
+                      :name="item.answerValue"
                       ref="checkboxes"
                     >
                       <template #icon="props">
@@ -414,6 +414,22 @@ export default {
         this.$toast("请回答当前问题");
         return;
       }
+      // 判断是否终止
+      let answerList = selectList.questionnaireQuestionItemList || []; //当前题的选项
+      let currentIsOver = 0; // 是否终止答题
+      this.checkBox;
+      answerList.forEach((item) => {
+        console.log(item,this.check)
+        if (selectList.type == "radio" && this.check ==item.answerValue) {
+          currentIsOver = item.isOver;
+        } else if (
+          selectList.type == "checkbox" &&
+          this.checkBox.includes(item.answerValue + "")&&!currentIsOver
+        ) {
+          currentIsOver = item.isOver;
+        }
+      });
+
       // 判断是否在题目列表里面
       if (this.currentIndex <= this.questionList.length) {
         if (selectList.type == "radio") {
@@ -436,7 +452,7 @@ export default {
           this.textarea = null;
         }
 
-        if (this.currentIndex == this.questionList.length) {
+        if (this.currentIndex == this.questionList.length || currentIsOver) {
           // try {
           //   await questionnaireUserResult({
           //     topicId: this.topicId,
@@ -1195,7 +1211,8 @@ export default {
 .noLine {
   padding: 10px 28px 16px;
 }
-/deep/.van-checkbox__icon,/deep/.van-radio__icon {
+/deep/.van-checkbox__icon,
+/deep/.van-radio__icon {
   padding: 1px;
 }
 </style>

+ 18 - 4
src/views/setQuestions/userAskList.vue

@@ -53,8 +53,8 @@
           <el-table-column
             align="center"
             :label="item.content"
-            v-for="(item, index) in tableList[0].questionnaireResultDtoList"
-            :key="item.userId"
+            v-for="(item, index) in questionList.questionnaireQuestionList"
+            :key="item.id"
           >
             <template slot-scope="scope">
               <div v-if=" scope.row.questionnaireResultDtoList[index]&&scope.row.questionnaireResultDtoList[index].type">
@@ -119,7 +119,8 @@
   </div>
 </template>
 <script>
-import { questionnaireUserResult } from "./api";
+
+import { questionnaireUserResult,  questionnaireTopicGetDetail, } from "./api";
 import { Export } from "@/utils/downLoadFile";
 import pagination from "@/components/Pagination/index";
 export default {
@@ -142,12 +143,25 @@ export default {
         total: 0, // 总条数
         page_size: [10, 20, 40, 50], // 选择限制显示条数
       },
-      loginFlag:null
+      loginFlag:null,
+      questionList:null
     };
   },
   async mounted() {
     this.loginFlag = this.$route.query.loginFlag*1
     this.getList();
+       try {
+        let res = await questionnaireTopicGetDetail({ id: this.id });
+        this.questionList = res.data;
+        this.settemplateType(res.data.templateType);
+        this.disabled = !res.data.modifyFlag;
+        // let list = res.data.questionnaireQuestionList || []
+        // list.forEach((item, index) => {
+        //     this.activeName.push(index)
+        // })
+      } catch {
+        //
+      }
   },
   methods: {
     search() {