fix: 用户管理页面
This commit is contained in:
@@ -107,7 +107,7 @@ const useUserStore = defineStore('user', {
|
||||
// 登录
|
||||
async fnLogin(loginBody: Record<string, string>) {
|
||||
const res = await login(loginBody);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res.code === 1 && res.data) {
|
||||
const token = res.data[TOKEN_RESPONSE_FIELD];
|
||||
setToken(token);
|
||||
this.token = token;
|
||||
@@ -117,17 +117,17 @@ const useUserStore = defineStore('user', {
|
||||
// 获取用户信息
|
||||
async fnGetInfo() {
|
||||
const res = await getInfo();
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res.code === 1 && res.data) {
|
||||
const { user, roles, permissions } = res.data;
|
||||
// 登录账号
|
||||
this.userName = user.userName;
|
||||
this.userName = user.accountId;
|
||||
// 用户头像
|
||||
this.avatar = user.avatar;
|
||||
// 基础信息
|
||||
this.nickName = user.nickName;
|
||||
this.phonenumber = user.phonenumber;
|
||||
this.nickName = user.name;
|
||||
this.phonenumber = user.phone;
|
||||
this.email = user.email;
|
||||
this.sex = user.sex;
|
||||
this.sex = user.gender;
|
||||
|
||||
// 验证返回的roles是否是一个非空数组
|
||||
if (Array.isArray(roles) && roles.length > 0) {
|
||||
@@ -139,14 +139,14 @@ const useUserStore = defineStore('user', {
|
||||
}
|
||||
|
||||
// 水印文字信息=用户昵称 手机号
|
||||
let waterMarkContent = this.nickName;
|
||||
let waterMarkContent = this.userName;
|
||||
if (this.phonenumber) {
|
||||
waterMarkContent = `${this.nickName} ${this.phonenumber}`;
|
||||
waterMarkContent = `${this.userName} ${this.phonenumber}`;
|
||||
}
|
||||
useLayoutStore().changeWaterMark(waterMarkContent);
|
||||
}
|
||||
// 网络错误时退出登录状态
|
||||
if (res.code === 500) {
|
||||
if (res.code === 0) {
|
||||
removeToken();
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user