peng
1 天以前 b56fcbe8d410c18b3a6ff7e4eb0e24815bbb5e09
manager/src/views/login.vue
@@ -119,13 +119,30 @@
          // 加载菜单
          Cookies.set("userInfoManager", JSON.stringify(res.result));
          this.$store.commit("setAvatarPath", res.result.avatar);
          util.initRouter(this);
          this.$router.push({
            name: "home_index",
          // 确保路由初始化完成后再进行跳转
          return util.initRouter(this).then(() => {
            this.$router.push({
              name: "home_index",
            }).catch(err => {
              console.error("路由跳转错误:", err);
              // 如果直接跳转失败,尝试使用replace
              this.$router.replace({
                name: "home_index",
              });
            });
          }).catch(err => {
            console.error("路由初始化失败:", err);
            // 路由初始化失败时也跳转到首页
            this.$router.push({
              name: "home_index",
            });
          });
        } else {
          this.loading = false;
        }
      }).catch(err => {
        console.error("获取用户信息失败:", err);
        this.loading = false;
      });
    },
    submitLogin() {
@@ -156,7 +173,7 @@
        .catch(() => {
          this.loading = false;
        });
      this.$refs.verify.show = false;
      // this.$refs.verify.show = false;
    },
  },
};