闫增涛
2024-07-01 d0940596d5f35ef96a5818ee315f86454c3d0ab1
src/views/examination/components/list.vue
@@ -221,37 +221,30 @@
            </div>
            <!-- 提交后解析 -->
            <div class="analysis" v-if="value.isComplete">
              <el-collapse
                v-model="value.isUnfold"
                @change="handleChange(value)"
                accordion
                v-if="value.questionType != 'shortAnswer'"
              >
                <el-collapse-item :name="value.id" class="objective">
                  <template #title>
                    <div class="headerBox">
                      <div class="headerConent">
                        <!-- 正确错误标识 -->
                         <ul class="mark">
                          <li v-if="value.isRight" class="mark-correct">正确</li>
                          <li v-if="value.isRight == false" class="mark-error">错误</li>
                         </ul>
                        <p class="correct" :title="arrayToString(value.answer)">
                          <span>正确答案:</span>
                          <span v-html="arrayToString(value.answer)" class="correctBox"></span>
                        </p>
                        <p
                          :class="value.isRight ? 'correct textOverFlow' : 'error textOverFlow'"
                          :title="arrayToString(value.userAnswer)"
                          style="margin-left: 20px"
                        >
                          <span>您的答案:</span>
                          <span class="errorBox" v-if="isHaveAnswer(value.userAnswer)">{{
                            arrayToString(value.userAnswer)
                          }}</span>
                        </p>
                      </div>
                      <p class="difficulty" v-if="value.difficulty">
              <ul class="analysis-box">
                <li class="headerConent" style="width:60%">
                  <!-- 正确错误标识 -->
                    <ul class="mark">
                    <li v-if="value.isRight" class="mark-correct">正确</li>
                    <li v-if="value.isRight == false" class="mark-error">错误</li>
                    </ul>
                  <p  :title="arrayToString(value.answer)">
                    <span>【正确答案】:</span>
                    <span v-html="arrayToString(value.answer)" class="correctBox"></span>
                  </p>
                  <p
                    :class="value.isRight ? 'correct textOverFlow' : 'error textOverFlow'"
                    :title="arrayToString(value.userAnswer)"
                    style="margin-left: 20px"
                  >
                    <span>您的答案:</span>
                    <span class="errorBox" v-if="isHaveAnswer(value.userAnswer)">{{
                      arrayToString(value.userAnswer)
                    }}</span>
                  </p>
                </li>
                <li>
                  <p class="difficulty" v-if="value.difficulty">
                        <span style="color: #333">难度等级:</span>
                        <el-rate
                          v-model="value.difficulty"
