闫增涛
2024-04-02 5c236aa8ee143c1f0f23e738f92c0ebc21270549
答题器bug修改
5个文件已修改
68 ■■■■■ 已修改文件
packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/examination.js 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/questionList/index.wxml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/examination/questionList/index.wxss 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/testResource/testResource.wxss
@@ -257,4 +257,8 @@
.mock-price {
  color: #ff6c00;
  font-size: 36rpx;
}
.t-radio__description {
  width: 102%;
}
packageBookService/pages/bookServices/detail/index.js
@@ -999,13 +999,12 @@
    this.setData({
      applyResourceState: true
    })
    wx.showLoading({
      title: '加载中',
    })
    let role = wx.getStorageSync(app.config.userInfoKey).role
    let role = JSON.parse(wx.getStorageSync(app.config.userInfoKey)).role
    if (role) {
      debugger
      if (role == 'Teacher') {
        wx.showLoading({
          title: '加载中',
        })
        // 申请教学资源
        let query = {
          topicIdOrRefCode: 'productDownLoad',
@@ -1044,6 +1043,19 @@
          }
        })
      }
    } else {
      wx.showModal({
        title: '尊敬的用户,您好!',
        content: '请先进行教师认证!',
        complete: (res) => {
          if (res.cancel) {}
          if (res.confirm) {
            wx.navigateTo({
              url: '/packageDomain/pages/teacherCertification/index',
            })
          }
        }
      })
    }
  },
  // 教学资源下载前往PC提示Diialog
packageBookService/pages/bookServices/examination/examination.js
@@ -775,8 +775,6 @@
              questionObj.answer = item.Embedded_QuestionBank_Answer
            }
          }
          // questionObj.userAnswer = this.arrayToString(questionObj.userAnswer)
          // questionObj.isHaveAnswer = this.isHaveAnswer(questionObj.userAnswer)
          // 填空题改造
          if (questionObj.questionType == 'completion') {
            let index = 0
@@ -796,13 +794,16 @@
          if (questionObj.stemStyle == 'RichText') {
            // questionObj.option.txt = ''
            questionObj.stem.stemTxt = questionObj.stem.stemTxt.replace(/\<img/gi, '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ').replace(/\<p/gi, '<p class="stem-rich-p"')
          }
          // 选项富文本处理
          if (questionObj.optionStyle == 'RichText' && (questionObj.questionType == 'singleChoice' || questionObj.questionType == 'judge' || questionObj.questionType == 'multipleChoice')) {
            questionObj.option.forEach(item => {
              if (item.txt) item.txt = item.txt.replace(/\<img/gi, '<img class="option-rich-img"').replace(/\<p/gi, '<p class="stem-rich-p"')
            })
          }
          // 解析富文本处理
          if (questionObj.analysisCon && typeof questionObj.analysisCon == 'string') {
            questionObj.analysisCon = questionObj.analysisCon.replace(/\<img/gi, '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" ')
          }
          // 获取图片
          if (questionObj.stemStyle == 'Image' || questionObj.stemStyle == 'TxtAndImage') {
@@ -813,13 +814,17 @@
              if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150)
            })
          }
          // 客观题总分赋值
          if (questionObj.questionType !== 'shortAnswer') {
            this.setData({
              subjectiveGrade: this.data.subjectiveGrade + 2
            })
          }
          // if (questionObj.optionStyle == 'RichText') {
          //   questionObj.option.forEach(optionItem => {
          //     optionItem.txt.replace(/<img>/g, "<img class='imgClass'>")
          //   })
          // }
          // 旧数据里 题目已经作答,修改已答题目数量
          // if (oldObj && oldObj.userAnswer.length > 0) countDownRef.value.changeAlready()
          // 旧数据里 题目正确 记录正确数量
          if (questionObj.isRight) {
            this.setData({
@@ -832,7 +837,6 @@
                subjectiveTotal: this.data.subjectiveTotal + 1
              })
            }
          }
          // cardList赋值
          let cardIndex = this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath)
@@ -841,11 +845,9 @@
          this.setData({
            [`cardList[${cardIndex}].infoList`]: infoList
          })
          //   this.data.cardList[this.data.cardList.findIndex((item) => item.path == pathitem.productLinkPath)]
          //     .infoList
          // infoList.push(questionObj)
          flag++;
          let questionList = []
          let grade = 0
          const cardUpdatedList = this.data.cardList
          // if (flag == this.data.idPathList.length) {
          cardUpdatedList.forEach(aitem => {
@@ -880,7 +882,6 @@
    // 批改题目
    if (item.questionType == 'multipleChoice') {
      // 多选题
      // subjectiveGrade.value += item.score
      if (item.answer.length == item.userAnswer.length) {
        const sortedArr1 = item.answer.slice().sort()
        const sortedArr2 = item.userAnswer.slice().sort()
@@ -892,7 +893,6 @@
      }
    } else if (item.questionType == 'singleChoice' || item.questionType == 'judge') {
      // 单选 判断
      // subjectiveGrade.value += item.score
      questionList[index].isRight = item.answer == item.userAnswer
    } else if (item.questionType == 'shortAnswer') {
      // 简答 翻译
@@ -909,7 +909,6 @@
          )
        }
      }
      // subjectiveGrade.value += item.score
      if (typeof item.answer == 'string') {
        questionList[index].isRight = item.answer == item.userAnswer[0]
      } else {
@@ -925,7 +924,6 @@
    if (item.questionType != 'shortAnswer') {
      this.setData({
        subjectiveTotal: this.data.subjectiveTotal + 1,
        subjectiveGrade: this.data.subjectiveGrade + item.score
      })
    }
    if (questionList[index].isRight && item.questionType != 'shortAnswer') {
@@ -1322,12 +1320,6 @@
  },
  // 获取错题集
  async getErrorDataList() {
    // this.setData({
    //   cardList: [{
    //     catalogName: '错题集',
    //     infoList: []
    //   }]
    // })
    this.setData({
      cardList: [{
        catalogName: '单选题',
@@ -1686,6 +1678,12 @@
              if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150)
            })
          }
          // 客观题总分赋值
          if (questionObj.questionType !== 'shortAnswer') {
            this.setData({
              subjectiveGrade: this.data.subjectiveGrade + questionObj.score
            })
          }
          if (oldObj && oldObj.isRight) {
            this.setData({
              correctNum: this.data.correctNum + 1
packageBookService/pages/bookServices/examination/questionList/index.wxml
@@ -172,6 +172,7 @@
            wx:key="contentIndex"
          >
            <t-checkbox
              icon="rectangle"
              block="{{false}}"
              value="{{contentItem.value}}"
              style="background-color:{{isNight ? '#222' :'#F9F9F9'}}; display: flex; align-items: center; margin-bottom: 20rpx;"
packageBookService/pages/bookServices/examination/questionList/index.wxss
@@ -57,6 +57,7 @@
}
.radio-item text {
  display: inline-block;
  height: min-content;
}
@@ -95,7 +96,7 @@
}
.checkbox-group {
  --td-checkbox-icon-checked-color: #ff6c00;
  --td-checkbox-icon-checked-color: #FF6C00;
}
.t-checkbox {
@@ -163,6 +164,7 @@
}
.analysis-text {
  display: flex;
  color: #333333;
  font-size: 28rpx;
  margin-top: 20rpx;
@@ -216,6 +218,7 @@
}
.option-rich-img {
  display: inline-block;
  max-width: 180rpx !important;
  height: auto;
  object-fit: contain;