Forráskód Böngészése

修复了有时候无法获取题目的bug以及删除部分无关的注释

zhangyujun 3 éve
szülő
commit
5297e540a8
1 módosított fájl, 0 hozzáadás és 378 törlés
  1. 0 378
      src/components/m-do-topic/m-do-topic.vue

+ 0 - 378
src/components/m-do-topic/m-do-topic.vue

@@ -843,384 +843,6 @@ export default {
   },
   watch: {
     //specify
-    query(newValue, oldValue) {
-      let that = this;
-      uni.showLoading({
-        title: "加载题目中",
-        mask: true,
-      });
-      switch (that.type) {
-        case "specify":
-          api.open
-            .questionInfoGetQuestionInfoByIds({
-              ids: newValue.questionIds,
-            })
-            .then((res) => {
-              res.rows.forEach((element) => {
-                element.optsArr = [];
-                element.isCollect = false;
-                element.opts.split("-").forEach((item, index) => {
-                  if (element.questionType == 3) {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: element.answer.split("-").includes(item),
-                    });
-                  } else {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: item === element.answer,
-                    });
-                  }
-                });
-                element.isCompleted = false;
-                element.userAnswer = [];
-              });
-              that.problemListTotal = res.total;
-              origProblemList = JSON.parse(JSON.stringify(res.rows));
-
-              that.problemList = res.rows;
-
-              that.$emit("update:problemListTotal", res.total);
-              uni.hideLoading();
-            });
-
-          break;
-        case "exam":
-          api.exam
-            .studentQuestionInfoSelectTestQuestionInfo({
-              gs: "xc",
-              subject: 1,
-            })
-            .then((res) => {
-              res.rows.forEach((element) => {
-                element.optsArr = [];
-                element.isCollect = false;
-                element.opts.split("-").forEach((item, index) => {
-                  if (element.questionType == 3) {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: element.answer.split("-").includes(item),
-                    });
-                  } else {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: item === element.answer,
-                    });
-                  }
-                });
-                element.isCompleted = false;
-                element.userAnswer = [];
-              });
-              that.problemListTotal = res.total;
-              origProblemList = JSON.parse(JSON.stringify(res.rows));
-
-              that.problemList = res.rows;
-
-              that.$emit("update:problemListTotal", res.total);
-              uni.hideLoading();
-            });
-
-          break;
-        case "free":
-          api.open
-            .questionInfoSelectFreeQuestionInfo({
-              ...this.query,
-            })
-            .then((res) => {
-              res.rows.forEach((element) => {
-                element.optsArr = [];
-                element.opts.split("-").forEach((item, index) => {
-                  if (element.questionType == 3) {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: element.answer.split("-").includes(item),
-                    });
-                  } else {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: item === element.answer,
-                    });
-                  }
-                });
-                element.isCompleted = false;
-                element.userAnswer = [];
-              });
-              that.problemList = res.rows;
-              origProblemList = JSON.parse(JSON.stringify(res.rows));
-              that.problemListTotal = res.total;
-              uni.hideLoading();
-            });
-
-          break;
-        case "wrong":
-          api.exam
-            .studentQuestionWrongWrongByUser({
-              carType: this.gsMap[this.query.gs],
-              km: this.query.subject === "1" ? "科目一" : "科目四",
-            })
-            .then((res) => {
-              res.data.forEach((element) => {
-                element.optsArr = [];
-                element.opts.split("-").forEach((item, index) => {
-                  if (element.questionType == 3) {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: element.answer.split("-").includes(item),
-                    });
-                  } else {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: item === element.answer,
-                    });
-                  }
-                });
-                element.isCompleted = false;
-                element.userAnswer = [];
-              });
-              that.problemListTotal = res.total;
-              that.problemList = res.data;
-              origProblemList = JSON.parse(JSON.stringify(res.data));
-              that.$emit("update:problemListTotal", res.data.length);
-
-              uni.hideLoading();
-              uni.hideLoading();
-            });
-
-          break;
-        case "collect":
-          api.exam
-            .studentQuestionCollectionCollectionByUser({
-              carType: this.gsMap[this.query.gs],
-              km: this.query.subject === "1" ? "科目一" : "科目四",
-            })
-            .then((res) => {
-              res.data.forEach((element) => {
-                element.optsArr = [];
-                element.opts.split("-").forEach((item, index) => {
-                  if (element.questionType == 3) {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: element.answer.split("-").includes(item),
-                    });
-                  } else {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: item === element.answer,
-                    });
-                  }
-                });
-                element.isCompleted = false;
-                element.userAnswer = [];
-              });
-              that.problemListTotal = res.total;
-              that.problemList = res.data;
-              origProblemList = JSON.parse(JSON.stringify(res.data));
-              that.$emit("update:problemListTotal", res.data.length);
-
-              uni.hideLoading();
-            });
-
-          break;
-        default:
-          api.exam
-            .studentQuestionInfoList({
-              ...this.query,
-            })
-            .then((res) => {
-              res.rows.forEach((element) => {
-                element.optsArr = [];
-                element.opts.split("-").forEach((item, index) => {
-                  if (element.questionType == 3) {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: element.answer.split("-").includes(item),
-                    });
-                  } else {
-                    element.optsArr.push({
-                      selected: false,
-                      value: item,
-                      index: index,
-                      isAnswer: item === element.answer,
-                    });
-                  }
-                });
-                element.isCompleted = false;
-                element.userAnswer = [];
-              });
-              that.problemListTotal = res.total;
-              that.problemList = res.rows;
-              origProblemList = JSON.parse(JSON.stringify(res.rows));
-              that.$emit("update:problemListTotal", res.total);
-              uni.hideLoading();
-            });
-          break;
-      }
-      // if (this.type == "specify") {
-      //   api.open
-      //     .questionInfoGetQuestionInfoByIds({
-      //       ids: newValue.questionIds,
-      //     })
-      //     .then((res) => {
-      //       res.rows.forEach((element) => {
-      //         element.optsArr = [];
-      //         element.isCollect = false;
-      //         element.opts.split("-").forEach((item, index) => {
-      //           if (element.questionType == 3) {
-      //             element.optsArr.push({
-      //               selected: false,
-      //               value: item,
-      //               index: index,
-      //               isAnswer: element.answer.split("-").includes(item),
-      //             });
-      //           } else {
-      //             element.optsArr.push({
-      //               selected: false,
-      //               value: item,
-      //               index: index,
-      //               isAnswer: item === element.answer,
-      //             });
-      //           }
-      //         });
-      //         element.isCompleted = false;
-      //         element.userAnswer = [];
-      //       });
-      //       that.problemListTotal = res.total;
-      //       origProblemList = JSON.parse(JSON.stringify(res.rows));
-
-      //       that.problemList = res.rows;
-
-      //       that.$emit("update:problemListTotal", res.total);
-      //       uni.hideLoading();
-      //     });
-      // } else if (this.type === "exam") {
-      //   api.exam
-      //     .studentQuestionInfoSelectTestQuestionInfo({
-      //       gs: "xc",
-      //       subject: 1,
-      //     })
-      //     .then((res) => {
-      //       res.rows.forEach((element) => {
-      //         element.optsArr = [];
-      //         element.isCollect = false;
-      //         element.opts.split("-").forEach((item, index) => {
-      //           if (element.questionType == 3) {
-      //             element.optsArr.push({
-      //               selected: false,
-      //               value: item,
-      //               index: index,
-      //               isAnswer: element.answer.split("-").includes(item),
-      //             });
-      //           } else {
-      //             element.optsArr.push({
-      //               selected: false,
-      //               value: item,
-      //               index: index,
-      //               isAnswer: item === element.answer,
-      //             });
-      //           }
-      //         });
-      //         element.isCompleted = false;
-      //         element.userAnswer = [];
-      //       });
-      //       that.problemListTotal = res.total;
-      //       origProblemList = JSON.parse(JSON.stringify(res.rows));
-
-      //       that.problemList = res.rows;
-
-      //       that.$emit("update:problemListTotal", res.total);
-      //       uni.hideLoading();
-      //     });
-      // } else if (this.type === "free") {
-      //   api.open
-      //     .questionInfoSelectFreeQuestionInfo({
-      //       ...this.query,
-      //     })
-      //     .then((res) => {
-      //       res.rows.forEach((element) => {
-      //         element.optsArr = [];
-      //         element.opts.split("-").forEach((item, index) => {
-      //           if (element.questionType == 3) {
-      //             element.optsArr.push({
-      //               selected: false,
-      //               value: item,
-      //               index: index,
-      //               isAnswer: element.answer.split("-").includes(item),
-      //             });
-      //           } else {
-      //             element.optsArr.push({
-      //               selected: false,
-      //               value: item,
-      //               index: index,
-      //               isAnswer: item === element.answer,
-      //             });
-      //           }
-      //         });
-      //         element.isCompleted = false;
-      //         element.userAnswer = [];
-      //       });
-      //       that.problemList = res.rows;
-      //       origProblemList = JSON.parse(JSON.stringify(res.rows));
-      //       that.problemListTotal = res.total;
-      //       uni.hideLoading();
-      //     });
-      // } else {
-      //   api.exam
-      //     .studentQuestionInfoList({
-      //       ...this.query,
-      //     })
-      //     .then((res) => {
-      //       res.rows.forEach((element) => {
-      //         element.optsArr = [];
-      //         element.opts.split("-").forEach((item, index) => {
-      //           if (element.questionType == 3) {
-      //             element.optsArr.push({
-      //               selected: false,
-      //               value: item,
-      //               index: index,
-      //               isAnswer: element.answer.split("-").includes(item),
-      //             });
-      //           } else {
-      //             element.optsArr.push({
-      //               selected: false,
-      //               value: item,
-      //               index: index,
-      //               isAnswer: item === element.answer,
-      //             });
-      //           }
-      //         });
-      //         element.isCompleted = false;
-      //         element.userAnswer = [];
-      //       });
-      //       that.problemListTotal = res.total;
-      //       that.problemList = res.rows;
-      //       origProblemList = JSON.parse(JSON.stringify(res.rows));
-      //       that.$emit("update:problemListTotal", res.total);
-      //       uni.hideLoading();
-      //     });
-      // }
-    },
     problemListIndex(newValue, oldValue) {
       if (this.isAutoReadTopics) {
         let audio = utils.wxUtils.getGlobAudio();