| | |
| | | } from '@/utils/auth' |
| | | import { setStore, getStore } from '@/utils/store' |
| | | import { validatenull } from '@/utils/validate' |
| | | import { deepClone } from '@/utils/util' |
| | | import { deepClone, logOutFun } from '@/utils/util' |
| | | import defaultAva from '@/assets/images/defaultava.png' |
| | | import { |
| | | loginByUsername, |
| | |
| | | }) |
| | | }, |
| | | GetMenu ({ commit, dispatch }, tenantId) { |
| | | const errLogOut = () => { |
| | | dispatch('LogOut').then(() => { |
| | | window.location.href = "/drone-command/login" |
| | | // env === 'development' |
| | | // ? window.location.href = "/drone-command/login" |
| | | // : window.location.replace(`${adminUrl}#/login`) |
| | | }) |
| | | } |
| | | return new Promise(resolve => { |
| | | getRoutes({tenantId,sysType}).then(res => { |
| | | const data = res.data.data; |
| | | let menu = deepClone(data); |
| | | if (!res.data?.data?.length){ |
| | | ElMessage.warning('当前角色没有配置菜单,请联系管理员配置') |
| | | errLogOut() |
| | | setTimeout(logOutFun,1500) |
| | | return |
| | | } |
| | | menu.forEach(ele => formatPath(ele, true)) |
| | |
| | | dispatch('GetButtons') |
| | | resolve(menu) |
| | | }).catch(err => { |
| | | errLogOut() |
| | | logOutFun() |
| | | }) |
| | | }) |
| | | }, |