feat: 支持配置系统图标
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<div class="app-shell">
|
||||
<!-- 顶栏 -->
|
||||
<header class="topbar">
|
||||
<img class="topbar-icon" :src="appIconUrl" alt="" />
|
||||
<span class="topbar-name text-ellipsis">{{ appName }}</span>
|
||||
<div class="lang-wrap">
|
||||
<button class="lang" :aria-label="t('lang.switch')" :title="t('lang.switch')" @click.stop="langOpen = !langOpen">
|
||||
@@ -289,6 +290,7 @@ import dayjs from 'dayjs';
|
||||
import { fetchTrace, fetchAppInfo } from '@/api';
|
||||
import { setLocale, SUPPORTED_LOCALES } from '@/locales';
|
||||
import { openMediaViewer } from '@/composables/openMediaViewer';
|
||||
import { resolveAppIcon, setFavicon } from '@/utils/appIcon';
|
||||
|
||||
const route = useRoute();
|
||||
const { t, locale } = useI18n();
|
||||
@@ -296,6 +298,7 @@ const { t, locale } = useI18n();
|
||||
const loading = ref(true);
|
||||
const data = ref<any>(null);
|
||||
const appName = ref('');
|
||||
const appIconUrl = ref(resolveAppIcon());
|
||||
const filingInfo = ref('');
|
||||
const toast = ref('');
|
||||
|
||||
@@ -578,11 +581,14 @@ onMounted(async () => {
|
||||
try {
|
||||
const info = await fetchAppInfo();
|
||||
appName.value = info?.appName || t('app.name');
|
||||
appIconUrl.value = resolveAppIcon(info?.appIconUrl);
|
||||
setFavicon(appIconUrl.value);
|
||||
filingInfo.value = info?.filingInfo || '';
|
||||
const iv = Number(info?.carouselInterval);
|
||||
if (Number.isFinite(iv) && iv >= 0) carouselInterval.value = iv;
|
||||
} catch {
|
||||
appName.value = t('app.name');
|
||||
setFavicon(appIconUrl.value);
|
||||
filingInfo.value = '';
|
||||
}
|
||||
document.addEventListener('click', closeLangMenu);
|
||||
@@ -626,6 +632,14 @@ watch(
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
}
|
||||
.topbar-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 7px;
|
||||
object-fit: cover;
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.lang-wrap {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user