Browse Source

三力测试结构修改1

JXDS18FUJT 1 year ago
parent
commit
7eef8e7f9f
2 changed files with 100 additions and 103 deletions
  1. 2 2
      src/otherPages/beforeThreeExam/index.vue
  2. 98 101
      src/otherPages/threeExam/index.vue

+ 2 - 2
src/otherPages/beforeThreeExam/index.vue

@@ -70,7 +70,7 @@
               </view>
             </view>
             <view class="mid1-submit-continue-button1">
-              开始考试
+              开始练习
             </view>
           </view>
         </navigator>
@@ -191,7 +191,7 @@ export default {
   .mid1 {
 
     width: 690rpx;
-    padding-bottom: 60rpx;
+
     margin: 0 auto;
     padding-top: 40rpx;
     background-size: 100%;

+ 98 - 101
src/otherPages/threeExam/index.vue

@@ -10,24 +10,28 @@
           problemList[problemListIndex].question
         }}</text
       > -->
-      <rich-text style="font-size: 42rpx; vertical-align: top" :nodes="createProblemTypeHtml(problemList[problemListIndex].type) +
+      <rich-text style="font-size: 42rpx; vertical-align: top" :nodes="createProblemTypeHtml(problemList[problemListIndex].questionType) +
         (problemListIndex + 1) +
         '、' +
         problemList[problemListIndex].issue
         "></rich-text>
-
+      <!-- <span class="problem-type">{{
+        problemList[problemListIndex].questionType | questionType
+      }}</span>
+        <span style="font-size: 30rpx;">
+          {{ problemListIndex+1 }}  {{  problemList[problemListIndex].issue }}
+        </span> -->
       <view class="problem-media">
-        <image mode="widthFix" v-if="getFileType(problemList[problemListIndex].mediaUrl) == 'image'"
-          :src="problemList[problemListIndex].mediaUrl"></image>
-        <video :controls="false" autoplay loop v-if="getFileType(problemList[problemListIndex].mediaUrl) == 'video'"
-          :src="problemList[problemListIndex].mediaUrl"></video>
+        <image mode="widthFix" v-if="getFileType(problemList[problemListIndex].image) == 'image'"
+          :src="problemList[problemListIndex].image"></image>
+        <video :controls="false" autoplay loop v-if="getFileType(problemList[problemListIndex].image) == 'video'"
+          :src="problemList[problemListIndex].image"></video>
       </view>
       <view class="problem-radio">
         <van-radio-group v-if="!problemList[problemListIndex].isComplete" @change="changeUserAnswer"
           :value="problemList[problemListIndex].userAnswer">
