feat: 支持配置系统图标
This commit is contained in:
@@ -129,6 +129,7 @@
|
||||
- 最终验证补充(2026-07-04):重新执行 `pnpm build:shared`、`pnpm --filter @artveris/api build`、`pnpm --filter @artveris/admin build`、`pnpm --filter @artveris/client build`、`pnpm --filter @artveris/api test`、`git diff --check`,均通过(`git diff --check` 仅提示 `trace-code.service.ts` 行尾将由 CRLF 转 LF)。用真实登录 token 调用 `/api/trace-codes/export?artworkId=3` 下载 ZIP 并检查压缩包,确认包含 `{档案编号}_{YYYYMMDDHHmmss}.xlsx` 与 `images/{追溯码}.png`。
|
||||
- 追溯码导出 Excel 样式(2026-07-05):`TraceCodeService.exportCodes` 生成的 xlsx 中,表头和数据行统一垂直居中;“链接”列改为 Excel 超链接单元格(蓝色下划线,可单击跟踪链接)。导出仍为内存即时生成 ZIP,不落盘;已用真实接口导出并拆包检查 xlsx,确认存在 hyperlink 关系和 `vertical="center"` 样式。
|
||||
- 备案信息配置(2026-07-05):系统设置新增 `filingInfo`,默认“备案信息待补充”,超管可在后台「系统设置 / 基础设置 / 平台信息」中维护。`GET /settings/public` 下发 `filingInfo` 给客户端;后台管理页脚和客户端首页/溯源详情页脚均从设置读取备案信息,后续修改备案号无需改源代码。
|
||||
- 系统图标配置(2026-07-05):系统设置新增 `appIconUrl`,默认使用前端内置 `/app-icon.svg`。默认 SVG 图标为蓝绿渐变底、盾牌和金色艺术器形/印章元素,无底部横线;后台左上角导航图标、后台登录页图标、客户端首页图标、客户端溯源页顶部图标和浏览器 favicon 均从该设置读取。后台设置页可上传自定义图片/SVG 图标,上传接口已放行 `image/svg+xml` 并按 `.svg` 存储;清空图标设置会回退默认内置图标。
|
||||
|
||||
## 当前代码基准与注意事项
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="icon" type="image/svg+xml" href="/app-icon.svg" />
|
||||
<title>艺术品溯源平台</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<defs>
|
||||
<linearGradient id="bg" x1="12" y1="8" x2="52" y2="56" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1f3864"/>
|
||||
<stop offset="1" stop-color="#2f6b5e"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="seal" x1="20" y1="16" x2="44" y2="48" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#f7d77a"/>
|
||||
<stop offset="1" stop-color="#c89b3c"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="64" height="64" rx="14" fill="url(#bg)"/>
|
||||
<path d="M32 12 47 20v13c0 9.5-5.8 16.5-15 19-9.2-2.5-15-9.5-15-19V20l15-8Z" fill="rgba(255,255,255,.12)" stroke="rgba(255,255,255,.42)" stroke-width="2"/>
|
||||
<circle cx="32" cy="31" r="12" fill="none" stroke="url(#seal)" stroke-width="3"/>
|
||||
<path d="M24 33c5.3-1.2 8.9-5.1 10.3-11.5 3.2 3.3 4.9 7.1 5.1 11.5-3.7-1.7-7-1.3-9.9 1.2-1.7 1.5-3.5 2.2-5.5 2.2V33Z" fill="url(#seal)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 917 B |
@@ -13,6 +13,10 @@ export const authApi = {
|
||||
post('/auth/change-password', data),
|
||||
};
|
||||
|
||||
export const appApi = {
|
||||
info: () => get<{ appName: string; appIconUrl: string }>('/app-info'),
|
||||
};
|
||||
|
||||
export const dashboardApi = {
|
||||
overview: (params?: object) => get('/dashboard/overview', params),
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
@expand="collapsed = false"
|
||||
>
|
||||
<div class="brand">
|
||||
<span class="brand-logo">艺</span>
|
||||
<img class="brand-logo" :src="appIconUrl" alt="" />
|
||||
<span v-show="!collapsed" class="brand-name text-ellipsis">{{ appName }}</span>
|
||||
</div>
|
||||
<n-menu
|
||||
@@ -76,6 +76,7 @@ import {
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { settingsApi } from '@/api';
|
||||
import { dialog } from '@/utils/feedback';
|
||||
import { resolveAppIcon, setFavicon } from '@/utils/appIcon';
|
||||
import LangSwitch from '@/components/LangSwitch.vue';
|
||||
import ThemeSwitch from '@/components/ThemeSwitch.vue';
|
||||
|
||||
@@ -86,6 +87,7 @@ const auth = useAuthStore();
|
||||
|
||||
const collapsed = ref(window.innerWidth < 900);
|
||||
const appName = ref(t('pages.login.title'));
|
||||
const appIconUrl = ref(resolveAppIcon());
|
||||
const filingInfo = ref('');
|
||||
|
||||
function renderIcon(icon: unknown) {
|
||||
@@ -139,20 +141,29 @@ function onUser(key: string) {
|
||||
}
|
||||
|
||||
let resizeHandler: () => void;
|
||||
async function loadSettings() {
|
||||
try {
|
||||
const s = await settingsApi.getAll();
|
||||
if (s.appName) appName.value = s.appName;
|
||||
appIconUrl.value = resolveAppIcon(s.appIconUrl);
|
||||
setFavicon(appIconUrl.value);
|
||||
filingInfo.value = s.filingInfo || '';
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
onMounted(async () => {
|
||||
resizeHandler = () => {
|
||||
collapsed.value = window.innerWidth < 900;
|
||||
};
|
||||
window.addEventListener('resize', resizeHandler);
|
||||
try {
|
||||
const s = await settingsApi.getAll();
|
||||
if (s.appName) appName.value = s.appName;
|
||||
filingInfo.value = s.filingInfo || '';
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
window.addEventListener('artveris-settings-updated', loadSettings);
|
||||
await loadSettings();
|
||||
});
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', resizeHandler);
|
||||
window.removeEventListener('artveris-settings-updated', loadSettings);
|
||||
});
|
||||
onUnmounted(() => window.removeEventListener('resize', resizeHandler));
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -164,15 +175,11 @@ onUnmounted(() => window.removeEventListener('resize', resizeHandler));
|
||||
padding: 0 16px;
|
||||
}
|
||||
.brand-logo {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
background: var(--brand);
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
object-fit: cover;
|
||||
background: #f6f8fb;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.brand-name {
|
||||
|
||||
@@ -347,6 +347,7 @@
|
||||
},
|
||||
"settings": {
|
||||
"appName": "Platform Name",
|
||||
"appIcon": "System Icon",
|
||||
"logRetentionDays": "Query Log Retention (days)",
|
||||
"operationLogRetentionDays": "Operation Log Retention (days)",
|
||||
"watermarkText": "Certificate Watermark",
|
||||
|
||||
@@ -347,6 +347,7 @@
|
||||
},
|
||||
"settings": {
|
||||
"appName": "平台名称",
|
||||
"appIcon": "系统图标",
|
||||
"logRetentionDays": "查询日志保留天数",
|
||||
"operationLogRetentionDays": "操作日志保留天数",
|
||||
"watermarkText": "证书水印文案",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
export const DEFAULT_APP_ICON_URL = '/app-icon.svg';
|
||||
|
||||
export function resolveAppIcon(url?: string | null): string {
|
||||
const value = String(url || '').trim();
|
||||
return value || DEFAULT_APP_ICON_URL;
|
||||
}
|
||||
|
||||
export function setFavicon(url?: string | null): void {
|
||||
const href = resolveAppIcon(url);
|
||||
const selectors = ['link[rel="icon"]', 'link[rel="shortcut icon"]'];
|
||||
let link = document.head.querySelector<HTMLLinkElement>(selectors.join(','));
|
||||
if (!link) {
|
||||
link = document.createElement('link');
|
||||
link.rel = 'icon';
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
link.type = href.endsWith('.svg') ? 'image/svg+xml' : '';
|
||||
link.href = href;
|
||||
}
|
||||
@@ -5,8 +5,8 @@
|
||||
</div>
|
||||
<div class="login-left">
|
||||
<div class="login-left-inner">
|
||||
<div class="logo">艺</div>
|
||||
<h1>{{ t('pages.login.title') }}</h1>
|
||||
<img class="logo" :src="appIconUrl" alt="" />
|
||||
<h1>{{ appName }}</h1>
|
||||
<p>{{ t('pages.login.subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,13 +44,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { FormInst, FormRules } from 'naive-ui';
|
||||
import { PersonOutline, LockClosedOutline } from '@vicons/ionicons5';
|
||||
import { appApi } from '@/api';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { message } from '@/utils/feedback';
|
||||
import { resolveAppIcon, setFavicon } from '@/utils/appIcon';
|
||||
import LangSwitch from '@/components/LangSwitch.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -60,6 +62,8 @@ const auth = useAuthStore();
|
||||
const formRef = ref<FormInst | null>(null);
|
||||
const form = ref({ username: '', password: '' });
|
||||
const loading = ref(false);
|
||||
const appName = ref(t('pages.login.title'));
|
||||
const appIconUrl = ref(resolveAppIcon());
|
||||
|
||||
const rules: FormRules = {
|
||||
username: { required: true, message: () => t('pages.login.placeholderUser'), trigger: 'blur' },
|
||||
@@ -83,6 +87,17 @@ async function onSubmit() {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const info = await appApi.info();
|
||||
appName.value = info.appName || t('pages.login.title');
|
||||
appIconUrl.value = resolveAppIcon(info.appIconUrl);
|
||||
setFavicon(appIconUrl.value);
|
||||
} catch {
|
||||
setFavicon(appIconUrl.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -115,11 +130,7 @@ async function onSubmit() {
|
||||
margin: 0 auto 24px;
|
||||
border-radius: 18px;
|
||||
background: rgba(255, 255, 255, 0.16);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 38px;
|
||||
font-weight: 700;
|
||||
object-fit: cover;
|
||||
}
|
||||
.login-left-inner h1 {
|
||||
font-size: 28px;
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<n-form-item :label="t('pages.settings.appName')">
|
||||
<n-input v-model:value="form.appName" class="control-wide" />
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('pages.settings.appIcon')">
|
||||
<div class="icon-setting">
|
||||
<img class="icon-preview" :src="currentIconUrl" alt="" />
|
||||
<media-upload v-model="form.appIconFiles" type="image" :max="1" />
|
||||
</div>
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('pages.settings.watermarkText')">
|
||||
<n-input v-model:value="form.watermarkText" class="control-wide" />
|
||||
</n-form-item>
|
||||
@@ -81,11 +87,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { computed, onMounted, reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { settingsApi } from '@/api';
|
||||
import { message } from '@/utils/feedback';
|
||||
import BackupRestorePanel from '@/components/BackupRestorePanel.vue';
|
||||
import MediaUpload from '@/components/MediaUpload.vue';
|
||||
import { DEFAULT_APP_ICON_URL, resolveAppIcon, setFavicon } from '@/utils/appIcon';
|
||||
|
||||
const { t } = useI18n();
|
||||
const saving = ref(false);
|
||||
@@ -95,6 +103,7 @@ const backupScheduleOptions = [
|
||||
];
|
||||
const form = reactive({
|
||||
appName: '',
|
||||
appIconFiles: [] as Array<{ key: string; url?: string; name?: string; type?: string }>,
|
||||
logRetentionDays: 365,
|
||||
operationLogRetentionDays: 180,
|
||||
watermarkText: '',
|
||||
@@ -109,6 +118,8 @@ const form = reactive({
|
||||
async function load() {
|
||||
const s = await settingsApi.getAll();
|
||||
form.appName = s.appName || '';
|
||||
const appIconUrl = s.appIconUrl || '';
|
||||
form.appIconFiles = appIconUrl && appIconUrl !== DEFAULT_APP_ICON_URL ? [{ key: appIconUrl, url: appIconUrl, name: t('pages.settings.appIcon'), type: 'image' }] : [];
|
||||
form.logRetentionDays = Number(s.logRetentionDays || 365);
|
||||
form.operationLogRetentionDays = Number(s.operationLogRetentionDays || 180);
|
||||
form.watermarkText = s.watermarkText || '';
|
||||
@@ -123,8 +134,10 @@ async function load() {
|
||||
async function save() {
|
||||
saving.value = true;
|
||||
try {
|
||||
const appIconUrl = form.appIconFiles[0]?.url || form.appIconFiles[0]?.key || '';
|
||||
await settingsApi.update({
|
||||
appName: form.appName,
|
||||
appIconUrl,
|
||||
logRetentionDays: String(form.logRetentionDays),
|
||||
operationLogRetentionDays: String(form.operationLogRetentionDays),
|
||||
watermarkText: form.watermarkText,
|
||||
@@ -135,6 +148,8 @@ async function save() {
|
||||
backupRetentionDays: String(form.backupRetentionDays),
|
||||
backupRetentionCount: String(form.backupRetentionCount),
|
||||
});
|
||||
setFavicon(appIconUrl);
|
||||
window.dispatchEvent(new CustomEvent('artveris-settings-updated'));
|
||||
message.success(t('pages.settings.saved'));
|
||||
} finally {
|
||||
saving.value = false;
|
||||
@@ -142,6 +157,8 @@ async function save() {
|
||||
}
|
||||
|
||||
onMounted(load);
|
||||
|
||||
const currentIconUrl = computed(() => resolveAppIcon(form.appIconFiles[0]?.url || form.appIconFiles[0]?.key));
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -229,6 +246,20 @@ onMounted(load);
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
.icon-setting {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
.icon-preview {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--n-border-color);
|
||||
object-fit: cover;
|
||||
background: #f6f8fb;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.switch-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -60,6 +60,7 @@ async function ensureUsers(): Promise<void> {
|
||||
async function ensureSettings(): Promise<void> {
|
||||
const defaults: Record<string, string> = {
|
||||
appName: process.env.APP_NAME || '艺术品溯源平台',
|
||||
appIconUrl: '/app-icon.svg',
|
||||
logRetentionDays: process.env.LOG_RETENTION_DAYS || '365',
|
||||
watermarkText,
|
||||
filingInfo: '备案信息待补充',
|
||||
|
||||
@@ -19,7 +19,7 @@ export class AppController {
|
||||
@Get('app-info')
|
||||
@ApiOperation({ summary: '应用基本信息(公开)' })
|
||||
async appInfo() {
|
||||
const appName = await this.settings.get('appName');
|
||||
return { appName };
|
||||
const all = await this.settings.getAll();
|
||||
return { appName: all.appName, appIconUrl: all.appIconUrl };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export class SettingsController {
|
||||
@ApiOperation({ summary: '获取公开设置(应用名等)' })
|
||||
async getPublic() {
|
||||
const all = await this.settingsService.getAll();
|
||||
return { appName: all.appName, carouselInterval: all.carouselInterval, filingInfo: all.filingInfo };
|
||||
return { appName: all.appName, appIconUrl: all.appIconUrl, carouselInterval: all.carouselInterval, filingInfo: all.filingInfo };
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
|
||||
@@ -4,6 +4,7 @@ import { PrismaService } from '../prisma/prisma.service';
|
||||
|
||||
const EDITABLE_KEYS = [
|
||||
'appName',
|
||||
'appIconUrl',
|
||||
'logRetentionDays',
|
||||
'operationLogRetentionDays',
|
||||
'watermarkText',
|
||||
@@ -26,6 +27,7 @@ export class SettingsService {
|
||||
const rows = await this.prisma.systemSetting.findMany();
|
||||
const map: Record<string, string> = {
|
||||
appName: this.config.get<string>('appName') || '',
|
||||
appIconUrl: '/app-icon.svg',
|
||||
logRetentionDays: String(this.config.get<number>('logRetentionDays') || 365),
|
||||
operationLogRetentionDays: '365',
|
||||
watermarkText: this.config.get<string>('watermarkText') || '仅供溯源核验使用',
|
||||
@@ -39,6 +41,7 @@ export class SettingsService {
|
||||
for (const r of rows) {
|
||||
map[r.key] = r.key === 'appName' && r.value === '艺术品可信溯源与认证平台' ? '艺术品溯源平台' : r.value;
|
||||
}
|
||||
if (!map.appIconUrl) map.appIconUrl = '/app-icon.svg';
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
|
||||
/>
|
||||
<link rel="icon" type="image/svg+xml" href="/app-icon.svg" />
|
||||
<title>艺术品溯源平台</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<defs>
|
||||
<linearGradient id="bg" x1="12" y1="8" x2="52" y2="56" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1f3864"/>
|
||||
<stop offset="1" stop-color="#2f6b5e"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="seal" x1="20" y1="16" x2="44" y2="48" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#f7d77a"/>
|
||||
<stop offset="1" stop-color="#c89b3c"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="64" height="64" rx="14" fill="url(#bg)"/>
|
||||
<path d="M32 12 47 20v13c0 9.5-5.8 16.5-15 19-9.2-2.5-15-9.5-15-19V20l15-8Z" fill="rgba(255,255,255,.12)" stroke="rgba(255,255,255,.42)" stroke-width="2"/>
|
||||
<circle cx="32" cy="31" r="12" fill="none" stroke="url(#seal)" stroke-width="3"/>
|
||||
<path d="M24 33c5.3-1.2 8.9-5.1 10.3-11.5 3.2 3.3 4.9 7.1 5.1 11.5-3.7-1.7-7-1.3-9.9 1.2-1.7 1.5-3.5 2.2-5.5 2.2V33Z" fill="url(#seal)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 917 B |
@@ -0,0 +1,19 @@
|
||||
export const DEFAULT_APP_ICON_URL = '/app-icon.svg';
|
||||
|
||||
export function resolveAppIcon(url?: string | null): string {
|
||||
const value = String(url || '').trim();
|
||||
return value || DEFAULT_APP_ICON_URL;
|
||||
}
|
||||
|
||||
export function setFavicon(url?: string | null): void {
|
||||
const href = resolveAppIcon(url);
|
||||
const selectors = ['link[rel="icon"]', 'link[rel="shortcut icon"]'];
|
||||
let link = document.head.querySelector<HTMLLinkElement>(selectors.join(','));
|
||||
if (!link) {
|
||||
link = document.createElement('link');
|
||||
link.rel = 'icon';
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
link.type = href.endsWith('.svg') ? 'image/svg+xml' : '';
|
||||
link.href = href;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="app-shell home">
|
||||
<div class="logo">艺</div>
|
||||
<img class="logo" :src="appIconUrl" alt="" />
|
||||
<h1>{{ t('home.title') }}</h1>
|
||||
<p class="muted">{{ t('home.hint') }}</p>
|
||||
<button class="lang" @click="toggleLang">{{ otherLangLabel }}</button>
|
||||
@@ -16,9 +16,11 @@ import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { fetchAppInfo } from '@/api';
|
||||
import { setLocale } from '@/locales';
|
||||
import { resolveAppIcon, setFavicon } from '@/utils/appIcon';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const appName = ref('');
|
||||
const appIconUrl = ref(resolveAppIcon());
|
||||
const filingInfo = ref('');
|
||||
const otherLangLabel = computed(() => (locale.value === 'zh-CN' ? 'EN' : '中文'));
|
||||
function toggleLang() {
|
||||
@@ -28,9 +30,12 @@ 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 || '';
|
||||
} catch {
|
||||
appName.value = t('app.name');
|
||||
setFavicon(appIconUrl.value);
|
||||
filingInfo.value = '';
|
||||
}
|
||||
});
|
||||
@@ -50,13 +55,8 @@ onMounted(async () => {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(135deg, #1f3864, #2e5496);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
object-fit: cover;
|
||||
background: #f6f8fb;
|
||||
}
|
||||
h1 {
|
||||
font-size: 22px;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export const SHORT_CODE_LENGTH = 10;
|
||||
export const MAX_IMAGE_SIZE = 10 * 1024 * 1024; // 10MB
|
||||
export const MAX_VIDEO_SIZE = 100 * 1024 * 1024; // 100MB
|
||||
export const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20MB
|
||||
export const ALLOWED_IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/webp', 'image/gif'];
|
||||
export const ALLOWED_IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/webp', 'image/gif', 'image/svg+xml'];
|
||||
export const ALLOWED_VIDEO_TYPES = ['video/mp4', 'video/webm', 'video/quicktime'];
|
||||
export const ALLOWED_DOC_TYPES = ['application/pdf', 'image/jpeg', 'image/png'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user