Commit fbd61b48c751c24ca9aceba20d51244460322980

Authored by fengwotao
1 parent 9854deba

perf(src/components): 优化个人头像展示和web站点icon显示

@@ -5,7 +5,8 @@ enum Api { @@ -5,7 +5,8 @@ enum Api {
5 GET_DICT = '/dict_item', 5 GET_DICT = '/dict_item',
6 UPLOAD = '/oss/upload', 6 UPLOAD = '/oss/upload',
7 DOWNLOAD = '/oss/download_file/', 7 DOWNLOAD = '/oss/download_file/',
8 - AREALIST = '/area/list' 8 + AREALIST = '/area/list',
  9 + PLATFORM = '/platform/get'
9 } 10 }
10 11
11 export const getDictItemByCode = (value: string) => { 12 export const getDictItemByCode = (value: string) => {
@@ -28,9 +29,13 @@ export const downloadFile = (fileName: string) => { @@ -28,9 +29,13 @@ export const downloadFile = (fileName: string) => {
28 return defHttp.get({ url: `${Api.DOWNLOAD}${fileName}` }) 29 return defHttp.get({ url: `${Api.DOWNLOAD}${fileName}` })
29 } 30 }
30 31
  32 +//获取区域
31 export const getAreaList = (data: object) => { 33 export const getAreaList = (data: object) => {
32 return defHttp.post<any>({ 34 return defHttp.post<any>({
33 url: Api.AREALIST, 35 url: Api.AREALIST,
34 data 36 data
35 }) 37 })
36 } 38 }
  39 +
  40 +//获取企业定制
  41 +export const getPlatformInfo = () => defHttp.get({ url: Api.PLATFORM })
@@ -26,10 +26,13 @@ import { renderIcon } from '@/utils' @@ -26,10 +26,13 @@ import { renderIcon } from '@/utils'
26 import { 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'  
30 import { icon } from '@/plugins' 29 import { icon } from '@/plugins'
31 import { useUserStore } from '@/store/external/modules/user' 30 import { useUserStore } from '@/store/external/modules/user'
32 import { useSyncRemote } from '@/views/chart/hooks/external/useRemote.hook' 31 import { useSyncRemote } from '@/views/chart/hooks/external/useRemote.hook'
  32 +import { getPlatformInfo } from '@/api/external/common'
  33 +import Person from './person.png'
  34 +import DefaultWebsiteIcon from '../../../../public/favicon.ico'
  35 +
33 const { PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5 36 const { PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5
34 37
35 const t = window['$t'] 38 const t = window['$t']
@@ -73,9 +76,27 @@ const renderUserInfo = () => { @@ -73,9 +76,27 @@ const renderUserInfo = () => {
73 } 76 }
74 77
75 onMounted(() => { 78 onMounted(() => {
76 - renderUserInfo() 79 + try {
  80 + renderUserInfo()
  81 + //获取企业定制
  82 + getPlatform()
  83 + } finally {
  84 + console.log()
  85 + }
77 }) 86 })
78 87
  88 +const getPlatform = async () => {
  89 + const rest = await getPlatformInfo()
  90 + replaceWebsiteIcon(rest?.icon)
  91 +}
  92 +
  93 +const replaceWebsiteIcon = (icon: string) => {
  94 + const linkEl = document.querySelectorAll('link[rel*="icon"]')
  95 + linkEl.forEach(item => {
  96 + item.setAttribute('href', icon || DefaultWebsiteIcon)
  97 + })
  98 +}
  99 +
79 const options = ref([ 100 const options = ref([
80 { 101 {
81 label: '我的信息', 102 label: '我的信息',