Эх сурвалжийг харах

确保进入第一个可用菜单

Michael Wang 5 жил өмнө
parent
commit
70e9c5b902

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

@@ -62,6 +62,23 @@ export default {
       }
     });
   },
+  watch: {
+    menus() {
+      if (this.menus[0]) {
+        if (this.menus[0].link.toUpperCase() !== "/online-exam".toUpperCase()) {
+          this.$router.push(this.menus[0].link);
+          return;
+        }
+      } else {
+        this.$Message.error({
+          content: "无可用菜单",
+          duration: 15,
+          closable: true,
+        });
+        this.logout();
+      }
+    },
+  },
   beforeMount() {
     this.$nextTick(() => {
       if (