Commit 9854debaff1cdbf4afabd2012ea3a74b29225200

Authored by fengwotao
1 parent 3731f6aa

perf(src/components): 优化个人头像展示

1 <template> 1 <template>
2 <n-dropdown trigger="hover" @select="handleSelect" :show-arrow="true" :options="options"> 2 <n-dropdown trigger="hover" @select="handleSelect" :show-arrow="true" :options="options">
3 <div class="user-info-box"> 3 <div class="user-info-box">
4 - <person-icon v-if="fallback"></person-icon> 4 + <person-icon v-if="!avatarLogo"></person-icon>
5 <n-avatar 5 <n-avatar
6 - v-if="!fallback" 6 + v-else
7 round 7 round
8 object-fit="cover" 8 object-fit="cover"
9 size="medium" 9 size="medium"
@@ -20,24 +20,26 @@ @@ -20,24 +20,26 @@
20 </template> 20 </template>
21 21
22 <script lang="ts" setup> 22 <script lang="ts" setup>
23 -import { h, ref, computed } from 'vue' 23 +import { h, ref, onMounted } from 'vue'
24 import { NAvatar, NText } from 'naive-ui' 24 import { NAvatar, NText } from 'naive-ui'
25 import { renderIcon } from '@/utils' 25 import { renderIcon } from '@/utils'
26 -import { logout, renderLang } from '@/utils' 26 +import { renderLang } from '@/utils'
27 import { GoSystemSet } from '@/components/GoSystemSet/index' 27 import { GoSystemSet } from '@/components/GoSystemSet/index'
28 import { GoSystemInfo } from '@/components/GoSystemInfo/index' 28 import { GoSystemInfo } from '@/components/GoSystemInfo/index'
29 import Person from './person.png' 29 import Person from './person.png'
30 import { icon } from '@/plugins' 30 import { icon } from '@/plugins'
31 import { useUserStore } from '@/store/external/modules/user' 31 import { useUserStore } from '@/store/external/modules/user'
32 import { useSyncRemote } from '@/views/chart/hooks/external/useRemote.hook' 32 import { useSyncRemote } from '@/views/chart/hooks/external/useRemote.hook'
33 -const { ChatboxEllipsesIcon, PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5 33 +const { PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5
34 34
35 const t = window['$t'] 35 const t = window['$t']
36 36
37 const { dataSyncUpdate } = useSyncRemote() 37 const { dataSyncUpdate } = useSyncRemote()
38 38
39 const modelShowInfo = ref(false) 39 const modelShowInfo = ref(false)
  40 +
40 const modelShow = ref(false) 41 const modelShow = ref(false)
  42 +
41 const avatarLogo = ref('') 43 const avatarLogo = ref('')
42 44
43 // 是否失败 45 // 是否失败
@@ -69,6 +71,11 @@ const renderUserInfo = () => { @@ -69,6 +71,11 @@ const renderUserInfo = () => {
69 ] 71 ]
70 ) 72 )
71 } 73 }
  74 +
  75 +onMounted(() => {
  76 + renderUserInfo()
  77 +})
  78 +
72 const options = ref([ 79 const options = ref([
73 { 80 {
74 label: '我的信息', 81 label: '我的信息',
@@ -124,6 +131,7 @@ const sysInfoHandle = () => { @@ -124,6 +131,7 @@ const sysInfoHandle = () => {
124 131
125 // THINGS_KIT 修改退出登录 132 // THINGS_KIT 修改退出登录
126 const userStore = useUserStore() 133 const userStore = useUserStore()
  134 +
127 const handleSelect = (key: string) => { 135 const handleSelect = (key: string) => {
128 switch (key) { 136 switch (key) {
129 case 'contact': 137 case 'contact':