diff --git a/apps/admin/src/locales/en-US.json b/apps/admin/src/locales/en-US.json index 3f59061..760488f 100644 --- a/apps/admin/src/locales/en-US.json +++ b/apps/admin/src/locales/en-US.json @@ -806,7 +806,25 @@ "tianheVerifyOk": "Verified. On-chain identity saved", "tianheManualHint": "Enter the saved User ID and User Key. The system verifies them with TiChain before saving (for reusing the existing wallet after reinstall/migration).", "tianheManualUserIdPh": "e.g. artveris-platform", - "tianheManualUserKeyPh": "The User Key you saved offline" + "tianheManualUserKeyPh": "The User Key you saved offline", + "certificateTextTemplate": "Certificate text", + "certificateTextHelpTitle": "Certificate text template help", + "certificateTextHelpIntro": "Wrap a field name in double braces to insert its value for the physical item. Supported fields:", + "certificateTextFields": { + "作品名称": "Artwork title", + "版本": "Value of the artwork template field labelled 版本, e.g. one-piece pack", + "追溯码": "Unique trace code for the physical item", + "档案编号": "Artwork archive number", + "作者": "Artist name" + }, + "certificateTextHelpExample": "Default template:", + "certificateTextHelpResult": "Example: 十二生肖莲花手工杯 一个装", + "certificateTextHelpRules": "Reorder fields, add plain text, or press Enter for a newline. Missing values are empty; the resulting text must not be empty. Markdown and expressions are not supported. Maximum 500 characters. The official certificate page may collapse newlines into spaces. Changes apply only to new requests; existing and pending certificates keep their original text and links.", + "certificateTextInvalid": "Enter a template of 1–500 characters using the supported fields in double braces.", + "certificateAuthorMode": "Certificate author", + "certificateAuthorWallet": "Attestation wallet address", + "certificateAuthorArtist": "Artwork artist name", + "certificateAuthorHelp": "Select wallet address (default) or artwork artist name. An empty artist name falls back to the wallet address. This also applies when existing certificates are opened again. Only the displayed author changes; the attesting identity, evidence, hash and timestamp remain unchanged. No new certificate request is made." }, "profile": { "title": "Personal Info", diff --git a/apps/admin/src/locales/zh-CN.json b/apps/admin/src/locales/zh-CN.json index 009940c..8a1c10f 100644 --- a/apps/admin/src/locales/zh-CN.json +++ b/apps/admin/src/locales/zh-CN.json @@ -806,7 +806,25 @@ "tianheVerifyOk": "校验通过,链上身份已保存", "tianheManualHint": "输入已保存的 User ID 与 User Key,系统将向天河链校验后保存(用于重装/迁移后复用既有钱包)。", "tianheManualUserIdPh": "如 artveris-platform", - "tianheManualUserKeyPh": "已离线保存的 User Key" + "tianheManualUserKeyPh": "已离线保存的 User Key", + "certificateTextTemplate": "证书文本模板", + "certificateTextHelpTitle": "证书文本模板帮助", + "certificateTextHelpIntro": "使用双花括号包裹字段名,生成证书时会替换为该实物对应的作品资料。支持以下字段:", + "certificateTextFields": { + "作品名称": "作品档案中的名称", + "版本": "作品模板中名为“版本”的字段值,例如“一个装”", + "追溯码": "当前实物的独立追溯码", + "档案编号": "作品档案编号", + "作者": "作品档案中的艺术家姓名" + }, + "certificateTextHelpExample": "默认模板:", + "certificateTextHelpResult": "显示示例:十二生肖莲花手工杯 一个装", + "certificateTextHelpRules": "可调整字段顺序、插入普通文字或按 Enter 换行。缺失的字段显示为空;最终文字不能为空。不支持 Markdown 加粗或表达式。模板最多 500 字符;官方证书页可能将换行显示为空格。修改仅影响之后首次申请的证书,已生成或处理中的证书继续使用原文本和链接。", + "certificateTextInvalid": "模板不能为空且最多500字符,请使用帮助中列出的字段及双花括号。", + "certificateAuthorMode": "证书作者显示", + "certificateAuthorWallet": "存证钱包地址", + "certificateAuthorArtist": "作品作者名称", + "certificateAuthorHelp": "作者显示可单选“存证钱包地址”或“作品作者名称”,默认钱包地址。选择作品作者时取作品档案的艺术家姓名,未填写则显示钱包地址。此设置对下次打开的已有证书也生效,仅调整作者显示,不改变链上存证主体、证据正文、哈希和生成时间,不重新申请证书。" }, "profile": { "title": "个人信息", diff --git a/apps/admin/src/views/Settings.vue b/apps/admin/src/views/Settings.vue index f0dce2e..a1c941b 100644 --- a/apps/admin/src/views/Settings.vue +++ b/apps/admin/src/views/Settings.vue @@ -93,9 +93,28 @@ + + + + + + + + {{ t('pages.settings.certificateAuthorWallet') }} + {{ t('pages.settings.certificateAuthorArtist') }} + + + @@ -242,6 +261,16 @@ + +

{{ t('pages.settings.certificateTextHelpIntro') }}

+ +

{{ t('pages.settings.certificateTextHelpExample') }}

+

{{ t('pages.settings.certificateTextHelpResult') }}

+

{{ t('pages.settings.certificateTextHelpRules') }}

+

{{ t('pages.settings.certificateAuthorHelp') }}

+
@@ -255,6 +284,7 @@ import { CopyOutline, EyeOffOutline, EyeOutline, HelpCircleOutline } from '@vico import BackupRestorePanel from '@/components/BackupRestorePanel.vue'; import MediaUpload from '@/components/MediaUpload.vue'; import { DEFAULT_APP_ICON_URL, resolveAppIcon, setFavicon } from '@/utils/appIcon'; +import { CERTIFICATE_TEXT_FIELDS, DEFAULT_CERTIFICATE_TEXT_TEMPLATE, validateCertificateTextTemplate } from '@artveris/shared'; const { t } = useI18n(); const route = useRoute(); @@ -271,6 +301,7 @@ const rotatingIdentity = ref(false); const revealKey = ref(false); const appKeyRevealed = ref(false); const manualEntryVisible = ref(false); +const certificateHelpVisible = ref(false); const identity = reactive({ userId: '', userKey: '', userKeyMasked: '', address: '' }); const manualEntry = reactive({ userId: '', userKey: '' }); // load() 时记录的 AppKey 掩码值,用于区分「服务端掩码」与「用户新填的值」 @@ -316,6 +347,8 @@ const form = reactive({ backupRetentionDays: 30, backupRetentionCount: 10, blockchainDriver: 'mock', + certificateTextTemplate: DEFAULT_CERTIFICATE_TEXT_TEMPLATE, + certificateAuthorMode: 'WALLET', tianheEnv: 'test', tianheBaseUrl: TIANHE_TEST_URL, tianheAppId: '', @@ -362,6 +395,8 @@ async function load() { form.backupRetentionCount = Number(s.backupRetentionCount || 10); form.blockchainDriver = s.blockchainDriver || 'mock'; form.tianheEnv = s.tianheEnv || 'test'; + form.certificateTextTemplate = s.certificateTextTemplate ?? DEFAULT_CERTIFICATE_TEXT_TEMPLATE; + form.certificateAuthorMode = s.certificateAuthorMode || 'WALLET'; form.tianheBaseUrl = s.tianheBaseUrl || TIANHE_TEST_URL; form.tianheAppId = s.tianheAppId || ''; form.tianheAppKey = s.tianheAppKey || ''; @@ -533,6 +568,10 @@ async function verifyIdentity() { } async function save() { + if (validateCertificateTextTemplate(form.certificateTextTemplate)) { + message.error(t('pages.settings.certificateTextInvalid')); + return; + } saving.value = true; try { const appIconUrl = form.appIconFiles[0]?.url || form.appIconFiles[0]?.key || ''; @@ -550,6 +589,8 @@ async function save() { backupRetentionDays: String(form.backupRetentionDays), backupRetentionCount: String(form.backupRetentionCount), blockchainDriver: form.blockchainDriver, + certificateTextTemplate: form.certificateTextTemplate, + certificateAuthorMode: form.certificateAuthorMode, tianheEnv: form.tianheEnv, tianheBaseUrl: form.tianheBaseUrl, tianheAppId: form.tianheAppId, @@ -623,6 +664,8 @@ const identityKeyDisplay = computed(() => {