用户资料显示

This commit is contained in:
2025-11-14 20:50:25 +08:00
parent 710d72aefe
commit 4a69b2a5aa
4 changed files with 37 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-user"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0" /><path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2" /></svg>

After

Width:  |  Height:  |  Size: 401 B

@@ -182,14 +182,31 @@ onMounted(() => {
data-bs-toggle="dropdown"
aria-label="Open user menu"
>
<span
<img
:src="
userStore.userInfo
? userStore.userInfo.AvatarPath
: '/ava.svg'
"
alt=""
class="avatar avatar-sm"
style="background-image: url(./static/avatars/000m.jpg)"
>
</span>
/>
<div class="d-none d-xl-block ps-2">
<div>Paweł Kuna</div>
<div class="mt-1 small text-secondary">UI Designer</div>
<div>
{{
userStore.userInfo
? userStore.userInfo.Username
: userStore.user?.Name
}}
</div>
<div class="mt-1 small text-secondary">
{{
userStore.userInfo
? userStore.userInfo.FirstName
: userStore.user?.Email
}}
</div>
</div>
</div>
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
+3
View File
@@ -8,6 +8,7 @@ import { my_network_func } from "@/my_network_func";
export const useUserStore = defineStore("user", () => {
// 状态 (State)
const userInfo = ref(null);
const user =ref(null)
const userCookie = ref(null);
const isLoggedIn = ref(false);
@@ -29,6 +30,7 @@ export const useUserStore = defineStore("user", () => {
case 200:
switch (r.data.err_code) {
case 0:
user.value=r.data.return.user
if(r.data.return.userInfo){
userInfo.value=r.data.return.userInfo
}else{
@@ -86,6 +88,7 @@ export const useUserStore = defineStore("user", () => {
};
return {
user,
userInfo,
userCookie,
isLoggedIn,