ソースを参照

add welcome modal

Michael Wang 6 年 前
コミット
dc4eb3819a
2 ファイル変更30 行追加1 行削除
  1. 0 1
      src/features/Login/Login.vue
  2. 30 0
      src/features/OnlineExam/OnlineExamHome.vue

+ 0 - 1
src/features/Login/Login.vue

@@ -418,7 +418,6 @@ export default {
     },
     schoolDomain() {
       const domain = this.domainInUrl;
-      console.log("schoolDomain", domain, this.$route);
       if (!domain || !domain.includes("qmth.com.cn")) {
         this.$Message.error("机构地址出错,请关闭程序后再登录。");
       }

+ 30 - 0
src/features/OnlineExam/OnlineExamHome.vue

@@ -24,9 +24,39 @@ export default {
   name: "OnlineExamHome",
   data() {
     return {
+      previousUrl: "",
       courses: []
     };
   },
+  beforeRouteEnter(to, from, next) {
+    next(vm => {
+      vm.previousUrl = from.path;
+      console.log("from.path:", from.path);
+    });
+  },
+  beforeMount() {
+    this.$nextTick(() => {
+      if (this.previousUrl.startsWith("/login/")) {
+        this.$Modal.info({
+          title: "欢迎",
+          render: () => (
+            <div>
+              <div style="font-weight:bold">
+                {this.$store.state.user.name} -{" "}
+                {this.$store.state.user.studentCode}
+              </div>
+              <div style="font-weight:bold">
+                专业:{this.$store.state.user.specialty}{" "}
+              </div>
+              <div style="margin-top: 1.5em">
+                欢迎使用考试系统,祝顺利完成考试!
+              </div>
+            </div>
+          )
+        });
+      }
+    });
+  },
   async mounted() {
     window._hmt.push(["_trackEvent", "在线考试列表页面", "进入页面"]);
     const res = await this.$http.get(