Commit fbd61b48c751c24ca9aceba20d51244460322980
1 parent
9854deba
perf(src/components): 优化个人头像展示和web站点icon显示
Showing
2 changed files
with
29 additions
and
3 deletions
| ... | ... | @@ -5,7 +5,8 @@ enum Api { |
| 5 | 5 | GET_DICT = '/dict_item', |
| 6 | 6 | UPLOAD = '/oss/upload', |
| 7 | 7 | DOWNLOAD = '/oss/download_file/', |
| 8 | - AREALIST = '/area/list' | |
| 8 | + AREALIST = '/area/list', | |
| 9 | + PLATFORM = '/platform/get' | |
| 9 | 10 | } |
| 10 | 11 | |
| 11 | 12 | export const getDictItemByCode = (value: string) => { |
| ... | ... | @@ -28,9 +29,13 @@ export const downloadFile = (fileName: string) => { |
| 28 | 29 | return defHttp.get({ url: `${Api.DOWNLOAD}${fileName}` }) |
| 29 | 30 | } |
| 30 | 31 | |
| 32 | +//获取区域 | |
| 31 | 33 | export const getAreaList = (data: object) => { |
| 32 | 34 | return defHttp.post<any>({ |
| 33 | 35 | url: Api.AREALIST, |
| 34 | 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 | 26 | import { renderLang } from '@/utils' |
| 27 | 27 | import { GoSystemSet } from '@/components/GoSystemSet/index' |
| 28 | 28 | import { GoSystemInfo } from '@/components/GoSystemInfo/index' |
| 29 | -import Person from './person.png' | |
| 30 | 29 | import { icon } from '@/plugins' |
| 31 | 30 | import { useUserStore } from '@/store/external/modules/user' |
| 32 | 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 | 36 | const { PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5 |
| 34 | 37 | |
| 35 | 38 | const t = window['$t'] |
| ... | ... | @@ -73,9 +76,27 @@ const renderUserInfo = () => { |
| 73 | 76 | } |
| 74 | 77 | |
| 75 | 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 | 100 | const options = ref([ |
| 80 | 101 | { |
| 81 | 102 | label: '我的信息', | ... | ... |