Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
4f33da2a
Commit
4f33da2a
authored
Dec 15, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录后push添加catch防止出现检查错误
parent
8988d0b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
21 deletions
+8
-21
permission.js
ruoyi-ui/src/permission.js
+2
-12
login.vue
ruoyi-ui/src/views/login.vue
+6
-9
No files found.
ruoyi-ui/src/permission.js
View file @
4f33da2a
...
...
@@ -23,28 +23,18 @@ router.beforeEach((to, from, next) => {
// 拉取user_info
const
roles
=
res
.
roles
store
.
dispatch
(
'GenerateRoutes'
,
{
roles
}).
then
(
accessRoutes
=>
{
// 测试 默认静态页面
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
})
})
.
catch
(
err
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
}).
catch
(
err
=>
{
store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
Message
.
error
(
err
)
next
({
path
:
'/'
})
})
})
}
else
{
next
()
// 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
// if (hasPermission(store.getters.roles, to.meta.roles)) {
// next()
// } else {
// next({ path: '/401', replace: true, query: { noGoBack: true }})
// }
// 可删 ↑
}
}
}
else
{
...
...
ruoyi-ui/src/views/login.vue
View file @
4f33da2a
...
...
@@ -126,15 +126,12 @@ export default {
Cookies
.
remove
(
"password"
);
Cookies
.
remove
(
'rememberMe'
);
}
this
.
$store
.
dispatch
(
"Login"
,
this
.
loginForm
)
.
then
(()
=>
{
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
});
})
.
catch
(()
=>
{
this
.
loading
=
false
;
this
.
getCode
();
});
this
.
$store
.
dispatch
(
"Login"
,
this
.
loginForm
).
then
(()
=>
{
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}).
catch
(()
=>
{
this
.
loading
=
false
;
this
.
getCode
();
});
}
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment