fix: 用户默认头像

This commit is contained in:
xingyu4j 2022-12-07 17:50:18 +08:00
parent cbeee0f744
commit 211a112e81

View File

@ -167,20 +167,21 @@ import { EChartsOption } from 'echarts'
import { ElRow, ElCol, ElSkeleton, ElCard, ElDivider, ElLink } from 'element-plus' import { ElRow, ElCol, ElSkeleton, ElCard, ElDivider, ElLink } from 'element-plus'
import { formatTime } from '@/utils' import { formatTime } from '@/utils'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { useUserStore } from '@/store/modules/user'
import { useWatermark } from '@/hooks/web/useWatermark' import { useWatermark } from '@/hooks/web/useWatermark'
import { Echart } from '@/components/Echart' import { Echart } from '@/components/Echart'
import { CountTo } from '@/components/CountTo' import { CountTo } from '@/components/CountTo'
import { Highlight } from '@/components/Highlight' import { Highlight } from '@/components/Highlight'
import avatarImg from '@/assets/imgs/avatar.gif'
import type { WorkplaceTotal, Project, Notice, Shortcut } from './types' import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
import { pieOptions, barOptions } from './echarts-data' import { pieOptions, barOptions } from './echarts-data'
const { t } = useI18n() const { t } = useI18n()
const { wsCache } = useCache() const userStore = useUserStore()
const { setWatermark } = useWatermark() const { setWatermark } = useWatermark()
const loading = ref(true) const loading = ref(true)
const avatar = wsCache.get(CACHE_KEY.USER).user.avatar const avatar = userStore.getUser.avatar ? userStore.getUser.avatar : avatarImg
const username = wsCache.get(CACHE_KEY.USER).user.nickname const username = userStore.getUser.nickname
const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
// //
let totalSate = reactive<WorkplaceTotal>({ let totalSate = reactive<WorkplaceTotal>({