From 2d7f36bc2b00c7e8aaa2964834a911dcf400c8a7 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期五, 13 十二月 2024 18:56:54 +0800
Subject: [PATCH] 民航服务基本技能

---
 src/components/examinations/index.vue |  144 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 114 insertions(+), 30 deletions(-)

diff --git a/src/components/examinations/index.vue b/src/components/examinations/index.vue
index 095c41d..e99c446 100644
--- a/src/components/examinations/index.vue
+++ b/src/components/examinations/index.vue
@@ -7,14 +7,28 @@
       v-show="item.infoList.length"
     >
       <p class="catalogName" :style="{ color: primaryColor }">
-        <span v-if="nindex == 0">涓�銆�</span>
-        <span v-if="nindex == 1">浜屻��</span>
-        <span v-if="nindex == 2">涓夈��</span>
-        <span v-if="nindex == 3">鍥涖��</span>
-        <span v-if="nindex == 4">浜斻��</span>
-        <span v-html="item.catalogName"></span>
+        <span class="catalogName-box">
+          <span v-if="nindex == 0">涓�銆�</span>
+          <span v-if="nindex == 1">浜屻��</span>
+          <span v-if="nindex == 2">涓夈��</span>
+          <span v-if="nindex == 3">鍥涖��</span>
+          <span v-if="nindex == 4">浜斻��</span>
+          <span v-html="item.catalogName"></span>
+        </span>
+        <img
+          :src="item.isCollect ? isHeart : heart"
+          alt=""
+          class="collect-png"
+          @click="setCollect(nindex, index)"
+          v-if="!hideCollect && item.type == 'material'"
+        />
       </p>
-      <el-image v-if="item.catalogImage" :src="item.catalogImage"></el-image>
+      <el-image
+        v-if="item.catalogImage"
+        :src="item.catalogImage"
+        :preview-src-list="[item.catalogImage]"
+        class="catalogImage"
+      ></el-image>
       <ul>
         <li
           v-for="(value, index) in item.infoList"
@@ -27,7 +41,11 @@
               <span
                 class="questionNum"
                 :style="{
-                  marginTop: value.questionType == 'completion' ? '12px' : '0',
+                  marginTop:
+                    value.questionType == 'completion' ||
+                    value.questionType == 'mathField'
+                      ? '12px'
+                      : '0',
                 }"
                 >{{ index + 1 }}.
               </span>
@@ -39,7 +57,8 @@
                 v-if="
                   value.stemStyle == 'Txt' &&
                   value.questionType != 'completion' &&
-                  value.questionType != 'dropdown'
+                  value.questionType != 'dropdown' &&
+                  value.questionType != 'mathField'
                 "
                 :id="value.id"
                 v-html="value.stem.stemTxt"
@@ -64,7 +83,13 @@
                 ></el-image>
               </p>
               <!-- 濉┖棰橀骞� -->
-              <p class="titleText" v-if="value.questionType == 'completion'">
+              <p
+                class="titleText"
+                v-if="
+                  value.questionType == 'completion' ||
+                  value.questionType == 'mathField'
+                "
+              >
                 <span
                   v-for="(itemText, indexText) in value.stem"
                   :key="indexText + 'questionType'"
@@ -75,13 +100,27 @@
                     class="input-txt"
                   ></span>
                   <input
-                    v-else
+                    v-if="
+                      typeof itemText != 'string' &&
+                      value.questionType == 'completion'
+                    "
                     type="text"
                     class="input"
                     v-model.trim="value.userAnswer[itemText.num]"
                     :disabled="value.isComplete"
                     :style="{ backgroundColor: inputBc }"
                   />
+                  <math-field
+                    v-if="
+                      typeof itemText != 'string' &&
+                      value.questionType == 'mathField'
+                    "
+                    class="mathField"
+                    :menuItems="[]"
+                    @input="onChangeInput($event, nindex, index, itemText.num)"
+                  >
+                    {{ value.userAnswer[itemText.num] }}
+                  </math-field>
                 </span>
               </p>
               <!-- 瀵屾枃鏈� -->
@@ -102,19 +141,18 @@
                     v-html="itemText"
                     class="input-txt"
                   ></span>
-                  <el-select
+                  <select
                     v-else
                     v-model="value.userAnswer"
                     :disabled="value.isComplete"
                   >
-                    <el-option
+                    <option
                       v-for="(citem, cindex) in value.option"
                       :key="cindex + 'dropdown'"
                       :label="citem"
                       :value="citem"
-                    >
-                    </el-option>
-                  </el-select>
+                    ></option>
+                  </select>
                 </span>
               </p>
             </div>
@@ -123,7 +161,7 @@
               alt=""
               class="collect-png"
               @click="setCollect(nindex, index)"
-              v-if="!(hideCollect && value.questionType == 'shortAnswer')"
+              v-if="!hideCollect && item.type != 'material'"
             />
             <!-- 鏀惰棌 -->
           </div>
@@ -263,7 +301,8 @@
                 type != 'mock' &&
                 (value.questionType == 'shortAnswer' ||
                   value.questionType == 'multipleChoice' ||
-                  value.questionType == 'completion')
+                  value.questionType == 'completion' ||
+                  value.questionType == 'mathField')
               "
             >
               <el-button @click="checkPares(value)" style="margin-top: 10px"
@@ -276,7 +315,7 @@
                 v-model="value.isUnfold"
                 accordion
                 v-if="
