闫增涛
2024-11-21 cc467a98ee4db210fe41a749546e45ff7240c652
src/components/examinations/index.vue
@@ -12,9 +12,14 @@
        <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 v-html="item.catalogName"></span>
      </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"
@@ -33,17 +38,17 @@
              </span>
              <!-- 听力进度条 -->
              <!-- <answerAudioPlayer :audioUrl="value.src" v-show="item.name == '听力题'" /> -->
              <!-- 仅文字 -->
              <p
                class="titleText text-fl"
                v-if="
                  value.stemStyle == 'Txt' && value.questionType != 'completion' &&  value.questionType !='dropdown'
                  value.stemStyle == 'Txt' &&
                  value.questionType != 'completion' &&
                  value.questionType != 'dropdown'
                "
                :id="value.id"
                v-html="value.stem.stemTxt"
              >
              </p>
              ></p>
              <!-- 仅图片 -->
              <el-image
                class="stemImg"
@@ -56,8 +61,7 @@
                class="stemTxtAndImage titleText"
                v-else-if="value.stemStyle == 'TxtAndImage'"
              >
                <span v-html="value.stem.stemTxt">
                </span>
                <span v-html="value.stem.stemTxt"> </span>
                <el-image
                  :src="getPublicImage(value.stem.stemImage, 150)"
                  :preview-src-list="[getPublicImage(value.stem.stemImage)]"
@@ -83,6 +87,13 @@
                    :disabled="value.isComplete"
                    :style="{ backgroundColor: inputBc }"
                  />
                  <!-- <math-field
                    v-else
                    class="mathField"
                    :menuItems="[]"
                    @input="onChangeInput"
                  >
                  </math-field> -->
                </span>
              </p>
              <!-- 富文本 -->
@@ -103,30 +114,28 @@
                    v-html="itemText"
                    class="input-txt"
                  ></span>
                  <el-select
                    v-else
                    v-model="value.userAnswer"
                  <select
                    v-else
                    v-model="value.userAnswer"
                    :disabled="value.isComplete"
                  >
                    <el-option
                      v-for="citem in value.option"
                      :key="citem.index"
                      :label="citem.txt"
                      :value="citem.value"
                    >
                    </el-option>
                  </el-select>
                    <option
                      v-for="(citem, cindex) in value.option"
                      :key="cindex + 'dropdown'"
                      :label="citem"
                      :value="citem"
                    ></option>
                  </select>
                </span>
              </p>
            </div>
            <img
            <!-- <img
              :src="value.isCollect ? isHeart : heart"
              alt=""
              class="collect-png"
              @click="setCollect(nindex, index)"
              v-if="!(hideCollect && value.questionType == 'shortAnswer')"
            />
            /> -->
            <!-- 收藏 -->
          </div>
          <div class="questionContent">
@@ -240,17 +249,16 @@
              </el-checkbox>
            </el-checkbox-group>
            <!-- 简答 翻译 -->
            <!-- <TEditorVue
            v-else-if="value.questionType == 'shortAnswer'"
            :value="value.userAnswer"
            :disabled="value.isComplete"
            @getContent="
              (val) => {
                value.userAnswer = val.trim();
                inputChange();
              }
            "
          ></TEditorVue> -->
            <TEditorVue
              v-else-if="value.questionType == 'formula'"
              :value="value.userAnswer"
              :disabled="value.isComplete"
              @getContent="
                (val) => {
                  value.userAnswer = val;
                }
              "
            />
            <el-input
              :disabled="value.isComplete"
              style="width: 94%; margin: 0 auto"
@@ -277,9 +285,11 @@
            <div class="analysis" v-if="value.isComplete">
              <el-collapse
                v-model="value.isUnfold"
                @change="handleChange(value)"
                accordion
                v-if="value.questionType != 'shortAnswer'"
                v-if="
                  value.questionType != 'shortAnswer' &&
                  value.questionType != 'formula'
                "
              >
                <el-collapse-item :name="value.id" class="objective">
                  <template #title>
@@ -378,8 +388,8 @@
                  ></div>
                  <div v-else>暂无数据</div>
                </el-collapse-item>
                <!-- 主观题 -->
              </el-collapse>
              <!-- 主观题 -->
              <el-collapse v-else v-model="value.isUnfold" accordion>
                <el-collapse-item :name="value.id" class="objective">
                  <template #title>
@@ -407,7 +417,6 @@
                  <div class="referBox" v-if="value.analysisCon">
                    <span>解析:</span>
                    <p
                      v-if="value.analysisCon"
                      v-html="value.analysisCon"
                      :class="
                        [
@@ -417,7 +426,6 @@
                        ].join(' ')
                      "
                    ></p>
                    <p v-else class="ti-2">暂无数据</p>
                  </div>
                </el-collapse-item>
              </el-collapse>
@@ -514,9 +522,12 @@
</template>
<script>
  import { MathfieldElement } from "mathlive"
import { Message } from "element-ui";
import TEditorVue from "../teditor/index.vue";
export default {
  name: "examination-option",
  components: { TEditorVue },
  props: {
    cardList: {
      type: Array,
@@ -595,12 +606,18 @@
  methods: {
    // 获取不受保护的图片
    getPublicImage(md5, width, height) {
      if(!md5) return
      if(md5.includes('http')) return md5
      if (!md5) return;
      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}`;
      }
      }
      if (width) src += `&width=${width}`;
      if (height) src += `&height=${height}`;
      return src;
@@ -685,8 +702,8 @@
            }
          } else if (
            citem.questionType == "singleChoice" ||
            citem.questionType == "judge" ||
            citem.questionType == 'dropdown'
            citem.questionType == "judge" ||
            citem.questionType == "dropdown"
          ) {
            citem.isRight = citem.answer == citem.userAnswer;
          } else if (citem.questionType == "shortAnswer") {
@@ -892,15 +909,17 @@
        })
        .catch(() => {});
    },
    onChangeInput(e) {
      console.log(e.target.value);
    }
  },
};
</script>
<style lang="less" >
  .titleText img {
    max-width: 80%;
  }
<style lang="less">
.titleText img {
  max-width: 80%;
}
</style>
<style lang="less" scoped>
@@ -908,7 +927,9 @@
  text-indent: 1em !important;
  font-size: 16px;
}
.catalogImage {
  width: 50%;
}
.examination {
  min-height: 100px;
  ul {
@@ -1045,9 +1066,9 @@
      font-weight: bold;
    }
    .text-fl {
      display:flex;
      align-items:center;
      flex-wrap:wrap;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
    }
    .titleText {
      text-align: left;
@@ -1067,7 +1088,10 @@
        font-weight: 400;
        margin-top: 6px;
      }
      select {
        outline: none;
        min-width: 100px;
      }
      input {
        width: 140px;
        height: 24px;
@@ -1102,6 +1126,9 @@
    width: 21px;
    height: 21px;
  }
  .mathField {
    min-width: 200px;
  }
}
/** 选项 */