f1f8518985
feat(auth): 添加用户权限获取接口并完善JWT令牌角色信息 - 在JWT令牌中添加用户角色信息 - 新增get_my_permissions接口用于获取当前用户权限码列表 - 重构认证回调逻辑,增加错误日志记录 - 更新用户信息获取接口使用Authorization头验证 ```
32 lines
952 B
JavaScript
32 lines
952 B
JavaScript
/**
|
|
* 封装 ElMessage,在 iOS standalone 模式下自动加上顶栏+刘海偏移
|
|
*/
|
|
import { ElMessage as _ElMessage } from 'element-plus'
|
|
|
|
const isStandalone = window.navigator.standalone === true ||
|
|
window.matchMedia('(display-mode: standalone)').matches
|
|
|
|
function getOffset() {
|
|
if (!isStandalone) return 20
|
|
const sat = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--sat')) || 0
|
|
return 52 + sat + 8
|
|
}
|
|
|
|
function message(opts) {
|
|
const offset = getOffset()
|
|
if (typeof opts === 'string') return _ElMessage({ message: opts, offset })
|
|
return _ElMessage({ offset, ...opts })
|
|
}
|
|
|
|
;['success', 'warning', 'info', 'error'].forEach(type => {
|
|
message[type] = (opts) => {
|
|
const offset = getOffset()
|
|
if (typeof opts === 'string') return _ElMessage[type]({ message: opts, offset })
|
|
return _ElMessage[type]({ offset, ...opts })
|
|
}
|
|
})
|
|
|
|
message.closeAll = _ElMessage.closeAll
|
|
|
|
export { message as ElMessage }
|