Bladeren bron

修改路由跳转顺序

zaijin 2 jaren geleden
bovenliggende
commit
3279b1b4b0
2 gewijzigde bestanden met toevoegingen van 6 en 3 verwijderingen
  1. 5 2
      src/router/index.js
  2. 1 1
      src/views/AdaptiveTraining/AdaptiveTrainingIndex.vue

+ 5 - 2
src/router/index.js

@@ -456,9 +456,12 @@ router.beforeEach((to, from, next) => {
     document.title = to.meta.title;
   }
   if (store.state.user.token && !store.state.user.isLogin) {
-    store.dispatch("GetUserInfo");
+    store.dispatch("GetUserInfo").then(res => {
+      next();
+    });
+  } else {
+    next();
   }
-  next();
 });
 
 export default router;

+ 1 - 1
src/views/AdaptiveTraining/AdaptiveTrainingIndex.vue

@@ -3,7 +3,7 @@
  * @Author: 空白格
  * @Date: 2022-08-12 15:23:44
  * @LastEditors: 空白格
- * @LastEditTime: 2023-03-17 14:17:33
+ * @LastEditTime: 2023-03-17 16:24:25
  * @FilePath: \veterans_client_web\src\views\AdaptiveTraining\AdaptiveTrainingIndex.vue
  * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
 -->