Commit 70343bb6 authored by 罗超's avatar 罗超

支持用户信息动态更新

parent 965eec33
......@@ -116,6 +116,11 @@ service.interceptors.response.use(
useUserStore().setUserLoginOut()
}, 1000);
}
if(response.data.attach){
if(response.data.attach.userinfo){
useUserStore().setOnlyUserInfo(response.data.attach.userinfo)
}
}
datas = response
return Promise.resolve(datas)
} else {
......
......@@ -98,6 +98,15 @@ export const useUserStore = defineStore('user', {
this.userInfo.logo = ENTERPRISE_DEFAULT_HEADER
}
},
setOnlyUserInfo(userinfo:any){
this.userInfo = userinfo
if(!this.userInfo.photo || !this.userInfo.photo.includes('http://')|| !this.userInfo.photo.includes('https://')){
this.userInfo.photo = USER_DEFAULT_HEADER
}
if(!this.userInfo.logo || !this.userInfo.logo.includes('http://')|| !this.userInfo.logo.includes('https://')){
this.userInfo.logo = ENTERPRISE_DEFAULT_HEADER
}
},
async setUserPasswordLoginAsync(account:string,pwd:string,tid:string='') {
try {
let response = await UserService.PasswordLoginAsync(account,pwd,tid)
......
......@@ -208,7 +208,6 @@ import InviteMember from "@/views/components/Team/InviteMember.vue";
import JoinEnterprise from "@/views/components/Team/JoinEnterprise.vue";
import ExitTenant from "@/views/components/Team/ExitTenant.vue";
import FindTeam from "@/views/components/Team/FindTeam.vue";
import UserServices from "@/services/UserService";
const { userInfo } = storeToRefs(useUserStore());
......@@ -271,11 +270,6 @@ const redicetTo = (path:string)=>{
path
})
}
const testHandler = async()=>{
const response = await UserServices.CreateTemplateTokenAsync()
console.log(response.data.data)
}
testHandler()
</script>
<style>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment