feat: 追溯码客户端预览(TOTP式令牌保护,不激活不计数,可切换激活状态预览)

This commit is contained in:
Nixevol
2026-07-12 23:16:37 +08:00
parent 8fd417aa87
commit c1d8fb9ca4
17 changed files with 696 additions and 191 deletions
+2
View File
@@ -85,6 +85,7 @@ export const traceCodeApi = {
qrBlob: (id: string) => download(`/trace-codes/${id}/qrcode`),
onchain: (id: string) => post(`/trace-codes/${id}/onchain`, {}),
confirmProof: (id: number) => post(`/blockchain-proofs/${id}/confirm`, {}),
previewToken: () => get<{ token: string; clientBase: string; periodMs: number }>('/trace-codes/preview-token'),
// 分组
groups: (params?: object) => get<any[]>('/trace-code-groups', params),
createGroup: (data: { name: string; remark?: string }) => post('/trace-code-groups', data),
@@ -138,6 +139,7 @@ export const settingsApi = {
tianheVerify: (data: { userId: string; userKey: string }) =>
post<{ userId: string; address: string }>('/settings/tianhe/verify', data),
tianheIdentity: () => get<{ userId: string; address: string; userKeyMasked: string }>('/settings/tianhe/identity'),
tianheRevealAppKey: () => post<{ appKeyMasked: string }>('/settings/tianhe/app-key/reveal', {}),
tianheReveal: () => post<{ userId: string; userKey: string; address: string }>('/settings/tianhe/identity/reveal', {}),
tianheRotate: () => post<{ userId: string; userKey: string; address: string }>('/settings/tianhe/identity/rotate', {}),
};
+74 -4
View File
@@ -366,7 +366,7 @@ const outboundModalTitle = computed(() => outboundMenuLabel(outboundTarget.value
const columns = computed<DataTableColumns<any>>(() => {
const cols: DataTableColumns<any> = [
{ type: 'selection' },
// 追溯码:点击打开该码的 C 端溯源页
// 追溯码:点击进入预览页(不激活、不计数)
{
title: () => t('pages.traceCode.shortCode'),
key: 'shortCode',
@@ -376,7 +376,7 @@ const columns = computed<DataTableColumns<any>>(() => {
render: (r) =>
h(
'a',
{ href: r.url, target: '_blank', rel: 'noopener', class: 'cell-link', title: t('pages.traceCode.openTrace') },
{ class: 'cell-link', title: t('pages.traceCode.previewHint'), onClick: () => openPreview(r) },
r.shortCode,
),
},
@@ -464,7 +464,7 @@ const columns = computed<DataTableColumns<any>>(() => {
{ title: () => t('pages.traceCode.queryCount'), key: 'queryCount', width: 100, align: 'center' },
// 激活时间
{ title: () => t('pages.traceCode.firstActivatedAt'), key: 'firstActivatedAt', width: 150, align: 'center', render: (r) => fmt(r.firstActivatedAt), ...sortProps('firstActivatedAt') },
// 链接
// 链接:拦截直跳,先告知「直接访问会激活/计数」,再让用户选预览或实际访问
{
title: () => t('pages.traceCode.url'),
key: 'url',
@@ -473,7 +473,15 @@ const columns = computed<DataTableColumns<any>>(() => {
render: (r) =>
h(
'a',
{ href: r.url, target: '_blank', rel: 'noopener', style: 'color: var(--brand); text-decoration: none' },
{
href: r.url,
style: 'color: var(--brand); text-decoration: none',
title: t('pages.traceCode.visitWarnTitle'),
onClick: (e: MouseEvent) => {
e.preventDefault();
confirmVisitReal(r);
},
},
[r.url, h(NIcon, { component: OpenOutline, style: 'vertical-align:-2px;margin-left:4px' })],
),
},
@@ -514,6 +522,68 @@ function goArtwork(id?: number) {
router.push({ name: 'artwork-detail', params: { id: String(id) } });
}
// 预览令牌缓存:令牌自取用起至少 10 分钟有效(当前+上一窗口),缓存 8 分钟内复用,过期自动重取。
// 预览 URL 仅在点击时临时拼接,不进入行数据,因此导出永远只含真实短链。
let previewCache: { token: string; clientBase: string; fetchedAt: number } | null = null;
async function getPreviewInfo() {
if (!previewCache || Date.now() - previewCache.fetchedAt > 8 * 60_000) {
const res = await traceCodeApi.previewToken();
previewCache = { token: res.token, clientBase: res.clientBase, fetchedAt: Date.now() };
}
return previewCache;
}
// 先同步开空白窗口再异步填充地址,避免 await 后 window.open 被浏览器拦截
function openPreview(row: any) {
const win = window.open('about:blank', '_blank');
getPreviewInfo()
.then((info) => {
const url = `${info.clientBase}/#/trace/preview/${encodeURIComponent(row.shortCode)}?token=${info.token}&state=inactive`;
if (win) win.location.href = url;
else window.open(url, '_blank');
})
.catch(() => {
win?.close();
message.error(t('pages.traceCode.previewOpenFailed'));
});
}
// 点「链接」列:告知直接访问会激活/计数,提供预览与实际两个入口
function confirmVisitReal(row: any) {
const d = dialog.warning({
title: t('pages.traceCode.visitWarnTitle'),
content: t('pages.traceCode.visitWarnContent'),
action: () =>
h('div', { style: 'display:flex;gap:8px;justify-content:flex-end' }, [
h(NButton, { size: 'small', onClick: () => d.destroy() }, { default: () => t('common.action.cancel') }),
h(
NButton,
{
size: 'small',
type: 'primary',
onClick: () => {
d.destroy();
openPreview(row);
},
},
{ default: () => t('pages.traceCode.visitPreview') },
),
h(
NButton,
{
size: 'small',
type: 'warning',
onClick: () => {
d.destroy();
window.open(row.url, '_blank');
},
},
{ default: () => t('pages.traceCode.visitReal') },
),
]),
});
}
type HeaderFilterField = 'batchId' | 'groupId' | 'status' | 'outboundStatus';
type HeaderFilterValue = string | number | null;
type HeaderFilterOption = { label: string; value: string | number };
+15
View File
@@ -386,6 +386,12 @@
"firstActivatedAt": "Activated At",
"activationStatus": "Activation",
"openTrace": "Open trace page",
"previewHint": "Click to open preview (no activation, no query counting)",
"previewOpenFailed": "Failed to open preview, please retry",
"visitWarnTitle": "Visit Notice",
"visitWarnContent": "Visiting the real trace link will activate the code and increase its query count. To just check the page, use the preview page (no activation, no counting).",
"visitPreview": "Open Preview Page",
"visitReal": "Open Real Page",
"exportBatch": "Export Batch",
"exportCurrent": "Current filter",
"bindArtwork": "Link Artwork File",
@@ -510,6 +516,11 @@
"platformInfo": "Platform Settings",
"logAndDisplay": "Log Settings",
"backupPolicy": "Backup Policy",
"tabPlatform": "Platform",
"tabLogsBackup": "Logs & Backup",
"tabBlockchain": "Blockchain",
"tabStorage": "Storage",
"backupList": "Backup List",
"appName": "Platform Name",
"appIcon": "System Icon",
"logRetentionDays": "Query Log Days",
@@ -572,6 +583,10 @@
"tianheRevealConfirmContent": "The User Key is the sole credential for the platform custodial wallet. Revealing it will be recorded in the operation log. Make sure your environment is secure before continuing.",
"tianheCopy": "Copy",
"tianheCopied": "User Key copied",
"tianheCopyConfirmTitle": "Copy User Key",
"tianheCopyConfirmContent": "Copying writes the full User Key to the clipboard and will be recorded in the operation log. Make sure your environment is secure before continuing.",
"tianheAppKeyRevealTitle": "View App Key",
"tianheAppKeyRevealContent": "This action will be recorded in the operation log. Make sure your environment is secure before continuing. Only the masked form is shown; the full App Key is never displayed.",
"tianheIdentityHint": "The User Key is the only credential to open the platform custodial wallet. TiChain does not store it and it cannot be recovered. Keep the User ID and User Key offline; after reinstalling or migrating, use Manual Entry to continue with the same on-chain identity.",
"tianheRegisterDone": "On-chain identity registered",
"tianheSaveKeyWarning": "Save these credentials offline immediately (losing them means you cannot attest with the same identity again): User ID: {userId}; User Key: {userKey}",
+15
View File
@@ -386,6 +386,12 @@
"firstActivatedAt": "激活时间",
"activationStatus": "激活状态",
"openTrace": "打开溯源页",
"previewHint": "点击进入预览页(不激活、不计入查询次数)",
"previewOpenFailed": "预览页打开失败,请重试",
"visitWarnTitle": "访问提示",
"visitWarnContent": "直接访问追溯码链接会激活该码并增加查询次数。如仅需查看页面效果,请使用预览页面(不激活、不计入查询次数)。",
"visitPreview": "访问预览页面",
"visitReal": "访问实际页面",
"exportBatch": "导出本批",
"exportCurrent": "当前筛选",
"bindArtwork": "关联作品档案",
@@ -510,6 +516,11 @@
"platformInfo": "平台设置",
"logAndDisplay": "日志设置",
"backupPolicy": "备份策略",
"tabPlatform": "平台设置",
"tabLogsBackup": "日志与备份",
"tabBlockchain": "区块链存证",
"tabStorage": "存储配置",
"backupList": "备份列表",
"appName": "平台名称",
"appIcon": "系统图标",
"logRetentionDays": "查询日志保留天数",
@@ -572,6 +583,10 @@
"tianheRevealConfirmContent": "User Key 是平台托管钱包的唯一凭据,揭示操作将被记入操作日志。请确认当前环境安全后再继续。",
"tianheCopy": "复制",
"tianheCopied": "User Key 已复制",
"tianheCopyConfirmTitle": "复制 User Key",
"tianheCopyConfirmContent": "复制会将完整 User Key 写入剪贴板,该操作将记入操作日志。请确认当前环境安全后再继续。",
"tianheAppKeyRevealTitle": "查看 App Key",
"tianheAppKeyRevealContent": "该操作将记入操作日志,请确认当前环境安全后再继续。查看仅显示掩码形式,不会显示完整 App Key。",
"tianheIdentityHint": "User Key 是打开平台托管钱包的唯一凭据,天河链不留存、无法找回。请务必离线保存 User ID 与 User Key;重装或迁移系统后可通过「手动录入」继续使用同一链上身份。",
"tianheRegisterDone": "链上身份注册成功",
"tianheSaveKeyWarning": "请立即离线保存以下凭据(丢失将无法继续以同一身份存证):User ID:{userId};User Key:{userKey}",
+281 -181
View File
@@ -1,14 +1,16 @@
<template>
<div class="page settings-page">
<div class="settings-shell">
<div class="settings-content">
<n-form class="settings-form" label-placement="top">
<div class="settings-save">
<n-button type="primary" :loading="saving" @click="save">{{ t('common.action.save') }}</n-button>
</div>
<n-tabs class="settings-tabs" type="line" :value="activeTab" @update:value="onTabChange">
<template #suffix>
<n-button v-if="activeTab !== 'storage'" type="primary" size="small" :loading="saving" @click="save">
{{ t('common.action.save') }}
</n-button>
</template>
<div class="settings-card-grid">
<section class="settings-card platform-card">
<n-tab-pane name="platform" :tab="t('pages.settings.tabPlatform')">
<div class="tab-body">
<div class="tab-stack stack-narrow">
<section class="settings-card">
<div class="card-title">{{ t('pages.settings.platformInfo') }}</div>
<div class="setting-row">
<n-form-item :label="t('pages.settings.appName')">
@@ -49,12 +51,18 @@
</div>
<div class="setting-row">
<n-form-item :label="t('pages.settings.clientBaseUrl')">
<n-input v-model:value="form.clientBaseUrl" class="url-control" />
<n-input v-model:value="form.clientBaseUrl" class="text-control" />
</n-form-item>
</div>
</section>
</div>
</div>
</n-tab-pane>
<div class="settings-side-stack">
<n-tab-pane name="logsBackup" :tab="t('pages.settings.tabLogsBackup')">
<div class="tab-body">
<div class="tab-stack stack-wide">
<div class="stack-row">
<section class="settings-card">
<div class="card-title">{{ t('pages.settings.logAndDisplay') }}</div>
<div class="setting-row">
@@ -89,7 +97,20 @@
</section>
</div>
<section class="settings-card blockchain-card">
<section class="settings-card">
<div class="card-title">{{ t('pages.settings.backupList') }}</div>
<div class="backup-body">
<backup-restore-panel />
</div>
</section>
</div>
</div>
</n-tab-pane>
<n-tab-pane name="blockchain" :tab="t('pages.settings.tabBlockchain')">
<div class="tab-body">
<div class="tab-stack stack-mid">
<section class="settings-card">
<div class="card-title">{{ t('pages.settings.blockchainSettings') }}</div>
<div class="setting-row">
<n-form-item :label="t('pages.settings.blockchainDriver')">
@@ -103,7 +124,7 @@
</div>
<div class="setting-row">
<n-form-item :label="t('pages.settings.tianheBaseUrl')">
<n-input v-model:value="form.tianheBaseUrl" class="url-control" :disabled="form.tianheEnv !== 'custom'" />
<n-input v-model:value="form.tianheBaseUrl" class="text-control" :disabled="form.tianheEnv !== 'custom'" />
</n-form-item>
</div>
<div class="setting-row">
@@ -113,18 +134,33 @@
</div>
<div class="setting-row">
<n-form-item :label="t('pages.settings.tianheAppKey')">
<n-input v-model:value="form.tianheAppKey" type="password" show-password-on="click" class="text-control" />
<div class="secret-field">
<n-input v-model:value="form.tianheAppKey" :type="appKeyRevealed ? 'text' : 'password'" class="secret-input" />
<n-button
quaternary
circle
size="small"
:title="appKeyRevealed ? t('pages.settings.tianheHide') : t('pages.settings.tianheReveal')"
@click="toggleAppKeyReveal"
>
<template #icon>
<n-icon :component="appKeyRevealed ? EyeOffOutline : EyeOutline" />
</template>
</n-button>
</div>
</n-form-item>
</div>
<template v-if="form.blockchainDriver === 'tianhe'">
<div class="setting-row identity-head">
<div class="identity-head">
<span class="identity-title">{{ t('pages.settings.tianheIdentity') }}</span>
<div class="card-actions">
<div class="identity-actions">
<n-button size="small" :loading="registeringIdentity" @click="registerIdentity">
{{ identity.address ? t('pages.settings.tianheReRegister') : t('pages.settings.tianheRegister') }}
</n-button>
<n-button size="small" @click="manualEntryVisible = true">{{ t('pages.settings.tianheManualEntry') }}</n-button>
<n-button v-if="identity.userKeyMasked" size="small" :loading="rotatingIdentity" @click="rotateUserKey">{{ t('pages.settings.tianheRotate') }}</n-button>
<n-button v-if="identity.userKeyMasked" size="small" :loading="rotatingIdentity" @click="rotateUserKey">
{{ t('pages.settings.tianheRotate') }}
</n-button>
</div>
</div>
<div class="setting-row">
@@ -141,36 +177,44 @@
<n-form-item label="User Key">
<div class="identity-key">
<span class="identity-value mono">{{ identityKeyDisplay }}</span>
<n-button v-if="identity.userKeyMasked" size="tiny" quaternary @click="revealUserKey">
{{ revealKey ? t('pages.settings.tianheHide') : t('pages.settings.tianheReveal') }}
<n-button
v-if="identity.userKeyMasked"
quaternary
circle
size="small"
:title="revealKey ? t('pages.settings.tianheHide') : t('pages.settings.tianheReveal')"
@click="revealUserKey"
>
<template #icon>
<n-icon :component="revealKey ? EyeOffOutline : EyeOutline" />
</template>
</n-button>
<n-button
v-if="identity.userKeyMasked"
quaternary
circle
size="small"
:title="t('pages.settings.tianheCopy')"
@click="copyUserKey"
>
<template #icon>
<n-icon :component="CopyOutline" />
</template>
</n-button>
<n-button v-if="identity.userKeyMasked" size="tiny" quaternary @click="copyUserKey">{{ t('pages.settings.tianheCopy') }}</n-button>
</div>
</n-form-item>
</div>
<p class="identity-hint">{{ t('pages.settings.tianheIdentityHint') }}</p>
</template>
</section>
</div>
</div>
</n-tab-pane>
<n-modal
v-model:show="manualEntryVisible"
preset="dialog"
:title="t('pages.settings.tianheManualEntry')"
:positive-text="t('pages.settings.tianheVerifySave')"
:negative-text="t('common.action.cancel')"
:loading="verifyingIdentity"
@positive-click="verifyIdentity"
>
<p class="identity-hint">{{ t('pages.settings.tianheManualHint') }}</p>
<n-form-item label="User ID">
<n-input v-model:value="manualEntry.userId" :placeholder="t('pages.settings.tianheManualUserIdPh')" />
</n-form-item>
<n-form-item label="User Key">
<n-input v-model:value="manualEntry.userKey" type="password" show-password-on="click" :placeholder="t('pages.settings.tianheManualUserKeyPh')" />
</n-form-item>
</n-modal>
<section class="settings-card storage-card">
<n-tab-pane name="storage" :tab="t('pages.settings.tabStorage')">
<div class="tab-body">
<div class="tab-stack stack-narrow">
<section class="settings-card">
<div class="card-title">
<span class="card-title-text">
{{ t('pages.settings.storageSettings') }}
@@ -194,18 +238,18 @@
</div>
<div class="setting-row">
<n-form-item :label="t('pages.settings.storageLocalDir')">
<n-input v-model:value="form.storageLocalDir" class="url-control" />
<n-input v-model:value="form.storageLocalDir" class="text-control" />
</n-form-item>
</div>
<div class="setting-row">
<n-form-item :label="t('pages.settings.cdnBaseUrl')">
<n-input v-model:value="form.cdnBaseUrl" class="url-control" />
<n-input v-model:value="form.cdnBaseUrl" class="text-control" />
</n-form-item>
</div>
<template v-if="form.storageDriver === 'oss'">
<div class="setting-row">
<n-form-item :label="t('pages.settings.ossEndpoint')">
<n-input v-model:value="form.ossEndpoint" class="url-control" />
<n-input v-model:value="form.ossEndpoint" class="text-control" />
</n-form-item>
</div>
<div class="setting-row">
@@ -231,27 +275,46 @@
</template>
</section>
</div>
</n-form>
<div class="settings-backup-panel">
<backup-restore-panel />
</div>
</div>
</div>
</n-tab-pane>
</n-tabs>
<n-modal
v-model:show="manualEntryVisible"
preset="dialog"
:title="t('pages.settings.tianheManualEntry')"
:positive-text="t('pages.settings.tianheVerifySave')"
:negative-text="t('common.action.cancel')"
:loading="verifyingIdentity"
@positive-click="verifyIdentity"
>
<p class="identity-hint">{{ t('pages.settings.tianheManualHint') }}</p>
<n-form-item label="User ID">
<n-input v-model:value="manualEntry.userId" :placeholder="t('pages.settings.tianheManualUserIdPh')" />
</n-form-item>
<n-form-item label="User Key">
<n-input v-model:value="manualEntry.userKey" type="password" show-password-on="click" :placeholder="t('pages.settings.tianheManualUserKeyPh')" />
</n-form-item>
</n-modal>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { settingsApi, storageApi } from '@/api';
import { dialog, message } from '@/utils/feedback';
import { HelpCircleOutline } from '@vicons/ionicons5';
import { CopyOutline, EyeOffOutline, EyeOutline, HelpCircleOutline } from '@vicons/ionicons5';
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 route = useRoute();
const router = useRouter();
const TAB_NAMES = ['platform', 'logsBackup', 'blockchain', 'storage'];
const activeTab = ref(TAB_NAMES.includes(String(route.query.tab)) ? String(route.query.tab) : 'platform');
const saving = ref(false);
const testingStorage = ref(false);
const migratingStorage = ref(false);
@@ -260,9 +323,12 @@ const registeringIdentity = ref(false);
const verifyingIdentity = ref(false);
const rotatingIdentity = ref(false);
const revealKey = ref(false);
const appKeyRevealed = ref(false);
const manualEntryVisible = ref(false);
const identity = reactive({ userId: '', userKey: '', userKeyMasked: '', address: '' });
const manualEntry = reactive({ userId: '', userKey: '' });
// load() 时记录的 AppKey 掩码值,用于区分「服务端掩码」与「用户新填的值」
let loadedTianheAppKey = '';
const TIANHE_TEST_URL = 'https://test.api.tichain.tianhecloud.com';
const TIANHE_PRODUCTION_URL = 'https://api.tichain.tianhecloud.com';
const blockchainDriverOptions = computed(() => [
@@ -319,6 +385,11 @@ const form = reactive({
ossAccessKeySecret: '',
});
function onTabChange(name: string) {
activeTab.value = name;
void router.replace({ query: { ...route.query, tab: name } });
}
async function load() {
const s = await settingsApi.getAll();
form.appName = s.appName || '';
@@ -339,6 +410,8 @@ async function load() {
form.tianheBaseUrl = s.tianheBaseUrl || TIANHE_TEST_URL;
form.tianheAppId = s.tianheAppId || '';
form.tianheAppKey = s.tianheAppKey || '';
loadedTianheAppKey = form.tianheAppKey;
appKeyRevealed.value = false;
form.storageDriver = s.storageDriver || 'local';
form.storageLocalDir = s.storageLocalDir || './storage';
form.storagePublicPrefix = s.storagePublicPrefix || '/uploads';
@@ -368,6 +441,29 @@ async function loadIdentity() {
}
}
// 查看 AppKey:二次确认后经审计 POST 接口获取掩码(服务端只回掩码,永不回明文)
function toggleAppKeyReveal() {
if (appKeyRevealed.value) {
appKeyRevealed.value = false;
return;
}
dialog.warning({
title: t('pages.settings.tianheAppKeyRevealTitle'),
content: t('pages.settings.tianheAppKeyRevealContent'),
positiveText: t('common.action.confirm'),
negativeText: t('common.action.cancel'),
onPositiveClick: async () => {
const res = await settingsApi.tianheRevealAppKey();
// 仅在输入框仍是服务端掩码(未被编辑)时刷新掩码,避免覆盖用户新填的值
if (form.tianheAppKey === loadedTianheAppKey && res.appKeyMasked) {
form.tianheAppKey = res.appKeyMasked;
loadedTianheAppKey = res.appKeyMasked;
}
appKeyRevealed.value = true;
},
});
}
// 揭示明文 userKey:二次确认后经 POST 接口获取(写操作日志、避免缓存)
async function revealUserKey() {
if (revealKey.value) {
@@ -387,15 +483,21 @@ async function revealUserKey() {
});
}
async function copyUserKey() {
let key = identity.userKey;
if (!key) {
const res = await settingsApi.tianheReveal();
key = res.userKey || '';
identity.userKey = key;
}
await navigator.clipboard.writeText(key);
message.success(t('pages.settings.tianheCopied'));
// 复制 userKey:二次确认后强制经审计 POST 接口取明文再写剪贴板,保证留痕
function copyUserKey() {
dialog.warning({
title: t('pages.settings.tianheCopyConfirmTitle'),
content: t('pages.settings.tianheCopyConfirmContent'),
positiveText: t('common.action.confirm'),
negativeText: t('common.action.cancel'),
onPositiveClick: async () => {
const res = await settingsApi.tianheReveal();
const key = res.userKey || '';
identity.userKey = key;
await navigator.clipboard.writeText(key);
message.success(t('pages.settings.tianheCopied'));
},
});
}
// 注册(或确认)平台托管钱包;注册前先保存表单里的 AppID/AppKey,避免「填了没存」
@@ -472,7 +574,7 @@ async function save() {
saving.value = true;
try {
const appIconUrl = form.appIconFiles[0]?.url || form.appIconFiles[0]?.key || '';
await settingsApi.update({
const s = await settingsApi.update({
appName: form.appName,
appIconUrl,
logRetentionDays: String(form.logRetentionDays),
@@ -491,6 +593,10 @@ async function save() {
tianheAppId: form.tianheAppId,
tianheAppKey: form.tianheAppKey,
});
// 保存后回填服务端掩码,避免输入框继续持有刚填的明文
form.tianheAppKey = (s as Record<string, string>)?.tianheAppKey || '';
loadedTianheAppKey = form.tianheAppKey;
appKeyRevealed.value = false;
setFavicon(appIconUrl);
window.dispatchEvent(new CustomEvent('artveris-settings-updated'));
message.success(t('pages.settings.saved'));
@@ -561,54 +667,55 @@ const identityKeyDisplay = computed(() => {
display: flex;
flex-direction: column;
overflow: hidden;
padding: 14px 16px 16px;
padding: 8px 24px 0;
}
.settings-shell {
width: 100%;
height: 100%;
min-width: 0;
.settings-tabs {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.settings-save {
position: absolute;
top: 0;
right: 0;
z-index: 8;
}
.settings-content {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
gap: 12px;
overflow: auto;
padding: 0 10px 24px 0;
}
.settings-form {
position: relative;
.settings-tabs :deep(.n-tabs-nav) {
flex: 0 0 auto;
width: 1300px;
max-width: 100%;
}
.settings-card-grid {
.settings-tabs :deep(.n-tabs-nav-scroll-content) {
justify-content: center;
}
.settings-tabs :deep(.n-tabs-pane-wrapper) {
flex: 1 1 auto;
min-height: 0;
}
.settings-tabs :deep(.n-tab-pane) {
height: 100%;
overflow: auto;
padding: 16px 0 24px;
box-sizing: border-box;
}
.tab-body {
min-height: 100%;
display: flex;
}
.tab-stack {
margin: auto;
display: flex;
flex-direction: column;
gap: 14px;
width: 100%;
}
.stack-narrow {
max-width: 560px;
}
.stack-mid {
max-width: 640px;
}
.stack-wide {
max-width: 1080px;
}
.stack-row {
display: grid;
grid-template-columns: 448px 376px 376px;
grid-template-columns: 1fr 1fr;
gap: 14px;
align-items: start;
gap: 12px;
padding-right: 76px;
}
.settings-side-stack {
display: grid;
gap: 12px;
width: 376px;
}
.platform-card {
width: 448px;
}
.blockchain-card {
width: 376px;
}
.settings-card {
overflow: hidden;
@@ -620,8 +727,8 @@ const identityKeyDisplay = computed(() => {
.card-title {
display: flex;
align-items: center;
min-height: 36px;
padding: 0 12px;
min-height: 38px;
padding: 4px 14px;
border-bottom: 1px solid var(--n-border-color);
background: rgba(148, 163, 184, 0.08);
color: var(--n-text-color);
@@ -655,19 +762,81 @@ const identityKeyDisplay = computed(() => {
font-size: 12px;
line-height: 1.7;
}
.setting-row {
padding: 9px 14px;
border-bottom: 1px solid var(--n-border-color);
}
.setting-row:last-child {
border-bottom: 0;
}
.settings-card :deep(.n-form-item) {
display: grid;
grid-template-columns: 150px minmax(0, 1fr);
align-items: center;
column-gap: 16px;
margin-bottom: 0;
}
.settings-card :deep(.n-form-item-label) {
min-height: auto;
padding: 0;
color: var(--n-text-color-2);
font-weight: 600;
line-height: 20px;
white-space: nowrap;
}
.settings-card :deep(.n-form-item-blank) {
min-height: 32px;
}
.setting-row :deep(.n-form-item-feedback-wrapper) {
display: none;
}
.text-control {
width: 100%;
}
.number-control {
width: 200px;
}
.number-control :deep(.n-input__input-el) {
text-align: center;
}
.select-control {
width: 200px;
}
.secret-field {
display: flex;
align-items: center;
gap: 6px;
width: 100%;
}
.secret-input {
flex: 1 1 auto;
min-width: 0;
}
.identity-head {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 8px;
padding: 9px 14px;
border-bottom: 1px solid var(--n-border-color);
background: rgba(148, 163, 184, 0.06);
}
.identity-title {
font-size: 13px;
font-weight: 600;
font-weight: 700;
color: var(--n-text-color-2, #526070);
white-space: nowrap;
}
.identity-actions {
display: flex;
gap: 6px;
flex-wrap: wrap;
justify-content: flex-end;
}
.identity-value {
font-size: 12px;
line-height: 20px;
word-break: break-all;
}
.identity-value.mono {
@@ -676,66 +845,15 @@ const identityKeyDisplay = computed(() => {
.identity-key {
display: flex;
align-items: center;
gap: 6px;
gap: 4px;
flex-wrap: wrap;
}
.identity-hint {
margin: 4px 12px 10px;
margin: 8px 14px 12px;
font-size: 12px;
line-height: 1.6;
color: #d03050;
}
.setting-row {
padding: 8px 12px;
border-bottom: 1px solid var(--n-border-color);
}
.setting-row:last-child {
border-bottom: 0;
}
.settings-form :deep(.n-form-item) {
display: grid;
grid-template-columns: 128px max-content;
grid-template-rows: auto;
grid-template-areas: "label blank";
align-items: center;
column-gap: 12px;
margin-bottom: 0;
}
.platform-card :deep(.n-form-item) {
grid-template-columns: 148px max-content;
}
.settings-form :deep(.n-form-item-label) {
min-height: auto;
padding: 0;
color: var(--n-text-color-2);
font-weight: 600;
line-height: 20px;
white-space: nowrap;
}
.settings-form :deep(.n-form-item-blank) {
min-height: 32px;
}
.setting-row :deep(.n-form-item-feedback-wrapper) {
display: none;
}
.control-wide {
width: 100%;
}
.text-control {
width: 180px;
}
.url-control {
width: 220px;
}
.number-control {
width: 128px;
}
.number-control :deep(.n-input__input-el) {
text-align: center;
}
.select-control {
width: 128px;
}
.setting-label {
color: var(--n-text-color-2);
font-weight: 600;
@@ -745,12 +863,9 @@ const identityKeyDisplay = computed(() => {
}
.icon-row {
display: grid;
grid-template-columns: 128px max-content;
grid-template-columns: 150px minmax(0, 1fr);
align-items: center;
column-gap: 12px;
}
.platform-card .icon-row {
grid-template-columns: 148px max-content;
column-gap: 16px;
}
.icon-setting {
display: grid;
@@ -790,39 +905,24 @@ const identityKeyDisplay = computed(() => {
.icon-upload :deep(.image-item.add span) {
display: none;
}
.settings-backup-panel {
flex: 1 1 320px;
.backup-body {
height: 460px;
padding: 0 12px 12px;
display: flex;
flex-direction: column;
width: 100%;
min-height: 320px;
padding: 12px;
box-sizing: border-box;
border: 1px solid var(--n-border-color);
border-radius: 8px;
background: var(--n-card-color);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
min-height: 0;
}
.settings-backup-panel :deep(.backup-panel) {
.backup-body :deep(.backup-panel) {
flex: 1 1 auto;
min-height: 0;
}
@media (max-width: 900px) {
.settings-shell {
min-width: 0;
}
.settings-card-grid {
grid-template-columns: 448px 376px 376px;
}
.settings-save {
right: 0;
}
.icon-setting {
grid-template-columns: 60px minmax(0, 1fr);
.stack-row {
grid-template-columns: 1fr;
}
}
@media (max-width: 640px) {
.settings-form :deep(.n-form-item),
.settings-card :deep(.n-form-item),
.icon-row {
grid-template-columns: 1fr;
row-gap: 8px;