Commit 211a112e8188d442909d5b922a07a1efd2124916
1 parent
cbeee0f7
fix: 用户默认头像
Showing
1 changed file
with
5 additions
and
4 deletions
yudao-ui-admin-vue3/src/views/Home/Index.vue
| ... | ... | @@ -167,20 +167,21 @@ import { EChartsOption } from 'echarts' |
| 167 | 167 | import { ElRow, ElCol, ElSkeleton, ElCard, ElDivider, ElLink } from 'element-plus' |
| 168 | 168 | import { formatTime } from '@/utils' |
| 169 | 169 | import { useI18n } from '@/hooks/web/useI18n' |
| 170 | -import { CACHE_KEY, useCache } from '@/hooks/web/useCache' | |
| 170 | +import { useUserStore } from '@/store/modules/user' | |
| 171 | 171 | import { useWatermark } from '@/hooks/web/useWatermark' |
| 172 | 172 | import { Echart } from '@/components/Echart' |
| 173 | 173 | import { CountTo } from '@/components/CountTo' |
| 174 | 174 | import { Highlight } from '@/components/Highlight' |
| 175 | +import avatarImg from '@/assets/imgs/avatar.gif' | |
| 175 | 176 | import type { WorkplaceTotal, Project, Notice, Shortcut } from './types' |
| 176 | 177 | import { pieOptions, barOptions } from './echarts-data' |
| 177 | 178 | |
| 178 | 179 | const { t } = useI18n() |
| 179 | -const { wsCache } = useCache() | |
| 180 | +const userStore = useUserStore() | |
| 180 | 181 | const { setWatermark } = useWatermark() |
| 181 | 182 | const loading = ref(true) |
| 182 | -const avatar = wsCache.get(CACHE_KEY.USER).user.avatar | |
| 183 | -const username = wsCache.get(CACHE_KEY.USER).user.nickname | |
| 183 | +const avatar = userStore.getUser.avatar ? userStore.getUser.avatar : avatarImg | |
| 184 | +const username = userStore.getUser.nickname | |
| 184 | 185 | const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption |
| 185 | 186 | // 获取统计数 |
| 186 | 187 | let totalSate = reactive<WorkplaceTotal>({ | ... | ... |