refactor: improve formatting and consistency in index.vue
This commit is contained in:
parent
ea085a3832
commit
bc0b1fb209
@ -140,6 +140,8 @@ import QrCodeTab from '@/views/login/scanCompinents/QrCodeTab.vue'
|
|||||||
import {MsgConfirm, MsgError} from '@/utils/message.ts'
|
import {MsgConfirm, MsgError} from '@/utils/message.ts'
|
||||||
import * as dd from 'dingtalk-jsapi'
|
import * as dd from 'dingtalk-jsapi'
|
||||||
import {loadScript} from '@/utils/common'
|
import {loadScript} from '@/utils/common'
|
||||||
|
import {hasPermission} from "@/utils/permission";
|
||||||
|
import {RoleConst} from "@/utils/permission/data.ts";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const {login, user, theme} = useStore()
|
const {login, user, theme} = useStore()
|
||||||
@ -190,7 +192,12 @@ const loginHandle = () => {
|
|||||||
login.asyncLogin(loginForm.value, loading).then(() => {
|
login.asyncLogin(loginForm.value, loading).then(() => {
|
||||||
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
|
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
|
||||||
localStorage.setItem('workspace_id', 'default')
|
localStorage.setItem('workspace_id', 'default')
|
||||||
|
if (hasPermission([RoleConst.ADMIN, RoleConst.EXTENDS_ADMIN], 'OR')) {
|
||||||
|
router.push({name: 'user'})
|
||||||
|
} else {
|
||||||
router.push({name: 'home'})
|
router.push({name: 'home'})
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -273,7 +280,8 @@ function redirectAuth(authType: string) {
|
|||||||
window.location.href = url
|
window.location.href = url
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user