QYF-GitLab1
4 天以前 b55024ee2f42aa93e0ecaa3113bdeb286f6e59ac
packageBookService/pages/bookServices/examination/examination.js
@@ -628,8 +628,42 @@
      showDialog: false,
    });
  },
  // 初始化函数
  async init() {
    // 获取图书详情,判断题库是否购买
    const query = {
      path: "*",
      queryType: "*",
      productId: this.data.bookId,
      favoriteTypes: "FavoriteBookCity",
      itemFields: {
        "SysType=": "CmsFolder",
      },
      coverSize: {
        height: 300,
      },
      fields: {},
    };
    const res = await app.MG.store.getProductDetail(query)
    const saleData = res.datas.saleMethod.find(item => item.Name.includes('题库'))
    if (saleData && !res.datas.purchasedSaleMethodIdList.includes(saleData.Id)) return wx.showModal({
      title: '提示',
      content: '请先激活或购买题库再答题',
      confirmColor: "#ff6c00",
      cancelColor: "#949494",
      editable: false, //是否显示输入框
      showCancel: false,
      complete: () => {
        this.setData({
          submitStatus: true
        })
        wx.setStorageSync('tabValue', 'questionBank')
        wx.redirectTo({
          url: `/packageBookService/pages/bookServices/detail/index?id=${res.datas.id}&name=${res.datas.name}`,
        })
      }
    })
    this.setData({
      loading: true,
      subjectiveTotal: 0,
@@ -917,14 +951,15 @@
          let oldObj = "";
          if (oldList)
            oldObj = oldList.find((oldItem) => oldItem.id == item.id);
          // console.log(item.Embedded_QuestionBank_Stem, 111)
          let questionObj = {
            // num: index, // 题号
            id: item.id,
            type: pathitem.name,
            stem: item.Embedded_QuestionBank_QuestionType == "completion" ?
            stem: item.Embedded_QuestionBank_Stem ? item.Embedded_QuestionBank_QuestionType == "completion" ?
              JSON.parse(item.Embedded_QuestionBank_Stem)
              .stemTxt.replaceAll("<vacancy>", ",input,")
              .split(",") : JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
              .split(",") : JSON.parse(item.Embedded_QuestionBank_Stem) : '-', // 题干
            answer: item.Embedded_QuestionBank_Answer, // 答案
            option: item.Embedded_QuestionBank_Option ?
              JSON.parse(item.Embedded_QuestionBank_Option) : "", // 选择题选项
@@ -1453,7 +1488,7 @@
            questionObj.questionType == "completion" ||
            questionObj.questionType == "multipleChoice"
          ) {
            console.log(questionObj.answer, "111")
            // console.log(questionObj.answer, "111")
            try {
              questionObj.answer = JSON.parse(questionObj.answer).toString();
            } catch (error) {
@@ -1786,7 +1821,7 @@
          if (src) {
            questionObj.src = src
            questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
            console.log('题干', questionObj.stem.stemTxt);
            // console.log('题干', questionObj.stem.stemTxt);
          }
        }
        if (item.Embedded_QuestionBank_QuestionType == "judge") {
@@ -1833,7 +1868,7 @@
        cardList: cardList,
        loading: false,
      });
      console.log(this.data.questionDataList, "questionDataList");
      // console.log(this.data.questionDataList, "questionDataList");
    });
  },
  // 获取组卷结果
@@ -2185,7 +2220,7 @@
              JSON.parse(res[0].value).time : 1000,
            "mockData.answer": JSON.parse(res[0].value).answerData,
          });
          console.log(JSON.parse(res[0].value));
          // console.log(JSON.parse(res[0].value));
          data = JSON.parse(res[0].value).answerData;
        }
      });
@@ -2240,7 +2275,7 @@
        this.setData({
          saveTime: 20,
        });
        console.log("模考答题数据已记录");
        // console.log("模考答题数据已记录");
      });
  },
@@ -2460,8 +2495,9 @@
      // 做完了且加入了班级,提交到message
      if (this.data.classList.length && this.data.joinGroup) {
        this.data.classList.forEach(item => {
          if (item.linkProductDto.product.id == this.data.bookId && item.topicId)
          if (item.linkProductDto.product.id == this.data.bookId && item.topicId) {
            this.newTopicMessage(item.topicId)
          }
        })
        this.setinteractionInfo()
      } else {