web登录注册修改
This commit is contained in:
@@ -19,11 +19,11 @@
|
||||
<!-- 已登录状态 -->
|
||||
<div class="user-info" v-else>
|
||||
<div class="user-avatar">
|
||||
<img :src="userAvatar" :alt="user?.username" v-if="userAvatar">
|
||||
<img :src="userAvatar" :alt="currentUser?.username" v-if="userAvatar">
|
||||
<span class="avatar-placeholder" v-else>{{ avatarText }}</span>
|
||||
</div>
|
||||
<div class="user-details" v-if="!collapsed">
|
||||
<div class="user-name">{{ user?.username }}</div>
|
||||
<div class="user-name">{{ currentUser?.username }}</div>
|
||||
<div class="user-role">{{ primaryRole }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -103,7 +103,9 @@ interface Props {
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
const user = computed(() => store.getters['auth/user']);
|
||||
|
||||
// 使用传入的 userinfo 或从 store 获取
|
||||
const currentUser = computed(() => props.userinfo || store.getters['auth/user']);
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits<{
|
||||
@@ -125,11 +127,12 @@ const isLoggedIn = computed(() => {
|
||||
});
|
||||
|
||||
const userAvatar = computed(() => {
|
||||
return props.userinfo?.avatar && props.userinfo?.avatar!='default' ? FILE_DOWNLOAD_URL + props.userinfo?.avatar : defaultAvatarImg;
|
||||
const avatar = currentUser.value?.avatar;
|
||||
return avatar && avatar !== 'default' ? FILE_DOWNLOAD_URL + avatar : defaultAvatarImg;
|
||||
});
|
||||
|
||||
const avatarText = computed(() => {
|
||||
const name = props.userinfo?.fullName || props.userinfo?.username || '';
|
||||
const name = currentUser.value?.fullName || currentUser.value?.username || '';
|
||||
return name.charAt(0).toUpperCase();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user