mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-08-22 17:29:47 +08:00
fixed router bug
This commit is contained in:
parent
94ae564008
commit
60fc4685a5
@ -42,8 +42,20 @@ export const permissionRouter = (router: Router) => {
|
||||
const { role } = storeToRefs(useSignin())
|
||||
const { meta } = to
|
||||
|
||||
const hasRole = () => {
|
||||
if (meta.role) {
|
||||
if (meta.role.length === 0) {
|
||||
return true
|
||||
} else {
|
||||
return meta.role.includes(role.value)
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if (token !== 'no') {
|
||||
if (meta?.role?.includes(role.value)) {
|
||||
if (hasRole()) {
|
||||
if (to.path === '/' || from.path === '/login') {
|
||||
if (route !== 'no') {
|
||||
next(route)
|
||||
|
@ -41,14 +41,14 @@ const Signin = defineComponent({
|
||||
|
||||
if (signin(signinForm.value) === 0) {
|
||||
setTimeout(() => {
|
||||
router.push('/dashboard')
|
||||
|
||||
useSpin(false)
|
||||
|
||||
window.$message.success(`欢迎${signinForm.value.name}登陆~`)
|
||||
|
||||
setCache('token', 'tokenValue')
|
||||
setCache('person', signinForm.value)
|
||||
|
||||
router.push('/dashboard')
|
||||
}, 2 * 1000)
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user