瀏覽代碼

测评结束 提交后逻辑修改

JutarryWu 6 月之前
父節點
當前提交
d68c7d97e6
共有 2 個文件被更改,包括 57 次插入40 次删除
  1. 41 32
      src/mixin/myMixin.js
  2. 16 8
      src/views/scaleDetail.vue

+ 41 - 32
src/mixin/myMixin.js

@@ -1,41 +1,50 @@
+import {Dialog} from "vant";
+
 const myMixin = {
   methods: {
     goBack() {
       this.$router.go('-1');
     },
     goTestResult(id) {
-      this.$http.get(`getRecordById?id=${id}`, {}, (res) => {
-        if (res.code == 2001) {
-          this.$toast.fail(res.msg);
-          return;
-        }
-        if (res && res.code == 200) {
-
-          let versionNo = JSON.parse(res.data?.userRecordEntity?.testResult).versionNo;
-          if (versionNo == "2.0.1" || versionNo == "2.0") {
-            //跳转新测试结果模版数据暂存本地
-            // sessionStorage.setItem("testResult", res.data?.userRecordEntity?.testResult);
-            // this.$store.dispatch('setTestResult',JSON.parse(res.data?.userRecordEntity?.testResult));
-            this.$store.dispatch('setTestResult',res?.data);
-            this.$router.push({
-              name: "testResultNew",
-              query: {
-                id: res.data?.userRecordEntity?.id,
-                title: res.data?.userRecordEntity?.name,
-                testPlanId: this.$route.query.testPlanId || "",
-                come: 1, //1-来自认知任务列表,2-测试记录列表
-              },
-            });
-          } else {
-            //跳转旧测试结果模版
-            this.$router.push(`/cognitiveTaskOldTestRecord?flag=${res.data?.userRecordEntity?.flag}&id=${id}&from=1&testPlanId=${this.$route.query.testPlanId || ""}`);
-          }
-
-
-        } else {
-          this.$toast.fail("获取数据失败!服务器异常");
-        }
-      });
+      Dialog.alert({
+        title: '测试完成',
+        message: '恭喜你顺利完成测评!若想了解你的具体测评成绩,请与老师联系以获取详细反馈。',
+      })
+        .then(() => {
+          this.$router.push('/index/cognitionTask')
+        })
+      // this.$http.get(`getRecordById?id=${id}`, {}, (res) => {
+      //   if (res.code == 2001) {
+      //     this.$toast.fail(res.msg);
+      //     return;
+      //   }
+      //   if (res && res.code == 200) {
+      //
+      //     let versionNo = JSON.parse(res.data?.userRecordEntity?.testResult).versionNo;
+      //     if (versionNo == "2.0.1" || versionNo == "2.0") {
+      //       //跳转新测试结果模版数据暂存本地
+      //       // sessionStorage.setItem("testResult", res.data?.userRecordEntity?.testResult);
+      //       // this.$store.dispatch('setTestResult',JSON.parse(res.data?.userRecordEntity?.testResult));
+      //       this.$store.dispatch('setTestResult',res?.data);
+      //       this.$router.push({
+      //         name: "testResultNew",
+      //         query: {
+      //           id: res.data?.userRecordEntity?.id,
+      //           title: res.data?.userRecordEntity?.name,
+      //           testPlanId: this.$route.query.testPlanId || "",
+      //           come: 1, //1-来自认知任务列表,2-测试记录列表
+      //         },
+      //       });
+      //     } else {
+      //       //跳转旧测试结果模版
+      //       this.$router.push(`/cognitiveTaskOldTestRecord?flag=${res.data?.userRecordEntity?.flag}&id=${id}&from=1&testPlanId=${this.$route.query.testPlanId || ""}`);
+      //     }
+      //
+      //
+      //   } else {
+      //     this.$toast.fail("获取数据失败!服务器异常");
+      //   }
+      // });
     }
   }
 }

+ 16 - 8
src/views/scaleDetail.vue

@@ -233,6 +233,7 @@
 <script>
 // import { Checkbox } from "vant";
 import { splitCheckItems } from "../utils/utils";
+import {Dialog} from "vant";
 
 export default {
   name: "scaleDetail",
@@ -571,15 +572,22 @@ export default {
     getAnswerQuestionPaymentSuccess(id) {
       // let _this = this;
       // console.log("请求数据的ID", id);
+      Dialog.alert({
+        title: '测试完成',
+        message: '恭喜你顺利完成测评!若想了解你的具体测评成绩,请与老师联系以获取详细反馈。',
+      })
+        .then(() => {
+          this.$router.push('/index/scaleTest')
+        })
 
-      this.$router.push({
-        path: "/testRecordsSCl",
-        query: {
-          id: id,
-          from: 1,
-          testPlanId: this.testPlanId,
-        },
-      });
+      // this.$router.push({
+      //   path: "/testRecordsSCl",
+      //   query: {
+      //     id: id,
+      //     from: 1,
+      //     testPlanId: this.testPlanId,
+      //   },
+      // });
 
       // _this.$http.get(`/getRecordById?id=${id}`, {}, (res) => {
       //   if (res.code == 200) {