mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-07-15 19:35:07 +08:00
Merge branch 'master' of https://gitee.com/yudaocode/yudao-ui-admin-vue3 into feature/bpm
# Conflicts: # src/components/bpmnProcessDesigner/package/theme/index.scss
This commit is contained in:
@ -10,7 +10,8 @@ const RefreshTokenKey = 'REFRESH_TOKEN'
|
||||
// 获取token
|
||||
export const getAccessToken = () => {
|
||||
// 此处与TokenKey相同,此写法解决初始化时Cookies中不存在TokenKey报错
|
||||
return wsCache.get(AccessTokenKey) ? wsCache.get(AccessTokenKey) : wsCache.get('ACCESS_TOKEN')
|
||||
const accessToken = wsCache.get(AccessTokenKey)
|
||||
return accessToken ? accessToken : wsCache.get('ACCESS_TOKEN')
|
||||
}
|
||||
|
||||
// 刷新token
|
||||
|
@ -98,8 +98,9 @@ export const isServer = typeof window === 'undefined'
|
||||
export const isClient = !isServer
|
||||
|
||||
export const isUrl = (path: string): boolean => {
|
||||
// fix:修复hash路由无法跳转的问题
|
||||
const reg =
|
||||
/(((^https?:(?:\/\/)?)(?:[-:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&%@.\w_]*)#?(?:[\w]*))?)$/
|
||||
/(((^https?:(?:\/\/)?)(?:[-:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%#\/.\w-_]*)?\??(?:[-\+=&%@.\w_]*)#?(?:[\w]*))?)$/
|
||||
return reg.test(path)
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,9 @@ export function checkPermi(value: string[]) {
|
||||
const { wsCache } = useCache()
|
||||
const permissionDatas = value
|
||||
const all_permission = '*:*:*'
|
||||
const permissions = wsCache.get(CACHE_KEY.USER).permissions
|
||||
const hasPermission = permissions.some((permission) => {
|
||||
const userInfo = wsCache.get(CACHE_KEY.USER)
|
||||
const permissions = userInfo?.permissions || []
|
||||
const hasPermission = permissions.some((permission: string) => {
|
||||
return all_permission === permission || permissionDatas.includes(permission)
|
||||
})
|
||||
return !!hasPermission
|
||||
@ -32,9 +33,10 @@ export function checkRole(value: string[]) {
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const { wsCache } = useCache()
|
||||
const permissionRoles = value
|
||||
const super_admin = 'admin'
|
||||
const roles = wsCache.get(CACHE_KEY.USER).roles
|
||||
const hasRole = roles.some((role) => {
|
||||
const super_admin = 'super_admin'
|
||||
const userInfo = wsCache.get(CACHE_KEY.USER)
|
||||
const roles = userInfo?.roles || []
|
||||
const hasRole = roles.some((role: string) => {
|
||||
return super_admin === role || permissionRoles.includes(role)
|
||||
})
|
||||
return !!hasRole
|
||||
|
Reference in New Issue
Block a user