| | |
| | | import { setStore, getStore } from '@/utils/store'; |
| | | import { validatenull } from '@/utils/validate'; |
| | | import { deepClone } from '@/utils/util'; |
| | | import defaultAva from '@/assets/images/defaultava.png' |
| | | import { |
| | | loginByUsername, |
| | | loginBySocial, |
| | |
| | | token: getStore({ name: 'token' }) || '', |
| | | refreshToken: getStore({ name: 'refreshToken' }) || '', |
| | | parentDeptInfo: getStore({ name: 'parentDeptInfo' }) || '', |
| | | |
| | | }, |
| | | actions: { |
| | | //根据用户名登录 |
| | |
| | | commit('CLEAR_LOCK'); |
| | | removeToken(); |
| | | removeRefreshToken(); |
| | | removeToken(); |
| | | resolve(); |
| | | }) |
| | | .catch(error => { |
| | |
| | | getRoutes(tenantId).then(res => { |
| | | const data = res.data.data; |
| | | let menu = deepClone(data); |
| | | menu.forEach(ele => formatPath(ele, true)); |
| | | menu?.forEach(ele => formatPath(ele, true)); |
| | | commit('SET_MENU', menu); |
| | | commit('SET_MENU_ALL', menu); |
| | | dispatch('GetButtons'); |
| | |
| | | state.userInfo = { user_name: 'unauth', role_name: 'unauth' }; |
| | | } else { |
| | | if (validatenull(userInfo.avatar)) { |
| | | userInfo.avatar = '/img/bg/img-logo.png'; |
| | | userInfo.avatar = defaultAva; |
| | | } |
| | | state.userInfo = userInfo; |
| | | } |