feat(用户信息): 在侧边栏显示用户昵称和邮箱使用 userStore 中的用户数据替换硬编码的用户信息

This commit is contained in:
2026-04-12 22:14:09 +08:00
parent 1879f5ce32
commit 8972dfe8e7

View File

@@ -80,8 +80,8 @@
<div class="flex items-center"> <div class="flex items-center">
<el-avatar :size="32" /> <el-avatar :size="32" />
<div v-show="!appStore.collapsed" class="ml-3"> <div v-show="!appStore.collapsed" class="ml-3">
<div class="text-sm font-medium">123</div> <div class="text-sm font-medium">{{ userStore.nickname }}</div>
<div class="text-xs text-gray-500">12321</div> <div class="text-xs text-gray-500">{{ userStore.email }}</div>
</div> </div>
</div> </div>
<LucideIcon v-show="!appStore.collapsed" name="bolt" color="#808080" size="18"></LucideIcon> <LucideIcon v-show="!appStore.collapsed" name="bolt" color="#808080" size="18"></LucideIcon>
@@ -111,6 +111,7 @@ import { ref, onMounted, onUnmounted, computed, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useAppStore } from '@/stores/app'; import { useAppStore } from '@/stores/app';
import { useHistoryStore } from '@/stores/history'; import { useHistoryStore } from '@/stores/history';
import { useUserStore } from '@/stores/user';
import { House, Monitor, Expand, Fold, ChatDotRound, Search, Collection, Clock } from '@element-plus/icons-vue'; import { House, Monitor, Expand, Fold, ChatDotRound, Search, Collection, Clock } from '@element-plus/icons-vue';
import router from '@/router'; import router from '@/router';
import axios from 'axios'; import axios from 'axios';
@@ -118,6 +119,7 @@ import axios from 'axios';
const route = useRoute(); const route = useRoute();
const appStore = useAppStore(); const appStore = useAppStore();
const historyStore = useHistoryStore(); const historyStore = useHistoryStore();
const userStore = useUserStore();
const statusLabel = computed(() => { const statusLabel = computed(() => {
switch (appStore.serviceStatus) { switch (appStore.serviceStatus) {