@@ -261,50 +254,26 @@
                          disabled-void-color="#949494"
                        />
                      </p>
                      <!-- 正确错误图标 -->
                      <!-- <span class="mr-10">
                        <svg
                          v-if="value.isRight"
                          t="1716986419862"
                          class="icon"
                          viewBox="0 0 1820 1024"
                          version="1.1"
                          xmlns="http://www.w3.org/2000/svg"
                          p-id="18767"
                          xmlns:xlink="http://www.w3.org/1999/xlink"
                          width="40"
                          height="20"
                        >
                          <path
                            d="M1439.374222 216.007111s-169.472 56.490667-367.179852 282.443852C888.604444 703.222519 846.241185 787.949037 775.632593 900.93037 768.568889 893.866667 662.651259 689.095111 380.207407 540.814222l148.290371-141.226666s134.162963 91.790222 225.953185 261.262222c0 0 233.016889-360.116148 684.923259-536.642371v91.799704z m0 0"
                            fill="#1AFA29"
                            p-id="18768"
                          ></path>
                        </svg>
                        <svg
                          v-if="value.isRight == false"
                          t="1716987085767"
                          class="icon"
                          viewBox="0 0 1024 1024"
                          version="1.1"
                          xmlns="http://www.w3.org/2000/svg"
                          p-id="25745"
                          xmlns:xlink="http://www.w3.org/1999/xlink"
                          width="20"
                          height="20"
                        >
                          <path
                            d="M116.579135 38.64349531L38.703935 103.74399781c138.82075969 102.96027281 268.24660875 221.31426938 381.68489719 339.96758156C246.29374906 618.40145938 109.95003031 790.19602344 38.10817906 859.25288281l148.35573469 123.62658094c52.61360812-108.17625656 167.23381594-272.86683656 320.56281844-445.01635875 153.50744156 173.21056312 268.36844625 338.43166313 321.38977781 447.49243969 0 0 144.5682225-152.96636906 157.47435281-129.29729625-55.80632344-62.49011156-191.37776625-244.16501625-374.17990593-430.27403438 104.68422375-107.1132975 222.15274031-213.10127719 347.60304468-306.24740437L925.17746562 56.03842156C782.85412063 126.51895625 647.69328031 231.09093594 526.07845437 342.39755 403.34886594 226.82662719 264.46095125 116.16373719 116.579135 38.64349531L116.579135 38.64349531zM116.579135 38.64349531"
                            fill="#d81e06"
                            p-id="25746"
                          ></path>
                        </svg>
                      </span> -->
                </li>
              </ul>
              <el-collapse
                v-model="value.isUnfold"
                @change="handleChange(value)"
                accordion
                v-if="value.questionType != 'shortAnswer'"
              >
                <el-collapse-item :name="value.id" class="objective">
                  <template #title>
                    <div class="headerBox">
                      <div class="headerConent sitgBox">
                        <p v-if="!value.isUnfold">
                        <p v-if="!value.isUnfold" class="al-cn">
                          <span class="analysisColor">展开解析</span>
                          <img :src="openIcon" alt="" class="analysis-icon">
                        </p>
                        <p v-else><span class="analysisColor">收起解析</span></p>
                        <p v-else>
                          <span class="analysisColor">收起解析</span>
                          <img :src="closeIcon" alt="" class="analysis-icon">
                        </p>
                      </div>
                    </div>
                  </template>
@@ -318,11 +287,13 @@
                <el-collapse-item :name="value.id" class="objective">
                  <template #title>
                    <div class="headerBox">
                      <p v-if="!value.isUnfold">
                      <p v-if="!value.isUnfold"  class="al-cn">
                        <span class="analysisColor">展开答案与解析</span>
                        <img :src="openIcon" alt="" class="analysis-icon">
                      </p>
                      <p v-else>
                      <p v-else  class="al-cn">
                        <span class="analysisColor">收起答案与解析</span>
                        <img :src="closeIcon" alt="" class="analysis-icon">
                      </p>
                    </div>
                  </template>
@@ -346,62 +317,6 @@
                  </div>
                </el-collapse-item>
              </el-collapse>
              <!-- <div
                v-if="value.questionType == 'shortAnswer'"
                class="subjective subjectiveItem"
              >
                <div class="questionAnalysis">
                  <p class="difficulty" v-if="value.difficulty">
                    <span style="color: #333">难度等级:</span>
                    <el-rate
                      v-model="value.difficulty"
                      :max="3"
                      size="large"
                      disabled
                      disabled-void-color="#949494"
                    />
                  </p>
                  <p class="difficulty" @click="watchParsing(value)">
                    <span class="analysisColor"
                      >{{
                        value.isUnfold ? "收起答案和解析" : "查看答案与解析"
                      }}
                    </span>
                  </p>
                </div>
                <div
                  :class="
                    [
                      'analysisDetailBox',
                      value.isUnfold ? 'cartoon' : 'downCartoon',
                    ].join(' ')
                  "
                >
                  <div class="referBox">
                    <span>参考答案:</span>
                    <p
                      v-html="arrayToString(value.answer)"
                      :class="[
                        'subjectiveBox',
                        value.isUnfold ? 'showText' : 'hideText',
                      ]"
                    ></p>
                  </div>
                  <div class="referBox">
                    <span>解析:</span>
                    <p
                      v-if="value.analysisCon"
                      v-html="value.analysisCon"
                      :class="
                        ['subjectiveBox', value.isUnfold ? 'yincang' : ''].join(
                          ' '
                        )
                      "
                    ></p>
                    <p v-else>暂无数据</p>
                  </div>
                </div>
              </div> -->
            </div>
          </div>
        </li>
