Quellcode durchsuchen

试卷类型可改答案

xuqiaoying vor 3 Jahren
Ursprung
Commit
fb66ce711e
5 geänderte Dateien mit 308 neuen und 185 gelöschten Zeilen
  1. 2 2
      common/request.js
  2. 145 106
      pages2/bank/questionBank.vue
  3. 74 31
      pages2/class/questionBank.vue
  4. 82 36
      pages5/examBank/index.vue
  5. 5 10
      pages5/examList/index.vue

+ 2 - 2
common/request.js

@@ -6,11 +6,11 @@ var num = 1
 //接口api   
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-// export const BASE_URL = 'http://120.79.166.78:19012' // 测试环境
+export const BASE_URL = 'http://120.79.166.78:19012' // 测试环境
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test(后端本地)
 // export const BASE_URL = 'http://192.168.1.222:5055'    //后端本地更新到222
 // export const BASE_URL = 'http://192.168.1.24:5055'    //后端本地
-export const BASE_URL = 'http://192.168.1.7:5055'    //后端本地
+// export const BASE_URL = 'http://192.168.1.7:5055'    //后端本地
 
  //图片上传api
 // export const BASE_IMG_URL = 'https://file.xyyxt.net/'     //release

+ 145 - 106
pages2/bank/questionBank.vue

@@ -63,6 +63,7 @@
                   v-for="(item, index) in bank.jsonStr"
                   :key="index"
                   class="lisSty"
+                  @click="radioSelect(item.optionsId, bankIndex)"
                 >
                   <text
                     :class="{
@@ -133,6 +134,7 @@
                   v-for="(item, index) in bank.jsonStr"
                   :key="index"
                   class="lisSty"
+                  @click="checkboxSelect(item.optionsId, bankIndex, index)"
                 >
                   <text
                     :class="{
@@ -142,7 +144,7 @@
                       wrong:
                         bankType == 1 && (bank.ques.indexOf(item.optionsId) != -1 &&
                         bank.ans.indexOf(item.optionsId) == -1),
-                      user_choose: bankType == 2 && (bank.ques.indexOf(item.optionsId) != -1),
+                      user_choose: bankType == 2 && item.checked,
                     }"
                     class="activeTI"
                   >
@@ -161,7 +163,7 @@
                 </view>
               </view>
               <view
-                v-if="!bank.ques"
+                v-if="bankType == 2 || (bankType == 1 && !bank.ques)"
                 class="submit_checkbox"
                 :class="{ disabled: !isCheckboxChecked(bank.jsonStr) }"
                 @click="checkboxSubmit(bankIndex)"
@@ -223,6 +225,7 @@
                   v-for="(item, index) in judge"
                   :key="index"
                   class="lisSty"
+                  @click="judgeSelect(index, bankIndex)"
                 >
                   <text
                     :class="{
@@ -268,8 +271,8 @@
                 <view
                   class="ans_input"
                   v-if="
-                    !bank.ques ||
-                    (!bank.ques.imageList.length && !bank.ques.text)
+                    bankType == 2 || (bankType == 1 && (!bank.ques ||
+                    (!bank.ques.imageList.length && !bank.ques.text)))
                   "
                 >
                   <view class="top flex">
@@ -398,6 +401,9 @@
                       v-for="(option, childIndex) in ansItem.optionsList"
                       :key="childIndex"
                       class="lisSty"
+                      @click="
+                        radioSelectChild(option.optionsId, ansIndex, bankIndex)
+                      "
                     >
                       <text
                         :class="{
@@ -478,7 +484,7 @@
                     </view>
                   </view>
                   <view
-                    v-if="!bank.ques[ansIndex]"
+                    v-if="bankType == 2 || (bankType == 1 && !bank.ques[ansIndex])"
                     class="submit_checkbox"
                     :class="{
                       disabled: !isCheckboxChecked(ansItem.optionsList),
@@ -491,12 +497,15 @@
                       v-for="(option, childindex) in ansItem.optionsList"
                       :key="childindex"
                       class="lisSty"
+                      @click="
+                        checkboxSelectChild(bankIndex, ansIndex, childindex)
+                      "
                     >
                       <text
                         :class="{
                           right: bankType == 1 && right(bankIndex, ansIndex, option),
                           wrong: bankType == 1 && wrong(bankIndex, ansIndex, option),
-                          user_choose: bankType == 2 && (questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1),
+                          user_choose: bankType == 2 &&  option.checked,
                         }"
                         class="activeTI"
                       >
@@ -578,6 +587,7 @@
                       v-for="(option, childindex) in judge"
                       :key="childindex"
                       class="lisSty"
+                      @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
                     >
                       <text
                         :class="{
