| | |
| | | import {Message} from 'element-ui' |
| | | import {setStore, getStore} from '@/util/store' |
| | | import {isURL, validatenull} from '@/util/validate' |
| | | import {deepClone,queryStringToObject} from '@/util/util' |
| | | import {deepClone, queryStringToObject} from '@/util/util' |
| | | import website from '@/config/website' |
| | | import {loginByUsername, loginBySocial, loginBySso, getUserInfo, logout, refreshToken, getButtons} from '@/api/user' |
| | | import {getTopMenu, getRoutes} from '@/api/system/menu' |
| | |
| | | item.pathValue = item.path; |
| | | item.path = '/' + item.code; |
| | | item.query = {}; // 初始化 item.query |
| | | if(item.pathValue.indexOf('?')!=-1) { |
| | | if (item.pathValue.indexOf('?') != -1) { |
| | | item.query = queryStringToObject(item.pathValue) |
| | | } |
| | | if (item.children && item.children.length > 0) { |
| | |
| | | //根据用户名登录 |
| | | LoginByUsername({commit}, userInfo) { |
| | | return new Promise((resolve, reject) => { |
| | | let passwordDes = func.encryptData(userInfo.password,'daliantan0v0vcip') |
| | | loginByUsername(userInfo.deptId, userInfo.roleId, userInfo.username,passwordDes, userInfo.type, userInfo.key,).then(res => { |
| | | let passwordDes = func.encryptData(userInfo.password, 'daliantan0v0vcip') |
| | | loginByUsername(userInfo.deptId, userInfo.roleId, userInfo.username, passwordDes, userInfo.type, userInfo.key,).then(res => { |
| | | const data = res.data; |
| | | if (data.obj.failCode === 'loginSuccess') { |
| | | if (data.obj.failCode === 'loginSuccess' || data.obj.failCode === 'passwordRemainDay') { |
| | | commit('SET_TOKEN', data.obj.tokenVO.accessToken); |
| | | commit('SET_REFRESH_TOKEN', data.obj.tokenVO.accessToken); |
| | | commit('DEL_ALL_TAG'); |
| | |
| | | return new Promise((resolve, reject) => { |
| | | getUserInfo().then((res) => { |
| | | const data = res.data.data; |
| | | console.log('user',res) |
| | | console.log('user', res) |
| | | // commit('SET_USER_INFO', data.roles); |
| | | resolve(data); |
| | | }).catch(err => { |
| | |
| | | SET_ROLES: (state, roles) => { |
| | | state.roles = roles; |
| | | }, |
| | | |
| | | SET_PERMISSION: (state, permission) => { |
| | | let permission_new = {}; |
| | | permission.forEach(item => { |
| | | let children = {}; |
| | | if (item.children && item.children.length > 0) { |
| | | item.children.forEach(child => { |
| | | Vue.set(children, child.code, true); |
| | | }); |
| | | } |
| | | Vue.set(permission_new, item.code, children); |
| | | }); |
| | | state.permission = permission_new; |
| | | setStore({name: "permission", content: permission_new}); |
| | | }, |
| | | } |
| | | |
| | | } |
| | | export default user |