-          <view :key="index" v-for="(item, index) in anLength">
-            <van-radio v-if="problemList[problemListIndex]['an' + (index + 1)]" label-class="pl0" custom-class="mt40"
-              use-icon-slot :name="index + 1">
+          <view :key="index" v-for="(item, index) in problemList[problemListIndex].optsArr">
+            <van-radio label-class="pl0" custom-class="mt40" use-icon-slot :name="item">
               <view class="problem-radio-flex">
                 <view class="problem-radio-icon">
                   <view class="problem-radio-letter">{{
@@ -38,7 +42,7 @@
                     font-size: 42rpx;
                     font-weight: bold;
                     margin-left: 20rpx;
-                  ">{{ problemList[problemListIndex]["an" + (index + 1)] }}</text>
+                  ">{{ item }}</text>
               </view>
             </van-radio>
           </view>
@@ -160,20 +164,20 @@
         </van-radio-group>
         <van-radio-group v-if="problemList[problemListIndex].isComplete"
           :value="problemList[problemListIndex].userAnswer">
-          <view :key="index" v-for="(item, index) in anLength">
-            <van-radio v-if="problemList[problemListIndex]['an' + (index + 1)]" label-class="pl0" custom-class="mt40"
-              use-icon-slot :name="index + 1">
+          <view :key="index" v-for="(item, index) in problemList[problemListIndex].optsArr">
+            <van-radio  label-class="pl0" custom-class="mt40"
+              use-icon-slot :name="item">
               <view class="problem-radio-flex">
                 <view class="problem-radio-icon">
-                  <icon type="clear" v-if="index + 1 ==
-        problemList[problemListIndex].userAnswerIndex &&
-        problemList[problemListIndex].userAnswerIndex !=
-        problemList[problemListIndex].answertrue
+                  <icon type="clear" v-if="item ==
+        problemList[problemListIndex].userAnswer &&
+        problemList[problemListIndex].userAnswer !=
+        problemList[problemListIndex].answer
         " class="problem-radio-letter" color="red" size="60rpx"></icon>
-                  <icon type="success" v-else-if="index + 1 ==
-        problemList[problemListIndex].userAnswerIndex &&
-        problemList[problemListIndex].userAnswerIndex ==
-        problemList[problemListIndex].answertrue
+                  <icon type="success" v-else-if="item ==
+        problemList[problemListIndex].userAnswer &&
+        problemList[problemListIndex].userAnswer ==
+        problemList[problemListIndex].answer
         " class="problem-radio-letter" color="#33CDA4" size="60rpx"></icon>
                   <view v-else class="problem-radio-letter">{{
         numberToLetter(index)
@@ -183,7 +187,7 @@
                     font-size: 42rpx;
                     font-weight: bold;
                     margin-left: 20rpx;
-                  ">{{ problemList[problemListIndex]["an" + (index + 1)] }}</text>
+                  ">{{ item }}</text>
               </view>
             </van-radio>
           </view>
@@ -293,7 +297,7 @@
         </view>
       </view>
     </van-popup>
-    <van-overlay :zIndex="1007" round :show="selectQuestionVisible">
+    <van-popup :zIndex="1007" round :close-on-click-overlay="true" :show="selectQuestionVisible" position="bottom">
       <view class="select-problem">
         <view class="problem-index">
           <view class="problem-header">
@@ -344,7 +348,7 @@
           </view>
         </view>
       </view>
-    </van-overlay>
+    </van-popup>
   </view>
 </template>
 
@@ -361,74 +365,36 @@ export default {
       anLength: 7,
       problemList: [
         {
-          an1: "红色",
-          an2: "黄色",
-          an3: "紫色",
-          an4: "绿色",
-          an5: "",
-          an6: "",
-          an7: "",
-          answertrue: "1",
-          bestExplainNew: "图中信号灯亮的是红灯。",
-          bestanswerid: "1351372021270892544",
-          chapterid: 0,
-          cityid: 0,
-          diffDegree: 3,
-          errorRate: 0,
-          explain: "图中信号灯亮的是红灯。",
-          gs: "test",
-          id: 26852,
-          intnumber: "",
-          jieshiFrom: "",
-          kemu: 1,
-          keyword: "",
-          licensetype: "",
-          mediaUrl:
-            "https://t1-1305573081.file.myqcloud.com/yd/app/media/26852-1606813820528.webp",
-          moretypes: "",
-          question: "下图中指示灯的颜色是什么?",
-          questionSource: 3,
-          showOptionType: 0,
-          sinaimg: "26852-1606813820528.webp",
-          strtppe: "87",
-          strtypeL: "8701",
-          type: 2,
-          videoUrl: "",
-        },
-        {
-          id: 26855,
-          type: 2,
-          intnumber: "",
-          strtppe: "87",
-          strtypeL: "8701",
-          licensetype: "",
-          question: "100-6-6-6=?",
-          an1: "82",
-          an2: "60",
-          an3: "76",
-          an4: "48",
-          an5: "",
-          an6: "",
-          an7: "",
-          answertrue: "1",
-          explain: "100-6-6-6=82",
-          bestanswerid: "1333679685615247360",
-          kemu: 1,
-          jieshiFrom: "",
-          moretypes: "",
-          chapterid: 0,
-          sinaimg: "",
-          videoUrl: "",
-          diffDegree: 1,
-          cityid: 0,
-          gs: "test",
-          keyword: "",
-          errorRate: 0,
-          mediaUrl: "",
-          showOptionType: 0,
-          questionSource: 3,
-          bestExplainNew: "100-6-6-6=82",
-        },
+          answer: "×",
+          answerkeyword: "",
+          answermp3: "https://sucai.kuaitongjiakao.com/mp3/answer120004.mp3",
+          chapterId: null,
+          columnAll: "0,4000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
+          createTime: "2024-03-14 11:47:35",
+          diffDegree: null,
+          errorRate: null,
+          explainGif: "",
+          explainJq: "注意.题中问的是“文字”的颜色,图中的文字是“紫”,文字的颜色是黄色",
+          explainJs: "注意.题中问的是“文字”的颜色,图中的文字是“紫”,文字的颜色是黄色",
+          explainMp3: "https://sucai.kuaitongjiakao.com/mp3/explain120004.mp3",
+          explainjsmp3: "https://sucai.kuaitongjiakao.com/mp3/explainJS120004.mp3",
+          id: 120004,
+          idYdt: null,
+          image: "https://sucai.app.kuaitongjiakao.com/kuaitong/issue_xin/image/image120004.jpg",
+          imageYdt: "",
+          isNew: 0,
+          issue: "下图文字的颜色是红色。",
+          issuemp3: "https://sucai.kuaitongjiakao.com/mp3/issue120004.mp3",
+          model: "cart",
+          number: 120000,
+          opts: "√-×",
+          optsArr: ["√", "×"],
+          questionType: 1,
+          skillkeyword: "",
+          subject: "9",
+          titlekeyword: "",
+          updateTime: "2024-03-15 14:08:45"
+        }
       ],
       trueNum: 0,
       falseNum: 0,
@@ -454,8 +420,12 @@ export default {
       }).then((res) => {
         if (Array.isArray(res.rows) && res.rows.length > 0) {
           res.rows.forEach((element) => {
+            element.optsArr = [];
+            element.optsArr = element.opts.split('-');
+            element.userAnswer = ''
             element.userAnswerIndex = -1;
             element.isComplete = false;
+
           });
           this.problemList = res.rows;
         } else {
@@ -471,10 +441,33 @@ export default {
       }).then((res) => {
         if (Array.isArray(res.rows) && res.rows.length > 0) {
           res.rows.forEach((element) => {
+            element.optsArr = [];
+            element.optsArr = element.opts.split('-');
+            element.userAnswer = ''
             element.userAnswerIndex = -1;
             element.isComplete = false;
           });
           this.problemList = res.rows;
+          let key = `${uni.getStorageSync("userInfo").xcxOpenid}_threeExam_${this.query.subject}`
+          if (uni.getStorageSync(key)) {
+              uni.showModal({
+                title: "回到上次的题目",
+                content: `你上次做到第${
+                  uni.getStorageSync(key) + 1
+                }题,是否前往`,
+                success: (res) => {
+                  if (res.confirm) {
+                    this.problemListIndex =Number(uni.getStorageSync(key)) 
+                    // this.$emit(
+                    //   "update:problemListIndex",
+                    //   uni.getStorageSync(key)
+                    // );
+                  } else {
+                    uni.setStorageSync(key, 0);
+                  }
+                },
+              });
+            }
         } else {
           uni.showToast({
             icon: "error",
@@ -546,15 +539,18 @@ export default {
     },
     changeUserAnswer(e) {
       console.log(e);
-      this.problemList[this.problemListIndex].userAnswerIndex = e.detail;
-      this.problemList[this.problemListIndex].userAnswer =
-        this.problemList[this.problemListIndex]["an" + e.detail];
-
+      let key = `${uni.getStorageSync("userInfo").xcxOpenid}_threeExam_${this.query.subject}`
+      // this.problemList[this.problemListIndex].userAnswerIndex = e.detail;
+      // this.problemList[this.problemListIndex].userAnswer =
+      //   this.problemList[this.problemListIndex]["an" + e.detail];
+      this.problemList[this.problemListIndex].userAnswer = e.detail
       this.problemList[this.problemListIndex].isComplete = true;
-      this.problemList[this.problemListIndex].userAnswerIndex ==
-        this.problemList[this.problemListIndex].answertrue
-        ? this.trueNum++
-        : this.falseNum++;
+      this.problemList[this.problemListIndex].userAnswer == this.problemList[this.problemListIndex].answer ? this.trueNum++ : this.falseNum++;
+      uni.setStorageSync(key,this.problemListIndex)
+      // this.problemList[this.problemListIndex].userAnswerIndex ==
+      //   this.problemList[this.problemListIndex].answertrue
+      //   ? this.trueNum++
+      //   : this.falseNum++;
     },
     prePage(e) {
       if (this.problemListIndex <= 0) {
@@ -588,6 +584,7 @@ export default {
       }
     },
   },
+
   components: {
     countDown,
   },
@@ -614,7 +611,6 @@ export default {
 .select-problem {
   display: flex;
   width: 100vw;
-  height: 100vh;
   align-content: flex-end;
   align-items: flex-end;
 
@@ -733,6 +729,7 @@ export default {
   height: 500rpx;
   flex-grow: 1;
   overflow-y: scroll;
+  padding-bottom: 30rpx;
 
   .problem-type {
     font-size: 22rpx;