[测评系统]--前端(用户答题页面)
yj
2025-11-27 e9d90e9ea68a2ee82869124ff092dc21f329f2b0
src/views/exam/paper/personality.vue
@@ -16,14 +16,14 @@
              <div class="align-center"><span style="font-size: small; float: left">{{$t('examinee')}}{{memberName}}</span><span style="margin-top: 0px;padding-right: 11%">●{{form.name}}●</span></div>
              <hr style="border : 1px dashed #b3d8ff;" />
              <el-form-item :key="itemOrder" label-width="1px">
                <QuestionEdit @callNextSubject="nextSubject" :qType="questionItem.questionType" :question="questionItem"
                <QuestionEdit @callSelected="callSelected" @callNextSubject="nextSubject" :qType="questionItem.questionType" :question="questionItem"
                              :answer="answer.answerItems[questionItem.itemOrder-1]" :qLabel="itemOrder+'/'+itemSize"/>
              </el-form-item>
              <hr style="border : 0.5px dashed #b3d8ff;" />
              <div style="color: red;font-size: smaller">{{$t('pleaseAnswerCarefully')}}</div>
              <el-row class="do-align-center" v-if="order < problemLength">
            <el-button @click="preSubject" type="warning"  v-if ="preDisable" round>{{$t('lastQuestion')}}</el-button>
            <el-button @click="nextSubject" type="primary" v-if ="nextDisable" round>{{$t('nextQuestion')}}</el-button>
            <el-button @click="preSubject" type="warning"  v-if ="preDisable" :disabled="preDisable2" round>{{$t('lastQuestion')}}</el-button>
            <el-button @click="nextSubject" type="primary" v-if ="nextDisable" :disabled="nextDisable2" round>{{$t('nextQuestion')}}</el-button>
          </el-row>
          <el-row class="do-align-center" v-else>
            <el-button @click="preSubject" type="warning" v-if ="preDisable" round>{{$t('lastQuestion')}}</el-button>
@@ -88,7 +88,9 @@
      submitDisable: true,
      doTime: 0,
      preDisable: false,
      preDisable2: false,
      nextDisable: false,
      nextDisable2: false,
      partOrder: 0,
      parts: [],
      guideTitle: '',
