闫增涛
2024-11-27 e6a3acf38930a8caffa3b1b19e9dc08526a70c71
src/components/examinations/index.vue
@@ -668,7 +668,18 @@
        const item = this.cardData[index];
        for (let cindex = 0; cindex < item.infoList.length; cindex++) {
          const citem = item.infoList[cindex];
          if (typeof citem.userAnswer == "string") {
          citem.userAnswer = "";
          } else {
            if (citem.questionType == "multipleChoice") {
              citem.userAnswer = [];
            } else {
              // 填空题
              for (let dindex = 0; dindex < citem.userAnswer.length; dindex++) {
                citem.userAnswer[dindex] = '';
              }
            }
          }
          citem.isComplete = false;
        }
      }
@@ -826,12 +837,11 @@
    },
    // 题目收藏按钮,收藏和取消同一接口,取消数组减去该项id
    setCollect(num, number) {
      let item = null
      let item = null;
      if(number) {
        item = this.cardData[num].infoList[number];
      } else {
        item = this.cardData[num]
        item = this.cardData[num];
      }
      item.isCollect = !item.isCollect;
      console.log(111,item);
@@ -852,7 +862,7 @@
        const item = this.allCollect[index];
        if (item.type == this.sourceType) item.collectList = this.collectList;
      }
      console.log('点击收藏按钮',this.allCollect)
      console.log("点击收藏按钮", this.allCollect);
      this.MG.identity
        .setUserKey({
          setKeyRequests: [
@@ -879,7 +889,7 @@
        .then((res) => {
          try {
            const collect = JSON.parse(res[0].value);
            console.log('全部收藏id',collect);
            console.log("全部收藏id", collect);
            if (collect.length) {
              this.collectList = collect.find(
                (citem) => citem.type == this.sourceType
@@ -927,7 +937,7 @@
        .catch(() => {});
    },
    onChangeInput(e,index,cindex,num) {
      this.cardData[index].infoList[cindex].userAnswer[num] = e.target.value
      this.cardData[index].infoList[cindex].userAnswer[num] = e.target.value;
    },
  },
};