吉安感知网项目-前端
chenyao
yesterday a53ece5036c1fa61a63fe5f9e0cd3519210ab928
applications/drone-command/src/store/modules/user.js
@@ -8,7 +8,7 @@
} 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,
@@ -29,7 +29,8 @@
import md5 from 'js-md5'
// 5是反制无人机菜单,7是系统菜单
const sysType = 5
const sysType = localStorage.getItem('sysType') || 5
const user = {
  state: {
    tenantId: getStore({ name: 'tenantId' }) || '',
@@ -258,21 +259,13 @@
      })
    },
    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))
@@ -281,7 +274,7 @@
          dispatch('GetButtons')
          resolve(menu)
        }).catch(err => {
          errLogOut()
               logOutFun()
        })
      })
    },