@@ -97,16 +99,18 @@
      memberName: '',
      itemSize: '', // 题目长度
      startDoDisable: true,
      ismobile: false
      ismobile: false,
      hasShownSubmitTip: false // 标志是否已经显示过提交提示
    }
  },
  created: function () {
    // this.getFormDo()
    let _this = this
    _this.ismobile = /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(navigator.userAgent.toLowerCase())
    // 多语言
    _this.setLangFlag(false)
    _this.form = this.$route.query.formDo
    if (_this.form !== {} && _this.form !== undefined) {
    _this.form = undefined
    if (_this.form && _this.form !== {} && _this.form !== undefined) {
      _this.formLoading = true
      _this.remainTime = _this.form.suggestTime * 60
      _this.problemLength = _this.form.titleItems[0].questionItems.length - 1
@@ -131,6 +135,10 @@
          // 加载题目
          examPaperApi.select(_this.memberToken, _this.langType).then(re => {
            _this.form = re.response
            // // 测试模式:只保留前3道题
            // if (_this.form.titleItems[0].questionItems.length > 3) {
            //   _this.form.titleItems[0].questionItems = _this.form.titleItems[0].questionItems.slice(0, 3)
            // }
            _this.remainTime = re.response.suggestTime * 60
            _this.problemLength = _this.form.titleItems[0].questionItems.length - 1
            _this.titleItemsLength = _this.form.titleItems.length
@@ -185,7 +193,6 @@
      ).catch(e => {
      })
    }
  },
  mounted () {
  },
@@ -327,6 +334,8 @@
    },
    nextSubject: function () {
      let _this = this
      _this.preDisable2 = true
      _this.nextDisable2 = true
      _this.isShowGuide(false)
      let nowPartOrder = _this.partOrder
      // 设置上一题的结束时间
@@ -355,8 +364,20 @@
          return
        }
      }
      // 检查是否是最后一题且已答完,弹出提示框
      if (_this.order === _this.answer.answerItems.length - 1 && _this.isContentNotEmpty(_this.order)) {
        if (!_this.hasShownSubmitTip) {
          _this.hasShownSubmitTip = true
          _this.$alert(_this.$t('submit_tip'), _this.$t('prompt'), {
            confirmButtonText: _this.$t('determine'),
            customClass: 'submit-tip-dialog'
          })
        }
      }
      this.answer.answerItems[_this.order].readOnly = true
      let answerSubmit = _this.getSubmitAnswerValue(nowPartOrder)
      // 已经答到了最后一题了,不用自动跳到下一题
      if (this.order + 1 > this.problemLength) {
        this.submitDisable = false
@@ -388,12 +409,21 @@
        } else {
          this.nextQuestionOrder(nowPartOrder)
        }
        _this.preDisable2 = false
        _this.nextDisable2 = false
      }).catch(e => {
        if (_this.isNotEmpty(loading)) {
          loading.close()
        }
        _this.reloadPage(e)
        _this.preDisable2 = false
        _this.nextDisable2 = false
      })
    },
    callSelected: function () {
      let _this = this
      _this.preDisable2 = true
      _this.nextDisable2 = true
    },
    getSubmitAnswerValue (nowPartOrder) {
      let _this = this
@@ -413,6 +443,7 @@
    },
    preSubject () {
      let _this = this
      _this.nextDisable2 = false
      _this.isShowGuide(false)
      if (_this.order > 0) {
        // 清空本题的选择
@@ -462,16 +493,20 @@
      } else {
        _this.answer.verifyStatus = 1
        _this.answer.finish = 1
        let text = _this.$t('finishPersonalityInfo')
        if (_this.isMobile()) {
          text = _this.$t('finishPersonalityInfo_mobile')
        }
        if (this.form) {
          let productType = this.form.productType
          if (productType === 'API_Fan') {
            _this.submitAnswer(_this.$t('finishPersonalityInfo_apifan'))
          } else {
            _this.submitAnswer(_this.$t('finishPersonalityInfo'))
            text = _this.$t('finishPersonalityInfo_apifan')
            if (_this.isMobile()) {
              text = _this.$t('finishPersonalityInfo_apifan_mobile')
            }
          }
        } else {
          _this.submitAnswer(_this.$t('finishPersonalityInfo'))
        }
        _this.submitAnswer(text)
      }
    },
    startDo: function () {
@@ -495,9 +530,9 @@
        if (re.code === 1) {
          // 特殊处理 LAQ测试包 MAQ+CAQ
          if (_this.form.name.indexOf('LAQ') !== -1) {
            console.log('答完题,看看要不要去CAQ1')
            examPaperApi.select(_this.memberToken, _this.langType).then(re => {
              _this.form = re.response
              this.setFormDo(_this.form)
              _this.$router.push({ path: '/guide/index', query: { formDo: _this.form } })
            }).catch(e => {
              _this.$message.error(_this.$t('noquestionMsg'))
@@ -562,8 +597,13 @@
      let _this = this
      return _this.form.titleItems[0].questionItems[_this.order].partOrder !== _this.form.titleItems[0].questionItems[_this.order - 1].partOrder
    },
    isMobile: function () {
      return window.innerWidth < 1025
    },
    ...mapMutations('user', ['setLangType']),
    ...mapMutations('user', ['setLangFlag'])
    ...mapMutations('user', ['setLangFlag']),
    ...mapMutations('user', ['getFormDo']),
    ...mapMutations('user', ['setFormDo'])
  },
  computed: {
    ...mapGetters('enumItem', ['enumFormat']),
@@ -571,6 +611,7 @@
    ...mapState('user', { memberToken: state => state.memberToken }),
    ...mapState('user', { langType: state => state.langType }),
    ...mapState('user', { langFlag: state => state.langFlag }),
    ...mapState('user', { formDo: state => state.formDo }),
    ...mapState('exam', { doUrl: state => state.doUrl })
  }
}
@@ -600,4 +641,5 @@
    z-index: 1000;
    bottom: 0px;
  }
</style>