修改获取用户名称
This commit is contained in:
parent
790a5f8488
commit
b1eb82aff6
|
@ -10,7 +10,7 @@ const user = {
|
||||||
welcome: '',
|
welcome: '',
|
||||||
avatar: '',
|
avatar: '',
|
||||||
roles: [],
|
roles: [],
|
||||||
buttons: [], // 按钮权限
|
buttons: [], // 按钮权限
|
||||||
info: {}
|
info: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ const user = {
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// 登录
|
// 登录
|
||||||
Login ({ commit }, userInfo) {
|
Login({ commit }, userInfo) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
login(userInfo).then(response => {
|
login(userInfo).then(response => {
|
||||||
storage.set(ACCESS_TOKEN, response.token, 24 * 60 * 60 * 1000)
|
storage.set(ACCESS_TOKEN, response.token, 24 * 60 * 60 * 1000)
|
||||||
|
@ -51,7 +51,7 @@ const user = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
GetInfo ({ commit }) {
|
GetInfo({ commit }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getLoginUser().then(response => {
|
getLoginUser().then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
|
@ -59,7 +59,7 @@ const user = {
|
||||||
commit('SET_ROLES', 1)
|
commit('SET_ROLES', 1)
|
||||||
commit('SET_BUTTONS', data.permissions)
|
commit('SET_BUTTONS', data.permissions)
|
||||||
commit('SET_INFO', data)
|
commit('SET_INFO', data)
|
||||||
commit('SET_NAME', { name: data.userName, welcome: welcome() })
|
commit('SET_NAME', { name: data.user.userName, welcome: welcome() })
|
||||||
if (data.avatar != null) {
|
if (data.avatar != null) {
|
||||||
commit('SET_AVATAR', process.env.VUE_APP_API_BASE_URL + '/sysFileInfo/preview?id=' + data.avatar)
|
commit('SET_AVATAR', process.env.VUE_APP_API_BASE_URL + '/sysFileInfo/preview?id=' + data.avatar)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ const user = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 登出
|
// 登出
|
||||||
Logout ({ commit, state }) {
|
Logout({ commit, state }) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
logout().then(() => {
|
logout().then(() => {
|
||||||
resolve()
|
resolve()
|
||||||
|
|
Loading…
Reference in New Issue