fix: 前端设置存储保存分离、硬编码文案接入 i18n、C 端恢复隐私说明

Settings 存储卡片加提示说明不随保存生效;Install 文案迁入全局 locale;
ArtworkEdit 默认节点标题走 i18n;C 端本地化出库记录节点并恢复渲染隐私说明;
TraceCodePanel/Outbound 适配 outImages 去除 outImage 兼容。
This commit is contained in:
Nixevol
2026-07-09 13:14:37 +08:00
parent f712b16c1f
commit 07ebde0ec2
9 changed files with 121 additions and 92 deletions
+4 -7
View File
@@ -300,7 +300,7 @@ const columns = computed<DataTableColumns<any>>(() => {
width: 124,
align: 'center',
render: (r) =>
r.outTime || r.outImage || getOutImages(r).length
r.outTime || getOutImages(r).length
? h(NTag, { size: 'small', type: 'success' }, { default: () => t('pages.traceCode.outRegistered') })
: h(NText, { depth: 3 }, { default: () => t('pages.traceCode.notOutbound') }),
},
@@ -754,12 +754,9 @@ function fileName(key: string) {
function getOutImages(row: any) {
const list = Array.isArray(row.outImages) ? row.outImages : [];
if (list.length) {
return list.map((item: any) =>
typeof item === 'string' ? { key: item, url: item, name: fileName(item), type: 'image' } : item,
);
}
return row.outImage ? [{ key: row.outImage, url: row.outImageUrl || row.outImage, name: fileName(row.outImage), type: 'image' }] : [];
return list.map((item: any) =>
typeof item === 'string' ? { key: item, url: item, name: fileName(item), type: 'image' } : item,
);
}
function openOutboundModal(row: any) {
+40
View File
@@ -182,6 +182,39 @@
"placeholderPass": "Enter password",
"success": "Signed in"
},
"install": {
"subtitle": "First run — please complete the setup",
"start": "Start Install",
"installing": "Installing…",
"alreadyInstalled": "The system has already been initialized",
"gotoAdmin": "You can open the admin console now.",
"enterAdmin": "Open Admin",
"base": "Base",
"appName": "Platform Name",
"baseUrl": "Public URL",
"listenPort": "Listen Port",
"baseUrlHint": "All three apps share this URL: admin at /admin, client at /trace, API at /api. Use Nginx / a control panel to reverse-proxy the domain and HTTPS to the listen port.",
"host": "Host",
"port": "Port",
"database": "Database",
"username": "Username",
"password": "Password",
"adminUser": "DB admin user (optional)",
"adminPass": "DB admin password (optional)",
"mysqlAdminHint": "Only needed if the business account cannot create databases; the database, tables and data are created automatically.",
"admin": "Admin",
"realName": "Name",
"storage": "Storage",
"driver": "Driver",
"local": "Local",
"localDir": "Local Directory",
"cdnBaseUrl": "CDN URL",
"failed": "Installation failed",
"done": "Initialized. The service is restarting, please wait…",
"loadFailed": "Failed to read installation status",
"defaultAppName": "Artwork Traceability Platform",
"defaultAdminName": "Administrator"
},
"dashboard": {
"totalArtworks": "Artworks",
"totalCodes": "Total Codes",
@@ -271,6 +304,12 @@
"changeReason": "Change Reason",
"changeReasonPlaceholder": "Describe why this change is needed for audit and traceability.",
"defaultChangeTitle": "Artwork content update",
"defaultNodes": {
"create": "Creation / Selection",
"produce": "Production",
"storage": "Storage / Custody",
"outbound": "Outbound / Transfer"
},
"changeRecords": "Change Records",
"pendingChange": "Pending Revision",
"rejectedChange": "Rejected Revision",
@@ -444,6 +483,7 @@
"carouselIntervalHint": "Seconds each media stays; decimals allowed. 0 disables auto-advance (manual loop still works).",
"clientBaseUrl": "Client URL",
"storageSettings": "Storage & CDN",
"storageHint": "Storage settings are NOT applied by the Save button above. After editing, click Test to verify the target, Migrate to copy existing files, then Switch to activate.",
"storageDriver": "Storage",
"storageDriverLocal": "Local",
"storageDriverOss": "OSS/S3",
+40
View File
@@ -182,6 +182,39 @@
"placeholderPass": "请输入密码",
"success": "登录成功"
},
"install": {
"subtitle": "首次运行,请完成系统初始化",
"start": "开始安装",
"installing": "安装中…",
"alreadyInstalled": "系统已完成初始化",
"gotoAdmin": "可直接进入管理后台。",
"enterAdmin": "进入后台",
"base": "基础",
"appName": "平台名称",
"baseUrl": "对外访问地址",
"listenPort": "监听端口",
"baseUrlHint": "三端共用此地址:后台 /admin、客户端 /trace、接口 /api。域名与 HTTPS 建议由 Nginx/宝塔/1Panel 反代到监听端口。",
"host": "主机",
"port": "端口",
"database": "数据库",
"username": "账号",
"password": "密码",
"adminUser": "建库管理员账号(可选)",
"adminPass": "建库管理员密码(可选)",
"mysqlAdminHint": "仅当业务账号无建库权限时填写;系统会自动创建数据库并初始化表结构与数据。",
"admin": "管理员",
"realName": "姓名",
"storage": "存储",
"driver": "方式",
"local": "本地",
"localDir": "本地目录",
"cdnBaseUrl": "CDN 地址",
"failed": "安装失败",
"done": "初始化完成,服务正在重启,请稍候…",
"loadFailed": "读取安装状态失败",
"defaultAppName": "艺术品溯源平台",
"defaultAdminName": "管理员"
},
"dashboard": {
"totalArtworks": "作品总数",
"totalCodes": "追溯码总数",
@@ -271,6 +304,12 @@
"changeReason": "修改理由",
"changeReasonPlaceholder": "请说明本次修改的原因,便于审核与追溯",
"defaultChangeTitle": "作品内容修改",
"defaultNodes": {
"create": "创作 / 选胚",
"produce": "制作过程",
"storage": "仓储 / 托管",
"outbound": "出库 / 流转"
},
"changeRecords": "修改记录",
"pendingChange": "待审核修改",
"rejectedChange": "修改已驳回",
@@ -444,6 +483,7 @@
"carouselIntervalHint": "每张媒体停留秒数,支持小数;填 0 则不自动切换(仍可手动循环切换)",
"clientBaseUrl": "客户端地址",
"storageSettings": "存储与 CDN",
"storageHint": "存储配置不随上方「保存」生效:修改后请依次点「测试」验证目标可用、「迁移」把已有文件复制到目标,再点「切换」正式启用。",
"storageDriver": "存储方式",
"storageDriverLocal": "本地",
"storageDriverOss": "OSS/S3",
+4 -4
View File
@@ -403,10 +403,10 @@ function nextLocalId(prefix: string) {
function defaultTraceNodes() {
return [
{ localId: nextLocalId('node'), nodeType: NodeType.CREATE, title: '创作 / 选胚', sortOrder: 0, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.PRODUCE, title: '制作过程', sortOrder: 1, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.STORAGE, title: '仓储 / 托管', sortOrder: 2, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.OUTBOUND, title: '出库 / 流转', sortOrder: 3, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.CREATE, title: t('pages.artwork.defaultNodes.create'), sortOrder: 0, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.PRODUCE, title: t('pages.artwork.defaultNodes.produce'), sortOrder: 1, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.STORAGE, title: t('pages.artwork.defaultNodes.storage'), sortOrder: 2, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.OUTBOUND, title: t('pages.artwork.defaultNodes.outbound'), sortOrder: 3, media: [] },
];
}
+6 -77
View File
@@ -116,81 +116,10 @@ interface InstallForm {
};
}
const messages = {
'zh-CN': {
subtitle: '首次运行,请完成系统初始化',
start: '开始安装',
installing: '安装中…',
alreadyInstalled: '系统已完成初始化',
gotoAdmin: '可直接进入管理后台。',
enterAdmin: '进入后台',
base: '基础',
appName: '平台名称',
baseUrl: '对外访问地址',
listenPort: '监听端口',
baseUrlHint: '三端共用此地址:后台 /admin、客户端 /trace、接口 /api。域名与 HTTPS 建议由 Nginx/宝塔/1Panel 反代到监听端口。',
host: '主机',
port: '端口',
database: '数据库',
username: '账号',
password: '密码',
adminUser: '建库管理员账号(可选)',
adminPass: '建库管理员密码(可选)',
mysqlAdminHint: '仅当业务账号无建库权限时填写;系统会自动创建数据库并初始化表结构与数据。',
admin: '管理员',
realName: '姓名',
storage: '存储',
driver: '方式',
local: '本地',
localDir: '本地目录',
cdnBaseUrl: 'CDN 地址',
failed: '安装失败',
done: '初始化完成,服务正在重启,请稍候…',
loadFailed: '读取安装状态失败',
defaultAppName: '艺术品溯源平台',
defaultAdminName: '管理员',
},
'en-US': {
subtitle: 'First run — please complete the setup',
start: 'Start Install',
installing: 'Installing…',
alreadyInstalled: 'The system has already been initialized',
gotoAdmin: 'You can open the admin console now.',
enterAdmin: 'Open Admin',
base: 'Base',
appName: 'Platform Name',
baseUrl: 'Public URL',
listenPort: 'Listen Port',
baseUrlHint: 'All three apps share this URL: admin at /admin, client at /trace, API at /api. Use Nginx / a control panel to reverse-proxy the domain and HTTPS to the listen port.',
host: 'Host',
port: 'Port',
database: 'Database',
username: 'Username',
password: 'Password',
adminUser: 'DB admin user (optional)',
adminPass: 'DB admin password (optional)',
mysqlAdminHint: 'Only needed if the business account cannot create databases; the database, tables and data are created automatically.',
admin: 'Admin',
realName: 'Name',
storage: 'Storage',
driver: 'Driver',
local: 'Local',
localDir: 'Local Directory',
cdnBaseUrl: 'CDN URL',
failed: 'Installation failed',
done: 'Initialized. The service is restarting, please wait…',
loadFailed: 'Failed to read installation status',
defaultAppName: 'Artwork Traceability Platform',
defaultAdminName: 'Administrator',
},
} as const;
type MessageKey = keyof (typeof messages)['zh-CN'];
const { locale } = useI18n();
const lang = computed<'zh-CN' | 'en-US'>(() => (String(locale.value).startsWith('en') ? 'en-US' : 'zh-CN'));
function tt(key: MessageKey): string {
return messages[lang.value][key] || messages['zh-CN'][key];
const { t } = useI18n();
// 安装向导文案统一走全局 locale(pages.install.*),保持与后台其它页面一致
function tt(key: string): string {
return t(`pages.install.${key}`);
}
const driverOptions = computed(() => [
@@ -199,7 +128,7 @@ const driverOptions = computed(() => [
]);
const form = reactive<InstallForm>({
appName: messages[lang.value].defaultAppName,
appName: tt('defaultAppName'),
baseUrl: location.origin,
port: 3000,
mysql: {
@@ -212,7 +141,7 @@ const form = reactive<InstallForm>({
adminPassword: '',
},
redis: { host: '127.0.0.1', port: 6379, password: '' },
admin: { username: 'admin', password: '', realName: messages[lang.value].defaultAdminName },
admin: { username: 'admin', password: '', realName: tt('defaultAdminName') },
storage: {
driver: 'local',
localDir: './storage',
+4
View File
@@ -127,6 +127,7 @@
<n-button size="small" type="primary" :loading="confirmingStorage" @click="confirmStorage">{{ t('pages.settings.confirmStorage') }}</n-button>
</div>
</div>
<n-alert type="info" :show-icon="false" class="storage-hint">{{ t('pages.settings.storageHint') }}</n-alert>
<div class="setting-row">
<n-form-item :label="t('pages.settings.storageDriver')">
<n-select v-model:value="form.storageDriver" :options="storageDriverOptions" class="select-control" />
@@ -449,6 +450,9 @@ const currentIconUrl = computed(() => resolveAppIcon(form.appIconFiles[0]?.url |
flex-wrap: wrap;
justify-content: flex-end;
}
.storage-hint {
margin: 0 12px 8px;
}
.setting-row {
padding: 8px 12px;
border-bottom: 1px solid var(--n-border-color);
+3 -1
View File
@@ -19,7 +19,9 @@
},
"timeline": {
"expandMedia": "View images ({n})",
"collapse": "Collapse"
"collapse": "Collapse",
"outboundTitle": "Outbound Record",
"outboundDesc": "Outbound photos for the physical item of this trace code."
},
"chain": {
"archiveNo": "Archive No.",
+3 -1
View File
@@ -19,7 +19,9 @@
},
"timeline": {
"expandMedia": "查看图片({n})",
"collapse": "收起图片"
"collapse": "收起图片",
"outboundTitle": "本件出库记录",
"outboundDesc": "该追溯码对应实物的出库实况记录。"
},
"chain": {
"archiveNo": "档案编号",
+17 -2
View File
@@ -197,9 +197,9 @@
<div v-for="(n, i) in data.timeline" :key="i" class="tl-item">
<div class="tl-dot" />
<div class="tl-body">
<div class="tl-title">{{ n.title }}</div>
<div class="tl-title">{{ nodeTitle(n) }}</div>
<div class="tl-meta muted">{{ [fmtDate(n.occurredAt), n.location].filter(Boolean).join(' · ') }}</div>
<div v-if="n.description" class="tl-desc">{{ n.description }}</div>
<div v-if="nodeDesc(n)" class="tl-desc">{{ nodeDesc(n) }}</div>
<template v-if="n.media?.length">
<button class="tl-toggle" @click="toggleNode(i)">
<span class="tl-toggle-ico" :class="{ open: expanded.has(i) }">▸</span>
@@ -325,6 +325,8 @@
<div v-else class="chain-empty muted">{{ t('chain.notOnchain') }}</div>
</section>
<p class="privacy-note muted">{{ t('privacy.note') }}</p>
<footer class="footer muted">
<span>{{ appName }}</span>
<span v-if="filingInfo">{{ filingInfo }}</span>
@@ -444,6 +446,13 @@ function safeUrl(v?: string): string {
function openViewer(items: any[], index: number) {
openMediaViewer(items.map((item) => ({ ...item, url: mediaUrl(item) })).filter((item) => item?.url), index);
}
// 系统合成的「本件出库记录」节点由后端标记 system=OUTBOUND_RECORD,标题/说明在此按语言本地化
function nodeTitle(n: { system?: string | null; title?: string | null }): string {
return n.system === 'OUTBOUND_RECORD' ? t('timeline.outboundTitle') : n.title || '';
}
function nodeDesc(n: { system?: string | null; description?: string | null }): string {
return n.system === 'OUTBOUND_RECORD' ? t('timeline.outboundDesc') : n.description || '';
}
function switchCert(step: number) {
const total = data.value?.certificates?.length || 0;
if (!total) return;
@@ -1362,6 +1371,12 @@ watch(
font-size: 13px;
padding: 8px 0;
}
.privacy-note {
margin: 16px 4px 0;
font-size: 12px;
line-height: 1.6;
text-align: center;
}
.footer {
display: flex;
flex-direction: column;