feat: 图标支持根据语言上传对应图标

This commit is contained in:
TsMask
2023-12-04 16:54:49 +08:00
parent c16a1675f0
commit 96d6cfcfa2
7 changed files with 188 additions and 147 deletions

View File

@@ -23,7 +23,8 @@ import { getServerTime } from '@/api';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { onMounted } from 'vue';
import { parseDateToStr } from '@/utils/date-utils';
const { t } = useI18n();
import { parseUrlPath } from '@/plugins/file-static-url';
const { t, currentLocale } = useI18n();
const routerStore = useRouterStore();
const tabsStore = useTabsStore();
const appStore = useAppStore();
@@ -121,6 +122,35 @@ function fnComponentSetName(component: any, to: any) {
// 清空导航栏标签
tabsStore.clear();
// LOGO地址
const logoUrl = computed(() => {
let url =
appStore.logoType === 'brand'
? parseUrlPath(appStore.filePathBrand)
: parseUrlPath(appStore.filePathIcon);
if (url.indexOf('{language}') === -1) {
return url;
}
// 语言参数替换
const local = currentLocale.value;
const lang = local.split('_')[0];
return url.replace('{language}', lang);
});
// 系统使用手册地址
const helpDocUrl = computed(() => {
let url = parseUrlPath(appStore.helpDoc);
if (url.indexOf('{language}') === -1) {
return url;
}
// 语言参数替换
const local = currentLocale.value;
const lang = local.split('_')[0];
return url.replace('{language}', lang);
});
/**系统使用手册跳转 */
function fnClickHelpDoc(language?: string) {
const routeData = router.resolve({ name: 'HelpDoc' });
@@ -220,7 +250,7 @@ document.addEventListener('visibilitychange', function () {
>
<img
class="logo-icon"
:src="appStore.getLOGOIcon"
:src="logoUrl"
:alt="appStore.appName"
:title="appStore.appName"
/>
@@ -231,7 +261,7 @@ document.addEventListener('visibilitychange', function () {
<template v-if="appStore.logoType === 'brand'">
<img
class="logo-brand"
:src="appStore.getLOGOBrand"
:src="logoUrl"
:alt="appStore.appName"
:title="appStore.appName"
/>
@@ -300,7 +330,7 @@ document.addEventListener('visibilitychange', function () {
type="link"
size="small"
@click="fnClickHelpDoc()"
v-if="appStore.getHelpDoc !== '#'"
v-if="helpDocUrl !== '#'"
>
{{ t('loayouts.basic.helpDoc') }}
</a-button>