标签:mic port closed reject UNC isp 比较 简单 测试
因为获取用户比较简单,只需要把用户名及权限组赋值即可(也许理解错误,如果发现请告知谢谢),
首先将src\api\usr.js中的url请求地址改为以下代码
export function getInfo(token) { return request({ url: ‘/api/abp/application-configuration‘, method: ‘get‘, params: { token } }) }
再将store\modules\user.js中getinfo方法改为以下代码
// get user info getInfo({ commit, state }) { return new Promise((resolve, reject) => { getInfo(state.token).then(response => { const { data } = response if (!data) { reject(‘Verification failed, please Login again.‘) } const { roles, name, avatar, introduction } = data // roles must be a non-empty array if (!roles || roles.length <= 0) { reject(‘getInfo: roles must be a non-null array!‘) } commit(‘SET_ROLES‘, roles) commit(‘SET_NAME‘, name) commit(‘SET_AVATAR‘, avatar) commit(‘SET_INTRODUCTION‘, introduction) resolve(data) }).catch(error => { reject(error) }) }) },
getInfo({ commit, state }) { return new Promise((resolve, reject) => { getInfo(state.token).then(response => { const { data } = response if (!data) { return reject(‘Verification failed, please Login again.‘) } this.name = data.currentUser.userName this.avatar = data.currentUser.roles commit(‘SET_NAME‘, this.name) commit(‘SET_AVATAR‘, this.avatar) resolve(data) }).catch(error => { reject(error) }) }) },
登录测试能正常显示用户名,为了能知道当前登录用户,我将用户名显示到了导航栏
Abp Vnext3 vue-admin-template(三获取用户信息)
标签:mic port closed reject UNC isp 比较 简单 测试
原文地址:https://www.cnblogs.com/liessay/p/13245718.html