@@ -635,9 +645,10 @@
                     <view
                       class="ans_input"
                       v-if="
-                        !bank.ques[ansIndex] ||
+                        bankType == 2 || (bankType == 1 &&
+                        (!bank.ques[ansIndex] ||
                         (!bank.ques[ansIndex].text &&
-                          !bank.ques[ansIndex].imageList.length)
+                          !bank.ques[ansIndex].imageList.length)))
                       "
                     >
                       <view class="top flex">
@@ -766,10 +777,11 @@
                 :key="index"
                 @click="changeIndex(index)"
                 :class="{
-                  isRight: isRight(item, index),
-                  isWrong: isWrong(item, index),
-                  isPart: isPart(item, index),
-                  isOver: isOver(item, index),
+                  isRight: bankType == 1 && isRight(item, index),
+                  isWrong: bankType == 1 && isWrong(item, index),
+                  isPart: bankType == 1 && isPart(item, index),
+                  isOver: bankType == 1 && isOver(item, index),
+                  check_ans: bankType == 2 && isCheck(item, index),
                 }"
                 class="liListSty"
               >
@@ -1681,45 +1693,51 @@ export default {
      * @param {Object} e单选点击
      */
     radioSelect(optionsId, bindex) {
-      if (this.questionList[bindex].ques) return;
-      this.$set(this.questionList[bindex], "ques", optionsId);
-      if ((bindex + 1) < this.questionList.length) {
-        this.current = bindex + 1
+      // if (this.questionList[bindex].ques) return;
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
       }
+      this.$set(this.questionList[bindex], "ques", optionsId);
+      // if ((bindex + 1) < this.questionList.length) {
+      //   this.current = bindex + 1
+      // }
       this.isDoOver();
 
       // 回答错误
-      if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
-        // /exam/wwrong/record 
-        this.$api
-          .examWrongRecord({
-            orderGoodsId: this.orderGoodsId,
-            examId: this.id,
-            goodsId: this.goodsId,
-            moduleExamId: this.moduleId || 0,
-            chapterExamId: this.chapterId || 0,
-            questionIds: [this.questionList[bindex].questionId],
-            recordId: this.recordId,
-          })
-          .then((res) => {});
-      } else {
-        // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
-        // if(question) {
-        // 	this.$api.wrongRecordDelete({
-        // 		"examId": +this.id,
-        // 		"goodsId": +this.goodsId,
-        // 		"questionId": this.questionList[bindex].questionId,
-        // 	}).then(res => {
-        // 	})
-        // }
-      }
+      // if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
+      //   // /exam/wwrong/record 
+      //   this.$api
+      //     .examWrongRecord({
+      //       orderGoodsId: this.orderGoodsId,
+      //       examId: this.id,
+      //       goodsId: this.goodsId,
+      //       moduleExamId: this.moduleId || 0,
+      //       chapterExamId: this.chapterId || 0,
+      //       questionIds: [this.questionList[bindex].questionId],
+      //       recordId: this.recordId,
+      //     })
+      //     .then((res) => {});
+      // } else {
+      //   // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
+      //   // if(question) {
+      //   // 	this.$api.wrongRecordDelete({
+      //   // 		"examId": +this.id,
+      //   // 		"goodsId": +this.goodsId,
+      //   // 		"questionId": this.questionList[bindex].questionId,
+      //   // 	}).then(res => {
+      //   // 	})
+      //   // }
+      // }
     },
 
     /**
      * @param {Object} e案例单选点击
      */
     radioSelectChild(optionsId, ansIndex, bindex) {
-      if (this.questionList[bindex].ques[ansIndex]) return;
+      // if (this.questionList[bindex].ques[ansIndex]) return;
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
       this.isDoOver();
     },
