Skip to content

Commit

Permalink
[U] 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
zxysilent committed Apr 13, 2021
1 parent 5484233 commit a12d2af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 2 additions & 3 deletions vue/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@ const RouterConfig = {
let first = true;

const router = new VueRouter(RouterConfig);

const noAuth = ["login", "errjwt", "err50x", "err401"];
router.beforeEach(async (to, from, next) => {
ViewUI.LoadingBar.start();
Utils.title(to.meta.title);
const token = Utils.getToken();
// 去不需要登录的地方
if (Utils.noAuth(to.name)) {
if (noAuth.indexOf(to.name) > -1) {
if (token) {
console.log("f2");
Utils.title("主页");
next({ name: "home" });
} else {
Expand Down
4 changes: 0 additions & 4 deletions vue/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ utils.getAuth = () => {
location.href = "/login";
}
};
// 不需要也可登录页面集合
utils.noAuth = r => {
return ["login", "errjwt", "err50x", "err401"].indexOf(r) > -1;
};
utils.Role = {
RSup: 30, //超级管理员
RAtv: 20, //启用/禁用
Expand Down

0 comments on commit a12d2af

Please sign in to comment.