| | |
| | | return new Promise((resolve, reject) => { |
| | | loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key, ).then(res => { |
| | | const data = res.data; |
| | | if (data.error_description) { |
| | | Message({ |
| | | message: data.error_description, |
| | | type: 'error' |
| | | }) |
| | | } else { |
| | | commit('SET_TOKEN', data.access_token); |
| | | commit('SET_REFRESH_TOKEN', data.refresh_token); |
| | | if(data.success){ |
| | | debugger; |
| | | commit('SET_TOKEN', data.obj.sessionInfo.token); |
| | | commit('SET_REFRESH_TOKEN', data.obj.sessionInfo.token); |
| | | commit('SET_TENANT_ID', data.tenant_id); |
| | | commit('SET_USER_INFO', data); |
| | | commit('SET_USER_INFO', data.obj.sessionInfo); |
| | | commit('DEL_ALL_TAG'); |
| | | commit('CLEAR_LOCK'); |
| | | }else { |
| | | Message({ |
| | | message: data.msg, |
| | | type: 'error' |
| | | }) |
| | | } |
| | | resolve(); |
| | | }).catch(error => { |
| | |
| | | }); |
| | | commit('SET_MENU_ALL', menu) |
| | | commit('SET_MENU', menu) |
| | | dispatch('GetButtons'); |
| | | //dispatch('GetButtons'); |
| | | resolve(menu) |
| | | }) |
| | | }) |
| | |
| | | }, |
| | | mutations: { |
| | | SET_TOKEN: (state, token) => { |
| | | debugger; |
| | | setToken(token); |
| | | state.token = token; |
| | | setStore({name: 'token', content: state.token}) |