| | |
| | | name: '', |
| | | avatar: '', |
| | | roles: [], |
| | | permissions: [] |
| | | permissions: [], |
| | | // routeId: null |
| | | }, |
| | | |
| | | mutations: { |
| | |
| | | }, |
| | | SET_PERMISSIONS: (state, permissions) => { |
| | | state.permissions = permissions |
| | | } |
| | | }, |
| | | // SET_ROUTE_ID(state, id) { |
| | | // state.routeId = id; |
| | | // } |
| | | }, |
| | | |
| | | actions: { |
| | |
| | | const uuid = userInfo.uuid |
| | | const type = userInfo.type |
| | | const mobile = userInfo.mobile |
| | | const hospId = userInfo.hospId |
| | | return new Promise((resolve, reject) => { |
| | | if(userInfo.username.length === 12){ |
| | | getlogin(username, password, code, uuid,type,mobile).then(res => { |
| | | getlogin(username, password, code, uuid,type,mobile,hospId).then(res => { |
| | | setToken(res.token) |
| | | commit('SET_TOKEN', res.token); |
| | | resolve(res) |
| | |
| | | reject(error) |
| | | }) |
| | | }else{ |
| | | login(username, password, code, uuid,type,mobile).then(res => { |
| | | login(username, password, code, uuid,type,mobile,hospId).then(res => { |
| | | setToken(res.token) |
| | | commit('SET_TOKEN', res.token) |
| | | // commit('SET_ROUTE_ID', hospId) |
| | | resolve(res) |
| | | }).catch(error => { |
| | | reject(error) |
| | |
| | | commit('SET_TOKEN', '') |
| | | commit('SET_ROLES', []) |
| | | commit('SET_PERMISSIONS', []) |
| | | // commit('SET_ROUTE_ID', []) |
| | | removeToken() |
| | | resolve() |
| | | }).catch(error => { |