@@ -1728,6 +1746,9 @@ export default {
      * @param {Object} 多选点击
      */
     checkboxSelect(optionsId, bindex, index) {
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       this.$set(
         this.questionList[bindex].jsonStr[index],
         "checked",
@@ -1739,6 +1760,9 @@ export default {
      * @param {Object} 案例多选点击
      */
     checkboxSelectChild(bindex, ansIndex, childIndex) {
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       this.$set(
         this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
         "checked",
@@ -1760,7 +1784,10 @@ export default {
      */
     checkboxSubmit(bindex) {
       // console.log('')
-      if (this.questionList[bindex].ques) return;
+      // if (this.questionList[bindex].ques) return;
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       let arr = [];
       this.questionList[bindex].jsonStr.forEach((item) => {
         if (item.checked) {
@@ -1769,6 +1796,7 @@ export default {
       });
 
       if (!arr.length) {
+        delete this.questionList[bindex].ques
         uni.showToast({
           title: "请选择答案",
           icon: "none",
@@ -1779,48 +1807,43 @@ export default {
       this.$set(this.questionList[bindex], "ques", arr);
       this.isDoOver();
 
-      // let isWrong = this.questionList[bindex].ques.some(
-      //   (quesItem, quesIndex) => {
-      //     return (
-      //       this.questionList[bindex].ques[quesIndex] !=
-      //       this.questionList[bindex].ans[quesIndex]
-      //     );
-      //   }
-      // );
-      let isWrong = this.questionList[bindex].ques.some((item, i) => {
-        return this.questionList[bindex].ans.indexOf(item) == -1;
-      })
-      // 回答错误
-      if (isWrong) {
-        this.$api
-          .examWrongRecord({
-            orderGoodsId: this.orderGoodsId,
-            examId: this.id,
-            goodsId: this.goodsId,
-            moduleExamId: this.moduleId || 0,
-            chapterExamId: this.chapterId || 0,
-            questionIds: [this.questionList[bindex].questionId],
-            recordId: this.recordId,
-          })
-          .then((res) => {});
-      } else {
-        // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
-        // if(question) {
-        // 	this.$api.wrongRecordDelete({
-        // 		"examId": +this.id,
-        // 		"goodsId": +this.goodsId,
-        // 		"questionId": this.questionList[bindex].questionId,
-        // 	}).then(res => {
-        // 	})
-        // }
-      }
+      // let isWrong = this.questionList[bindex].ques.some((item, i) => {
+      //   return this.questionList[bindex].ans.indexOf(item) == -1;
+      // })
+      // // 回答错误
+      // if (isWrong) {
+      //   this.$api
+      //     .examWrongRecord({
+      //       orderGoodsId: this.orderGoodsId,
+      //       examId: this.id,
+      //       goodsId: this.goodsId,
+      //       moduleExamId: this.moduleId || 0,
+      //       chapterExamId: this.chapterId || 0,
+      //       questionIds: [this.questionList[bindex].questionId],
+      //       recordId: this.recordId,
+      //     })
+      //     .then((res) => {});
+      // } else {
+      //   // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
+      //   // if(question) {
+      //   // 	this.$api.wrongRecordDelete({
+      //   // 		"examId": +this.id,
+      //   // 		"goodsId": +this.goodsId,
+      //   // 		"questionId": this.questionList[bindex].questionId,
+      //   // 	}).then(res => {
+      //   // 	})
+      //   // }
+      // }
     },
 
     /**
      * @param {Object} 案例多选确认
      */
     checkboxSubmitChild(bindex, ansIndex) {
-      if (this.questionList[bindex].ques[ansIndex]) return;
+      // if (this.questionList[bindex].ques[ansIndex]) return;
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       let arr = [];
       this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
         (item) => {
@@ -1831,6 +1854,7 @@ export default {
       );
 
       if (!arr.length) {
+        delete this.questionList[bindex].ques[ansIndex]
         uni.showToast({
           title: "请选择答案",
           icon: "none",
@@ -1848,33 +1872,36 @@ export default {
      * 判断题
      */
     judgeSelect(index, bindex) {
-      if (this.questionList[bindex].ques) return;
+      // if (this.questionList[bindex].ques) return;
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex], "ques", index + "");
       this.isDoOver();
       // 回答错误
-      if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
-        this.$api
-          .examWrongRecord({
-            orderGoodsId: this.orderGoodsId,
-            examId: this.id,
-            goodsId: this.goodsId,
-            moduleExamId: this.moduleId || 0,
-            chapterExamId: this.chapterId || 0,
-            questionIds: [this.questionList[bindex].questionId],
-            recordId: this.recordId,
-          })
-          .then((res) => {});
-      } else {
-        // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
-        // if(question) {
-        // 	this.$api.wrongRecordDelete({
-        // 		"examId": +this.id,
-        // 		"goodsId": +this.goodsId,
-        // 		"questionId": this.questionList[bindex].questionId,
-        // 	}).then(res => {
-        // 	})
-        // }
-      }
+      // if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
+      //   this.$api
+      //     .examWrongRecord({
+      //       orderGoodsId: this.orderGoodsId,
+      //       examId: this.id,
+      //       goodsId: this.goodsId,
+      //       moduleExamId: this.moduleId || 0,
+      //       chapterExamId: this.chapterId || 0,
+      //       questionIds: [this.questionList[bindex].questionId],
+      //       recordId: this.recordId,
+      //     })
+      //     .then((res) => {});
+      // } else {
+      //   // let question = this.wrongList.find(item => item.questionId == this.questionList[bindex].questionId);
+      //   // if(question) {
+      //   // 	this.$api.wrongRecordDelete({
+      //   // 		"examId": +this.id,
+      //   // 		"goodsId": +this.goodsId,
+      //   // 		"questionId": this.questionList[bindex].questionId,
+      //   // 	}).then(res => {
+      //   // 	})
+      //   // }
+      // }
     },
 
     /**
@@ -1884,7 +1911,10 @@ export default {
      * 案例判断题
      */
     judgeSelectChild(ansindex, childindex, bindex) {
-      if (this.questionList[bindex].ques[ansindex]) return;
+      // if (this.questionList[bindex].ques[ansindex]) return;
+      if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex].ques, ansindex, childindex + "");
       this.isDoOver();
     },
@@ -2439,7 +2469,11 @@ export default {
       });
       this.isDoOver();
     },
-
+    isCheck(item, index) {
+      if (this.questionList[index].ques) {
+        return true
+      }
+    },
     isRight(item, index) {
       //单选
       if (this.questionList[index].ques) {
@@ -2670,7 +2704,7 @@ export default {
   color: #666;
   font-size: 30rpx;
 
-  &.right, &.user_choose {
+  &.right {
     color: #fff;
     background: #36c75a;
   }
@@ -2680,7 +2714,7 @@ export default {
     background: #ff3b30;
   }
 
-  &.checked {
+  &.checked, &.user_choose {
     color: #fff;
     background: #007aff;
   }
@@ -3010,6 +3044,11 @@ export default {
     color: #fff;
     background: blue;
   }
+  &.check_ans {
+    border: 1rpx solid #eeeeee;
+    color: #fff;
+    background: #007aff;
+  }
 }
 .answerInfos {
   padding: 25rpx 25rpx 25rpx 23rpx;

+ 74 - 31
pages2/class/questionBank.vue

@@ -55,6 +55,7 @@
                   v-for="(item, index) in bank.jsonStr"
                   :key="index"
                   class="lisSty"
+                  @click="radioSelect(item.optionsId, bankIndex)"
                 >
                   <text
                     :class="{
@@ -103,7 +104,7 @@
                 </view>
               </view>
               <view
-                v-if="!bank.ques"
+                v-if="bankType == 2 || (bankType == 1 && !bank.ques)"
                 class="submit_checkbox"
                 :class="{ disabled: !isCheckboxChecked(bank.jsonStr) }"
                 @click="checkboxSubmit(bankIndex)"
@@ -114,6 +115,7 @@
                   v-for="(item, index) in bank.jsonStr"
                   :key="index"
                   class="lisSty"
+                  @click="checkboxSelect(item.optionsId, bankIndex, index)"
                 >
                   <text
                     :class="{
@@ -123,7 +125,7 @@
                       wrong:
                         bankType == 1 && (bank.ques.indexOf(item.optionsId) != -1 &&
                         bank.ans.indexOf(item.optionsId) == -1),
-                      user_choose: bankType == 2 && (bank.ques.indexOf(item.optionsId) != -1),
+                      user_choose: bankType == 2 && item.checked,
                     }"
                     class="activeTI"
                   >
@@ -181,6 +183,7 @@
                   v-for="(item, index) in judge"
                   :key="index"
                   class="lisSty"
+                  @click="judgeSelect(index, bankIndex)"
                 >
                   <text
                     :class="{
@@ -219,8 +222,8 @@
                 <view
                   class="ans_input"
                   v-if="
-                    !bank.ques ||
-                    (!bank.ques.text && !bank.ques.imageList.length)
+                    bankType == 2 || (bankType == 1 && (!bank.ques ||
+                    (!bank.ques.imageList.length && !bank.ques.text)))
                   "
                 >
                   <view class="top flex">
@@ -338,6 +341,9 @@
                       v-for="(option, childIndex) in ansItem.optionsList"
                       :key="childIndex"
                       class="lisSty"
+                      @click="
+                        radioSelectChild(option.optionsId, ansIndex, bankIndex)
+                      "
                     >
                       <text
                         :class="{
@@ -403,7 +409,7 @@
                     </view>
                   </view>
                   <view
-                    v-if="!bank.ques[ansIndex]"
+                    v-if="bankType == 2 || (bankType == 1 && !bank.ques[ansIndex])"
                     class="submit_checkbox"
                     :class="{
                       disabled: !isCheckboxChecked(ansItem.optionsList),
@@ -416,12 +422,15 @@
                       v-for="(option, childindex) in ansItem.optionsList"
                       :key="childindex"
                       class="lisSty"
+                      @click="
+                        checkboxSelectChild(bankIndex, ansIndex, childindex)
+                      "
                     >
                       <text
                         :class="{
                           right: bankType == 1 && right(bankIndex, ansIndex, option),
                           wrong: bankType == 1 && wrong(bankIndex, ansIndex, option),
-                          user_choose: bankType == 2 && (questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1),
+                          user_choose: bankType == 2 && option.checked,
                         }"
                         class="activeTI"
                       >
@@ -489,6 +498,7 @@
                       v-for="(option, childindex) in judge"
                       :key="childindex"
                       class="lisSty"
+                      @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
                     >
                       <text
                         :class="{
@@ -541,9 +551,10 @@
                     <view
                       class="ans_input"
                       v-if="
-                        !bank.ques[ansIndex] ||
+                        bankType == 2 || (bankType == 1 &&
+                        (!bank.ques[ansIndex] ||
                         (!bank.ques[ansIndex].text &&
-                          !bank.ques[ansIndex].imageList.length)
+                          !bank.ques[ansIndex].imageList.length)))
                       "
                     >
                       <view class="top flex">
@@ -652,10 +663,11 @@
                 :key="index"
                 @click="changeIndex(index)"
                 :class="{
-                  isRight: isRight(item, index),
-                  isWrong: isWrong(item, index),
-                  isPart: isPart(item, index),
-                  isOver: isOver(item, index),
+                  isRight: bankType == 1 && isRight(item, index),
+                  isWrong: bankType == 1 && isWrong(item, index),
+                  isPart: bankType == 1 && isPart(item, index),
+                  isOver: bankType == 1 && isOver(item, index),
+                  check_ans: bankType == 2 && isCheck(item, index),
                 }"
                 class="liListSty"
               >
@@ -1823,12 +1835,14 @@ export default {
      * @param {Object} e单选点击
      */
     radioSelect(optionsId, bindex) {
-      console.log('单选', bindex, this.questionList[bindex])
-      if (this.questionList[bindex].ques) return;
-      this.$set(this.questionList[bindex], "ques", optionsId);
-      if ((bindex + 1) < this.questionList.length) {
-        this.current = bindex + 1
+      // if (this.questionList[bindex].ques) return;
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
       }
+      this.$set(this.questionList[bindex], "ques", optionsId);
+      // if ((bindex + 1) < this.questionList.length) {
+      //   this.current = bindex + 1
+      // }
       this.isDoOver();
     },
 
@@ -1836,7 +1850,10 @@ export default {
      * @param {Object} e案例单选点击
      */
     radioSelectChild(optionsId, ansIndex, bindex) {
-      if (this.questionList[bindex].ques[ansIndex]) return;
+      // if (this.questionList[bindex].ques[ansIndex]) return;
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
       this.isDoOver();
     },
@@ -1845,7 +1862,9 @@ export default {
      * @param {Object} 多选点击
      */
     checkboxSelect(optionsId, bindex, index) {
-      console.log('多选', bindex, index )
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       this.$set(
         this.questionList[bindex].jsonStr[index],
         "checked",
@@ -1858,6 +1877,9 @@ export default {
      * @param {Object} 案例多选点击
      */
     checkboxSelectChild(bindex, ansIndex, childIndex) {
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       this.$set(
         this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
         "checked",
@@ -1878,8 +1900,10 @@ export default {
      * @param {Object} 多选确认
      */
     checkboxSubmit(bindex) {
-      console.log('this.questionList[bindex].jsonStr:', this.questionList[bindex].jsonStr)
-      if (this.questionList[bindex].ques) return;
+      // if (this.questionList[bindex].ques) return;
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       let arr = [];
       this.questionList[bindex].jsonStr.forEach((item) => {
         if (item.checked) {
@@ -1888,6 +1912,7 @@ export default {
       });
 
       if (!arr.length) {
+        delete this.questionList[bindex].ques
         uni.showToast({
           title: "请选择答案",
           icon: "none",
@@ -1906,16 +1931,19 @@ export default {
       //     );
       //   }
       // );
-      let isWrong = this.questionList[bindex].ques.some((item, i) => {
-        return this.questionList[bindex].ans.indexOf(item) == -1;
-      })
+      // let isWrong = this.questionList[bindex].ques.some((item, i) => {
+      //   return this.questionList[bindex].ans.indexOf(item) == -1;
+      // })
     },
 
     /**
      * @param {Object} 案例多选确认
      */
     checkboxSubmitChild(bindex, ansIndex) {
-      if (this.questionList[bindex].ques[ansIndex]) return;
+      // if (this.questionList[bindex].ques[ansIndex]) return;
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       let arr = [];
       this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
         (item) => {
@@ -1926,6 +1954,7 @@ export default {
       );
 
       if (!arr.length) {
+        delete this.questionList[bindex].ques[ansIndex]
         uni.showToast({
           title: "请选择答案",
           icon: "none",
@@ -1943,8 +1972,10 @@ export default {
      * 判断题
      */
     judgeSelect(index, bindex) {
-      console.log('判断题',index, bindex )
-      if (this.questionList[bindex].ques) return;
+      // if (this.questionList[bindex].ques) return;
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex], "ques", index + "");
       this.isDoOver();
     },
@@ -1956,7 +1987,10 @@ export default {
      * 案例判断题
      */
     judgeSelectChild(ansindex, childindex, bindex) {
-      if (this.questionList[bindex].ques[ansindex]) return;
+      // if (this.questionList[bindex].ques[ansindex]) return;
+      if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex].ques, ansindex, childindex + "");
       this.isDoOver();
     },
@@ -2376,7 +2410,11 @@ export default {
       });
       this.isDoOver();
     },
-
+    isCheck(item, index) {
+      if (this.questionList[index].ques) {
+        return true
+      }
+    },
     isRight(item, index) {
       //单选
       if (this.questionList[index].ques) {
@@ -2637,7 +2675,7 @@ export default {
   color: #666;
   font-size: 30rpx;
 
-  &.right, &.user_choose {
+  &.right {
     color: #fff;
     background: #36c75a;
   }
@@ -2647,7 +2685,7 @@ export default {
     background: #ff3b30;
   }
 
-  &.checked {
+  &.checked, &.user_choose {
     color: #fff;
     background: #007aff;
   }
@@ -2977,6 +3015,11 @@ export default {
     color: #fff;
     background: blue;
   }
+  &.check_ans {
+    border: 1rpx solid #eeeeee;
+    color: #fff;
+    background: #007aff;
+  }
 }
 .answerInfos {
   padding: 25rpx 25rpx 25rpx 23rpx;

+ 82 - 36
pages5/examBank/index.vue

@@ -63,6 +63,7 @@
                   v-for="(item, index) in bank.jsonStr"
                   :key="index"
                   class="lisSty"
+                  @click="radioSelect(item.optionsId, bankIndex)"
                 >
                   <text
                     :class="{
@@ -133,6 +134,7 @@
                   v-for="(item, index) in bank.jsonStr"
                   :key="index"
                   class="lisSty"
+                  @click="checkboxSelect(item.optionsId, bankIndex, index)"
                 >
                   <text
                     :class="{
@@ -142,7 +144,7 @@
                       wrong:
                         bankType == 1 && (bank.ques.indexOf(item.optionsId) != -1 &&
                         bank.ans.indexOf(item.optionsId) == -1),
-                      user_choose: bankType == 2 && (bank.ques.indexOf(item.optionsId) != -1),
+                      user_choose: bankType == 2 && item.checked,
                     }"
                     class="activeTI"
                   >
@@ -161,7 +163,7 @@
                 </view>
               </view>
               <view
-                v-if="!bank.ques"
+                v-if="bankType == 2 || (bankType == 1 && !bank.ques)"
                 class="submit_checkbox"
                 :class="{ disabled: !isCheckboxChecked(bank.jsonStr) }"
                 @click="checkboxSubmit(bankIndex)"
@@ -223,6 +225,7 @@
                   v-for="(item, index) in judge"
                   :key="index"
                   class="lisSty"
+                  @click="judgeSelect(index, bankIndex)"
                 >
                   <text
                     :class="{
@@ -268,8 +271,8 @@
                 <view
                   class="ans_input"
                   v-if="
-                    !bank.ques ||
-                    (!bank.ques.imageList.length && !bank.ques.text)
+                    bankType == 2 || (bankType == 1 && (!bank.ques ||
+                    (!bank.ques.imageList.length && !bank.ques.text)))
                   "
                 >
                   <view class="top flex">
@@ -398,6 +401,9 @@
                       v-for="(option, childIndex) in ansItem.optionsList"
                       :key="childIndex"
                       class="lisSty"
+                      @click="
+                        radioSelectChild(option.optionsId, ansIndex, bankIndex)
+                      "
                     >
                       <text
                         :class="{
@@ -478,7 +484,7 @@
                     </view>
                   </view>
                   <view
-                    v-if="!bank.ques[ansIndex]"
+                    v-if="bankType == 2 || (bankType == 1 && !bank.ques[ansIndex])"
                     class="submit_checkbox"
                     :class="{
                       disabled: !isCheckboxChecked(ansItem.optionsList),
@@ -491,12 +497,15 @@
                       v-for="(option, childindex) in ansItem.optionsList"
                       :key="childindex"
                       class="lisSty"
+                      @click="
+                        checkboxSelectChild(bankIndex, ansIndex, childindex)
+                      "
                     >
                       <text
                         :class="{
                           right: bankType == 1 && right(bankIndex, ansIndex, option),
                           wrong: bankType == 1 && wrong(bankIndex, ansIndex, option),
-                          user_choose: bankType == 2 && (questionList[bankIndex].ques[ansIndex].indexOf(option.optionsId) != -1),
+                          user_choose: bankType == 2 && option.checked,
                         }"
                         class="activeTI"
                       >
@@ -578,6 +587,7 @@
                       v-for="(option, childindex) in judge"
                       :key="childindex"
                       class="lisSty"
+                      @click="judgeSelectChild(ansIndex, childindex, bankIndex)"
                     >
                       <text
                         :class="{
@@ -635,9 +645,10 @@
                     <view
                       class="ans_input"
                       v-if="
-                        !bank.ques[ansIndex] ||
+                        bankType == 2 || (bankType == 1 &&
+                        (!bank.ques[ansIndex] ||
                         (!bank.ques[ansIndex].text &&
-                          !bank.ques[ansIndex].imageList.length)
+                          !bank.ques[ansIndex].imageList.length)))
                       "
                     >
                       <view class="top flex">
@@ -756,10 +767,11 @@
                 :key="index"
                 @click="changeIndex(index)"
                 :class="{
-                  isRight: isRight(item, index),
-                  isWrong: isWrong(item, index),
-                  isPart: isPart(item, index),
-                  isOver: isOver(item, index),
+                  isRight: bankType == 1 && isRight(item, index),
+                  isWrong: bankType == 1 && isWrong(item, index),
+                  isPart: bankType == 1 && isPart(item, index),
+                  isOver: bankType == 1 && isOver(item, index),
+                  check_ans: bankType == 2 && isCheck(item, index),
                 }"
                 class="liListSty"
               >
@@ -1695,12 +1707,16 @@ export default {
      * @param {Object} e单选点击
      */
     radioSelect(optionsId, bindex) {
-      console.log('222', this.questionList)
-      if (this.questionList[bindex].ques) return;
-      this.$set(this.questionList[bindex], "ques", optionsId);
-      if ((bindex + 1) < this.questionList.length) {
-        this.current = bindex + 1
+      // if (this.questionList[bindex].ques) return;
+      // 类型为考试的可以重新在选择答案
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
       }
+      this.$set(this.questionList[bindex], "ques", optionsId);
+      // if ((bindex + 1) < this.questionList.length) {
+      //   this.current = bindex + 1
+      // }
+      console.log('改变后:', this.questionList[bindex].ques)
       this.isDoOver();
     },
 
@@ -1708,8 +1724,10 @@ export default {
      * @param {Object} e案例单选点击
      */
     radioSelectChild(optionsId, ansIndex, bindex) {
-      console.log('3333', this.questionList)
-      if (this.questionList[bindex].ques[ansIndex]) return;
+      // if (this.questionList[bindex].ques[ansIndex]) return;
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
       this.isDoOver();
     },
@@ -1718,6 +1736,9 @@ export default {
      * @param {Object} 多选点击
      */
     checkboxSelect(optionsId, bindex, index) {
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       this.$set(
         this.questionList[bindex].jsonStr[index],
         "checked",
@@ -1729,6 +1750,9 @@ export default {
      * @param {Object} 案例多选点击
      */
     checkboxSelectChild(bindex, ansIndex, childIndex) {
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       this.$set(
         this.questionList[bindex].jsonStr[ansIndex].optionsList[childIndex],
         "checked",
@@ -1749,7 +1773,10 @@ export default {
      * @param {Object} 多选确认
      */
     checkboxSubmit(bindex) {
-      if (this.questionList[bindex].ques) return;
+      // if (this.questionList[bindex].ques) return;
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       let arr = [];
       this.questionList[bindex].jsonStr.forEach((item) => {
         if (item.checked) {
@@ -1758,6 +1785,7 @@ export default {
       });
 
       if (!arr.length) {
+        delete this.questionList[bindex].ques
         uni.showToast({
           title: "请选择答案",
           icon: "none",
@@ -1767,22 +1795,25 @@ export default {
 
       this.$set(this.questionList[bindex], "ques", arr);
       this.isDoOver();
-
-      let isWrong = this.questionList[bindex].ques.some(
-        (quesItem, quesIndex) => {
-          return (
-            this.questionList[bindex].ques[quesIndex] !=
-            this.questionList[bindex].ans[quesIndex]
-          );
-        }
-      );
+      console.log('this.questionList[bindex]', this.questionList[bindex].ques)
+      // let isWrong = this.questionList[bindex].ques.some(
+      //   (quesItem, quesIndex) => {
+      //     return (
+      //       this.questionList[bindex].ques[quesIndex] !=
+      //       this.questionList[bindex].ans[quesIndex]
+      //     );
+      //   }
+      // );
     },
 
     /**
      * @param {Object} 案例多选确认
      */
     checkboxSubmitChild(bindex, ansIndex) {
-      if (this.questionList[bindex].ques[ansIndex]) return;
+      // if (this.questionList[bindex].ques[ansIndex]) return;
+      if (this.questionList[bindex].ques[ansIndex] && this.bankType == 1) {
+        return
+      }
       let arr = [];
       this.questionList[bindex].jsonStr[ansIndex].optionsList.forEach(
         (item) => {
@@ -1793,6 +1824,7 @@ export default {
       );
 
       if (!arr.length) {
+        delete this.questionList[bindex].ques[ansIndex]
         uni.showToast({
           title: "请选择答案",
           icon: "none",
@@ -1810,7 +1842,10 @@ export default {
      * 判断题
      */
     judgeSelect(index, bindex) {
-      if (this.questionList[bindex].ques) return;
+      // if (this.questionList[bindex].ques) return;
+      if (this.questionList[bindex].ques && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex], "ques", index + "");
       this.isDoOver();
     },
@@ -1822,7 +1857,10 @@ export default {
      * 案例判断题
      */
     judgeSelectChild(ansindex, childindex, bindex) {
-      if (this.questionList[bindex].ques[ansindex]) return;
+      // if (this.questionList[bindex].ques[ansindex]) return;
+      if (this.questionList[bindex].ques[ansindex] && this.bankType == 1) {
+        return
+      }
       this.$set(this.questionList[bindex].ques, ansindex, childindex + "");
       this.isDoOver();
     },
@@ -2316,6 +2354,11 @@ export default {
       this.isDoOver();
     },
 
+    isCheck(item, index) {
+      if (this.questionList[index].ques) {
+        return true
+      }
+    },
     isRight(item, index) {
       //单选
       if (this.questionList[index].ques) {
@@ -2546,7 +2589,7 @@ export default {
   color: #666;
   font-size: 30rpx;
 
-  &.right, &.user_choose {
+  &.right {
     color: #fff;
     background: #36c75a;
   }
@@ -2556,7 +2599,7 @@ export default {
     background: #ff3b30;
   }
 
-  &.checked {
+  &.checked, &.user_choose {
     color: #fff;
     background: #007aff;
   }
@@ -2756,8 +2799,6 @@ export default {
       border-radius: 4rpx;
     }
   }
-  .popupContent {
-  }
 }
 .pageContent {
   position: relative;
@@ -2886,6 +2927,11 @@ export default {
     color: #fff;
     background: blue;
   }
+  &.check_ans {
+    border: 1rpx solid #eeeeee;
+    color: #fff;
+    background: #007aff;
+  }
 }
 .answerInfos {
   padding: 25rpx 25rpx 25rpx 23rpx;

+ 5 - 10
pages5/examList/index.vue

@@ -343,7 +343,6 @@ export default {
 			})
 		},
 		async goExamCount(item,index) {
-			console.log('item', item)
 			if (item.mockActivity && item.mockActivity == 1) {
 				if (!(item.activityStartTime < this.nowTime)) {
 					return
@@ -355,7 +354,8 @@ export default {
 						applyId: item.applyId,
 						duration: item.duration,
 						majorId: item.majorId,
-						subjectId: item.subjectId
+						subjectId: item.subjectId,
+						mockMajorSubjectId: item.mockMajorSubjectId
 					},
 				}).then((res) => {
 					if (res.data.code == 200) {
@@ -364,12 +364,7 @@ export default {
 						item.applySiteStartTime = startTime
 						item.applySiteEndTime = endTime
 						item.eachExamId = eachExamId
-						// item.applySiteExamTime = parseInt(new Date().getTime()/1000) // 当前时间的时间戳
-						// item.applySiteStartTime = this.$method.timestampToTime(new Date().getTime()/1000, false, false, true)
-						// let min = item.duration * 60 *1000 + new Date().getTime()
-						// item.applySiteEndTime = this.$method.timestampToTime(min/1000, false, false, true)
-						// console.log('item', item)
-						this.toJump()
+						this.toJump(item)
 					} else {
 						this.$u.toast(res.data.msg)
 						return
@@ -378,11 +373,11 @@ export default {
 				})
 				
 			} else {
-				this.toJump()
+				this.toJump(item)
 			
 			}
 		},
-		toJump() {
+		toJump(item) {
 			if(this.goTest(item)) {
 				uni.showToast({
 					icon:'none',