-                  value.questionType != 'shortAnswer' ||
+                  value.questionType != 'shortAnswer' &&
                   value.questionType != 'formula'
                 "
               >
@@ -406,7 +445,6 @@
                   <div class="referBox" v-if="value.analysisCon">
                     <span>瑙f瀽锛�</span>
                     <p
-                      v-if="value.analysisCon"
                       v-html="value.analysisCon"
                       :class="
                         [
@@ -416,7 +454,6 @@
                         ].join(' ')
                       "
                     ></p>
-                    <p v-else class="ti-2">鏆傛棤鏁版嵁</p>
                   </div>
                 </el-collapse-item>
               </el-collapse>
@@ -513,6 +550,7 @@
 </template>
 
 <script>
+import { MathfieldElement } from "mathlive";
 import { Message } from "element-ui";
 import TEditorVue from "../teditor/index.vue";
 export default {
@@ -597,7 +635,13 @@
     // 鑾峰彇涓嶅彈淇濇姢鐨勫浘鐗�
     getPublicImage(md5, width, height) {
       if (!md5) return;
-      if (md5.includes("http")) return md5;
+      if (md5.includes("http")) {
+        if (width) {
+          return md5 + `?width=${width}`;
+        } else {
+          return md5;
+        }
+      }
       let src = null;
       if (md5) {
         src = process.env.VUE_APP_API_URL + `/file/GetPreViewImage?md5=${md5}`;
@@ -642,7 +686,18 @@
         const item = this.cardData[index];
         for (let cindex = 0; cindex < item.infoList.length; cindex++) {
           const citem = item.infoList[cindex];
-          citem.userAnswer = "";
+          if (typeof citem.userAnswer == "string") {
+            citem.userAnswer = "";
+          } else {
+            if (citem.questionType == "multipleChoice") {
+              citem.userAnswer = [];
+            } else {
+              // 濉┖棰�
+              for (let dindex = 0; dindex < citem.userAnswer.length; dindex++) {
+                citem.userAnswer[dindex] = "";
+              }
+            }
+          }
           citem.isComplete = false;
         }
       }
@@ -693,7 +748,10 @@
           } else if (citem.questionType == "shortAnswer") {
             // 绠�绛� 缈昏瘧
             citem.isRight = null;
-          } else if (citem.questionType == "completion") {
+          } else if (
+            citem.questionType == "completion" ||
+            citem.questionType == "mathField"
+          ) {
             // 濉┖
             if (typeof citem.answer == "string") {
               citem.isRight = citem.answer == citem.userAnswer[0];
@@ -800,8 +858,14 @@
     },
     // 棰樼洰鏀惰棌鎸夐挳,鏀惰棌鍜屽彇娑堝悓涓�鎺ュ彛锛屽彇娑堟暟缁勫噺鍘昏椤筰d
     setCollect(num, number) {
-      const item = this.cardData[num].infoList[number];
+      let item = null;
+      if (number) {
+        item = this.cardData[num].infoList[number];
+      } else {
+        item = this.cardData[num];
+      }
       item.isCollect = !item.isCollect;
+      console.log(111, item);
       if (this.cardData.length == 0) {
         this.collectList.push(item.id);
       } else {
@@ -819,7 +883,7 @@
         const item = this.allCollect[index];
         if (item.type == this.sourceType) item.collectList = this.collectList;
       }
-      // console.log(this.allCollect, this.collectList, list);
+      console.log("鐐瑰嚮鏀惰棌鎸夐挳", this.allCollect);
       this.MG.identity
         .setUserKey({
           setKeyRequests: [
@@ -846,6 +910,7 @@
         .then((res) => {
           try {
             const collect = JSON.parse(res[0].value);
+            console.log("鍏ㄩ儴鏀惰棌id", collect);
             if (collect.length) {
               this.collectList = collect.find(
                 (citem) => citem.type == this.sourceType
@@ -889,9 +954,11 @@
               ).errorList;
             }
           } catch (error) {}
-          console.log("閿欓鍒楄〃", this.allError);
         })
         .catch(() => {});
+    },
+    onChangeInput(e, index, cindex, num) {
+      this.cardData[index].infoList[cindex].userAnswer[num] = e.target.value;
     },
   },
 };
@@ -905,10 +972,17 @@
 
 <style lang="less" scoped>
 .catalogName {
+  display: flex;
   text-indent: 1em !important;
   font-size: 16px;
+  .catalogName-box {
+    display: inline-block;
+    width: 94%;
+  }
 }
-
+.catalogImage {
+  width: 50%;
+}
 .examination {
   min-height: 100px;
   ul {
@@ -1050,6 +1124,9 @@
       flex-wrap: wrap;
     }
     .titleText {
+      display: flex;
+      flex-wrap: wrap;
+      align-items: center;
       text-align: left;
       min-width: 90%;
       font-size: 16px;
@@ -1067,13 +1144,16 @@
         font-weight: 400;
         margin-top: 6px;
       }
-
+      select {
+        outline: none;
+        min-width: 100px;
+      }
       input {
         width: 140px;
         height: 24px;
         border: 0;
         outline: none;
-        border-bottom: 1px solid #15c0f2;
+        border-bottom: 1px solid #000;
       }
 
       /deep/ .el-textarea.is-disabled .el-textarea__inner {
@@ -1102,6 +1182,10 @@
     width: 21px;
     height: 21px;
   }
+  .mathField {
+    min-width: 200px;
+    max-width: 518px;
+  }
 }
 
 /** 閫夐」 */

--
Gitblit v1.9.1