1.初次登录必须修改密码

This commit is contained in:
1638245306
2024-11-06 13:09:09 +08:00
parent 436a722ce8
commit 421e89823a
8 changed files with 49 additions and 13 deletions

View File

@@ -15,6 +15,7 @@ export const useUserInfo = defineStore('userInfo', {
email: '',
mobile: '',
gender: '',
pwd_change_count:null,
dept_info: {
dept_id: 0,
dept_name: '',
@@ -29,16 +30,19 @@ export const useUserInfo = defineStore('userInfo', {
isSocketOpen: false
}),
actions: {
async updateUserInfos() {
let userInfos: any = await this.getApiUserInfo();
this.userInfos.username = userInfos.data.name;
this.userInfos.avatar = userInfos.data.avatar;
this.userInfos.name = userInfos.data.name;
this.userInfos.email = userInfos.data.email;
this.userInfos.mobile = userInfos.data.mobile;
this.userInfos.gender = userInfos.data.gender;
this.userInfos.dept_info = userInfos.data.dept_info;
this.userInfos.role_info = userInfos.data.role_info;
async setPwdChangeCount(count: number) {
this.userInfos.pwd_change_count = count;
},
async updateUserInfos(userInfos:any) {
this.userInfos.username = userInfos.name;
this.userInfos.avatar = userInfos.avatar;
this.userInfos.name = userInfos.name;
this.userInfos.email = userInfos.email;
this.userInfos.mobile = userInfos.mobile;
this.userInfos.gender = userInfos.gender;
this.userInfos.dept_info = userInfos.dept_info;
this.userInfos.role_info = userInfos.role_info;
this.userInfos.pwd_change_count = userInfos.pwd_change_count;
Session.set('userInfo', this.userInfos);
},
async setUserInfos() {
@@ -55,6 +59,7 @@ export const useUserInfo = defineStore('userInfo', {
this.userInfos.gender = userInfos.data.gender;
this.userInfos.dept_info = userInfos.data.dept_info;
this.userInfos.role_info = userInfos.data.role_info;
this.userInfos.pwd_change_count = userInfos.data.pwd_change_count;
Session.set('userInfo', this.userInfos);
}
},
@@ -65,7 +70,18 @@ export const useUserInfo = defineStore('userInfo', {
return request({
url: '/api/system/user/user_info/',
method: 'get',
});
}).then((res:any)=>{
this.userInfos.username = res.data.name;
this.userInfos.avatar = res.data.avatar;
this.userInfos.name = res.data.name;
this.userInfos.email = res.data.email;
this.userInfos.mobile = res.data.mobile;
this.userInfos.gender = res.data.gender;
this.userInfos.dept_info = res.data.dept_info;
this.userInfos.role_info = res.data.role_info;
this.userInfos.pwd_change_count = res.data.pwd_change_count;
Session.set('userInfo', this.userInfos);
})
},
},
});