rk
2025-09-28 a8fb7ae2dbb61a94141ed5e73d3bb2632b7b84df
h5/pages/answer/answer.vue
@@ -6,11 +6,16 @@
    </view>
    <view class="box_list">
      <view class="box_list_answer" v-if="list && list.length > 0">
        <view v-if="status == 1 || status == 2" class="score_static">
          <text class="name">本次得分:</text>
          <text class="num" :class="{ warry: status == 2 }">{{ score }}分</text>
        </view>
        <!--    单选/判断   -->
        <view v-for="(item, index) in list" :key="index" class="list_item">
          <view class="box_list_answer_name">
            {{ index + 1 }}、{{ item.title
            }}<text style="color: #ed4545">*</text>
            <text>{{ index + 1 }}、{{ item.title }}</text>
            <text v-if="item.score"> ({{ item.score }}分)</text>
            <text style="color: #ed4545">*</text>
          </view>
          <template v-if="item.type == 1 || item.type == 0">
            <view
@@ -56,8 +61,8 @@
                  (item.answer === item.selAnswer &&
                    item.selAnswer == line.code)
                "
                style="color: rgba(2, 94, 239, 1)"
                ><text class="mr24" style="color: rgba(2, 94, 239, 1)">{{
                style="color: rgba(77, 153, 168, 1)"
                ><text class="mr24" style="color: rgba(77, 153, 168, 1)">{{
                  line.code
                }}</text>
                {{ line.value }}</text
@@ -78,14 +83,18 @@
            </view>
            <view
              class="box_list_answer_tips"
              style="margin-bottom: 0rpx"
              v-if="
                item.selAnswer &&
                item.answer !== item.selAnswer &&
                status != '0'
              "
            >
              <image src="@/static/ic_wrong@2x.png" />
              <text>回答错误</text>
              <view class="line">
                <image src="@/static/ic_wrong@2x.png" />
                <text>回答错误</text>
              </view>
              <view class="line">正确答案:{{ item.answer }}</view>
            </view>
            <view
              class="box_list_answer_tips"
@@ -95,8 +104,10 @@
                status != '0'
              "
            >
              <image src="@/static/meeting/icon/ic_choose_sel@2x.png" />
              <text class="success">回答正确</text>
              <view class="line">
                <image src="@/static/ic_success@2.png" />
                <text class="success">回答正确</text>
              </view>
            </view>
          </template>
          <template v-if="item.type == 2">
@@ -111,9 +122,7 @@
                src="@/static/checkbo1x_sel@2x.png"
                v-if="
                  (line.checked && status != '2') ||
                  (item.selAnswer === item.answer &&
                    line.checked &&
                    status != '2')
                  (item.selAnswer === item.answer && line.checked)
                "
              />
              <image
@@ -131,12 +140,10 @@
              <text
                v-if="
                  (line.checked && status != '2') ||
                  (item.selAnswer === item.answer &&
                    line.checked &&
                    status != '2')
                  (item.selAnswer === item.answer && line.checked)
                "
                style="color: rgba(2, 94, 239, 1)"
                ><text class="mr24" style="color: rgba(2, 94, 239, 1)">{{
                style="color: rgba(77, 153, 168, 1)"
                ><text class="mr24" style="color: rgba(77, 153, 168, 1)">{{
                  line.code
                }}</text>
                {{ line.value }}</text
@@ -162,8 +169,11 @@
                status != '0'
              "
            >
              <image src="@/static/ic_wrong@2x.png" />
              <text>回答错误</text>
              <view class="line">
                <image src="@/static/ic_wrong@2x.png" />
                <text>回答错误</text>
              </view>
              <view class="line">正确答案:{{ item.answer }}</view>
            </view>
            <view
              class="box_list_answer_tips"
@@ -173,8 +183,10 @@
                status != '0'
              "
            >
              <image src="@/static/meeting/icon/ic_choose_sel@2x.png" />
              <text class="success">回答正确</text>
              <view class="line">
                <image src="@/static/ic_success@2.png" />
                <text class="success">回答正确</text>
              </view>
            </view>
          </template>
        </view>
@@ -182,6 +194,7 @@
        <view
          v-if="status == '0'"
          class="box_list_answer_btn"
          :class="{ disable: !answerIng }"
          @click="onSubmit()"
          >提交</view
        >
@@ -208,7 +221,7 @@
                  <text style="color: rgba(237, 69, 69, 1)"
                     v-if="success && multiple.toString().indexOf(item.code) !== -1">{{item.code}} {{item.value}}</text>
                  <text v-else-if="!multiple || multiple.toString().indexOf(item.code) === -1">{{item.code}} {{item.value}}</text>
                  <text style="color: rgba(2, 94, 239, 1)"
                  <text style="color: rgba(77, 153, 168, 1)"
                     v-else-if="multiple.toString().indexOf(item.code) !== -1">{{item.code}} {{item.value}}</text>
               </view>
            </template> -->
@@ -225,14 +238,25 @@
  data() {
    return {
      list: [],
      bg: require("@/static/banner_dati.jpg"),
      bg: require("@/static/banner_dati.png"),
      title: '',
      content: '',
      status: '0'
      status: '0',
      score: 0
    }
  },
  computed: {
    answerIng() {
      let count = 0
      this.list.forEach(item => {
        if (item.selAnswer || item.selAnswer == 0) {
          count++
        }
      })
      return count === this.list.length
    }
  },
  onLoad() {
    this.getProblems()
    this.getInfo()
@@ -280,7 +304,6 @@
              item.status = '0'
              item.selAnswer = null
            })
            console.log(res.data)
            this.list = res.data
          }
          // res.param.problemsDOList.forEach(item => {
@@ -292,7 +315,7 @@
    },
    // 单选选择中题目
    select(line, i) {
      if(this.status === '2') return
      if (this.status != '0') return
      this.list.forEach((item, index) => {
        if (index === i) {
          item.selAnswer = line.code
@@ -301,7 +324,7 @@
      // this.problemIndex = index
    },
    changeBox(index, jeck) {
      if(this.status === '2') return
      if (this.status != '0') return
      this.list.forEach((item, i) => {
        if (index === i) {
          item.options.forEach((item2, j) => {
@@ -341,6 +364,7 @@
    },
    // 下一题
    onSubmit() {
      if (!this.answerIng) return
      const { list } = this
      // 验证所有题目都有选项
      let count = 0
@@ -360,6 +384,8 @@
      list.forEach(item => {
        if (item.selAnswer !== item.answer) {
          flag++
        } else {
          this.score += item.score
        }
      })
      if (flag > 0) {
@@ -374,16 +400,19 @@
    },
    handleAgain() {
      this.status = '0'
      this.score = 0
      this.getProblems()
    },
    next() {
      saveProblemsVO({
        openId: this.$store.state.openId,
        useType: '1',
        content: ''
        content: '',
            score: this.score
      }).then(res => {
        this.score = 0
        uni.navigateTo({
          url: `/pages/userinfo/userinfo`
          url: `/pages/appointment/appointment?answerId=${res.data}`
        })
      })
@@ -396,7 +425,7 @@
.box {
  width: 100%;
  height: 100vh;
  background: #025eef;
  background: $uni-color-primary;
  .box_bgimage {
    width: 100%;
    padding: 0 40rpx;
@@ -448,9 +477,17 @@
        box-sizing: border-box;
        background: #f7f7f7;
        border-radius: 8rpx;
        display: flex;
        align-items: center;
        margin-bottom: 24rpx;
        .line {
          display: flex;
          align-items: center;
          font-size: 28rpx;
          color: #333333;
          margin-bottom: 20rpx;
          &:nth-last-child(1){
            margin-bottom: 0;
          }
        }
        image {
          width: 28rpx;
          height: 28rpx;
@@ -462,8 +499,22 @@
          margin-left: 16rpx;
        }
        .success {
          color: #275de6;
          color: $uni-color-primary;
        }
      }
    }
    .score_static {
      display: flex;
      font-size: 32rpx;
      margin-bottom: 40rpx;
      .name {
        font-weight: 600;
      }
      .num {
        color: $uni-color-primary;
      }
      .warry {
        color: #ed4545;
      }
    }
    .list_item {
@@ -495,19 +546,21 @@
    }
    .box_list_answer_btn {
      position: fixed;
      bottom: 140rpx;
      bottom: 120rpx;
      left: 60rpx;
      width: 630rpx;
      height: 88rpx;
      line-height: 88rpx;
      text-align: center;
      background: #025eef;
      box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(2, 94, 239, 0.3);
      background: $uni-color-primary;
      box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(77, 153, 168, 0.3);
      border-radius: 44rpx;
      font-size: 30rpx;
      font-weight: 500;
      color: #ffffff;
    }
    .disable {
      background-color: #cccccc;
    }
  }
}
</style>