zhongshujie
2024-12-19 8aeddcf766df9f7e3061d4d098b57afdf53db896
packageBookService/pages/psychologyAnswer/psychologyAnswer.js
@@ -282,22 +282,14 @@
  },
  // 切换题目
  changeSwiper(e) {
    let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0;
    const item = this.data.questionDataList[index];
    const lastItem = this.data.questionDataList[index + 1];
    let index = e.detail.index;
    const lastItem = this.data.questionDataList[index];
    this.setData({
      currentIndex: e.detail.index,
      showId: lastItem.id
    });
    if (
      (this.data.answerType == "collectQuestion" ||
        this.data.answerType == "errorQuestion") &&
      !item.isComplete
    ) {
      let flag = this.isHaveAnswer(item.userAnswer);
      if (flag) this.handleQuestion(index);
    }
  },
  // 我的错题,收藏查看解析按钮
  viewParsing() {
    if (
@@ -396,6 +388,12 @@
        radioChange(citem)
      }
    }
    const listLength = this.data.questionDataList.length - 1
    if (this.data.currentIndex < listLength) {
      this.setData({
        currentIndex: this.data.currentIndex + 1
      })
    }
  },
  // 输入框触发
  onChangeInput(e) {
@@ -471,10 +469,6 @@
    // 先遍历所有题目,将未批改的题目批改
    const qustionList = this.data.questionDataList;
    if (qustionList.length) this.handleQuestion();
    this.setData({
      isShowDialog: true,
      submitStatus: true,
    })
    // 记录用户答题数据
    let saveData = [];
    for (let index = 0; index < this.data.questionDataList.length; index++) {
@@ -497,13 +491,15 @@
    });
    this.setData({
      loading: false,
      showDialog: false,
      isShowDialog: true,
      submitStatus: true,
    });
  },
  // 初始化函数
  async init(isReset) {
    this.setData({
      loading: false,
      isShowDialog: false,
      loading: true,
    });
    const questuionName = this.data.questuionName
    const questuionList = pastData.postData.list
@@ -660,6 +656,7 @@
  },
  async restart() {
    this.setData({
      isShowDialog: false,
      currentIndex: 0,
      submitStatus: false,
    });
@@ -723,25 +720,24 @@
          this.setData({
            questionDataList: newArr,
            scoreDataList: scoreArr,
            loading: false,
          })
        } catch (error) {
          this.setData({
            questionDataList: newArr,
            scoreDataList: scoreArr
            scoreDataList: scoreArr,
            loading: false,
          })
          console.log(error);
        }
        const e = {
          detail: {
            index: 0
          }
        };
        this.changeSwiper(e)
      });
  },
  // 记录模考答题数据
  saveMockData() {