@@ -415,6 +330,8 @@
import { getPublicImage } from '@/assets/js/middleGround/tool.js'
import heart from '@/assets/images/examination/collectIcon.png'
import isHeart from '@/assets/images/examination/collectClickIcon.png'
import openIcon from '@/assets/images/examination/open.png'
import closeIcon from '@/assets/images/examination/close.png'
const props = defineProps({ cardList: Array, collectList: Array })
const emits = defineEmits([ 'onChangeRadio','setCollect'])
// const presentId = ref<Number>(props.collectList[0])
@@ -422,7 +339,7 @@
  // if (props.collectList) presentId.value = props.collectList[0]
})
// 数组转为字符串方法
const arrayToString = (data) => {
const arrayToString = (data:any) => {
  // 检查是否为数组
  if (Array.isArray(data)) {
    // 使用 join 方法将数组转换为字符串,默认使用逗号分隔
@@ -432,7 +349,7 @@
    return data.replace(/<[^>]*>/g, '')
  }
}
const isHaveAnswer = (data) => {
const isHaveAnswer = (data:any) => {
  if (typeof data == 'string') {
    data = data
      .replace(/<[^>]*>/g, '')
@@ -453,7 +370,7 @@
  }
}
// 收藏按钮
const handleCollect = (num,number) => {
const handleCollect = (num:number,number:number) => {
  emits('setCollect',num,number)
}
// 单选框输入
@@ -463,6 +380,9 @@
</script>
<style lang="less" scoped>
.catalogName {
  margin-top: 40px;
}
.collect-png {
  cursor: pointer;
  width: 24px;
@@ -527,6 +447,7 @@
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  .titleContent {
    width: 95%;
    display: flex;
@@ -620,34 +541,8 @@
  width: 100%;
  padding: 0 20px;
  font-size: 14px;
  background-color: #f4f4f4;
  .headerBox {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    .headerConent {
      height: 100%;
      display: flex;
      align-items: center;
      .el-image {
        width: 9px;
        height: 9px;
      }
      .correct {
        color: #1fbc1f;
        width: 200px;
        text-align: left;
      }
      .error {
        text-align: left;
        margin-left: 40px;
        width: 200px;
        color: #ee1818;
      }
    }
  }
  background-color: #E0F2FF ;
  color: #3B93FE;
  .checkAnalysis {
    cursor: pointer;
    height: 100%;
@@ -658,7 +553,7 @@
/deep/ .el-collapse-item__content {
  width: 100%;
  padding: 0 20px;
  background-color: #f4f4f4;
  background-color: #E0F2FF;
  font-size: 14px;
  color: #333;
}
@@ -710,7 +605,44 @@
    background-color: #1fbc1f;
  }
  .mark-error {
    background-color: #ee1818;
    background-color: #FF5E5E;
  }
}
.headerConent {
      height: 100%;
      display: flex;
      align-items: center;
      .el-image {
        width: 9px;
        height: 9px;
      }
      .correct {
        color: #70B503;
        width: 200px;
        text-align: left;
      }
      .error {
        text-align: left;
        margin-left: 40px;
        width: 200px;
        color: #FF5E5E;
      }
    }
.analysis-box {
  padding: 10px 0;
}
.al-cn {
  display: flex;
  align-items: center;
}
.analysis-icon {
  width: 10px;
  margin-left: 3px;
}
.el-collapse {
  background-color: red;
}
.primary-text-color {
  color: #3B93FE;
}
</style>