From 82ee9be0142d1dc602c0c30975af097027830485 Mon Sep 17 00:00:00 2001 From: Nixevol Date: Sun, 5 Jul 2026 02:20:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E6=BA=AF=E6=BA=90=E9=A1=B5=E5=92=8C=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E5=B7=A5=E5=85=B7=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aidocs/project_context.md | 2 + .../src/components/BackupRestorePanel.vue | 8 +- apps/admin/src/styles.css | 9 +- apps/client/src/views/Trace.vue | 398 ++++++++++++++---- 4 files changed, 342 insertions(+), 75 deletions(-) diff --git a/aidocs/project_context.md b/aidocs/project_context.md index 1fcbf0c..27f1805 100644 --- a/aidocs/project_context.md +++ b/aidocs/project_context.md @@ -139,6 +139,8 @@ - 全局追溯码页布局修复(2026-07-05):数据看板点击“追溯码总数 / 已激活追溯码”会进入隐藏全局 `/trace-codes` 页面;该页面现在使用 `page table-page` 与 `TraceCodePanel` 组合,表格主体和分页按后台列表规范自适应宽高,避免只显示工具栏和分页、表格主体被压成 0 高。主布局在 `traceCodes` / `artwork-trace-codes` 路由下顶部标题显示“追溯码管理”,侧边菜单仍归属“艺术品档案”。 - 数据看板时间步进器(2026-07-05):查询趋势的“近 N 日”数字输入框使用 Naive UI `button-placement="both"`,呈现为左侧减号、中间数值、右侧加号的紧凑步进器;数值居中显示,并继续保持 `1-365` 天范围和修改后清空自定义日期范围的逻辑。 - 默认主题与语言初始化(2026-07-05):后台主题无用户保存值时默认 `auto`,跟随浏览器/系统 `prefers-color-scheme`;后台语言无保存值时按 `navigator.languages / navigator.language` 匹配 `zh-CN` 或 `en-US`,并同步设置 ``。后台登录页右上角现在同时提供主题切换和语言切换。客户端语言继续默认识别浏览器语言,并补充 `` 同步;客户端基础色板通过 CSS `prefers-color-scheme` 跟随系统,新增 `--card-bg/--soft-bg/--border/--shell-shadow` 等变量,首页和通用卡片使用变量适配明暗色。 +- 客户端溯源页体验优化(2026-07-05):客户端溯源详情页顶部标题栏显示当前档案编号,未加载完成时回退平台名;顶栏配色改为清爽商务风浅色/暗色自适应。正品验证卡片移动到顶部媒体轮播下方,并在首次激活查询时弹窗展示,弹窗右上角有关闭图标。轮播在首尾克隆瞬移时给容器加 `no-anim`,同时禁用轨道和卡片缩放过渡,避免手动/自动切回第一张时闪烁。数字身份与区块链存证里的唯一追溯码、交易哈希、数据哈希复制入口统一为圆形图标按钮;正品验证卡片内追溯码也使用复制图标。认证文件展示改为居中单卡,多文件时用左右切换按钮和圆点切换,点击图片仍进入 PhotoSwipe 预览。 +- 后台顶部操作栏粘性规则(2026-07-05):全局 `.page-toolbar` 改为内容区顶部 sticky 工具栏,带背景、边线和轻阴影,覆盖艺术品列表/详情、追溯码管理、模板、出库、审核、查询日志、操作日志、用户等所有统一页面工具栏,滚动长表单/详情时返回、保存、新增、导出等顶部操作不会被顶走。备份恢复组件的局部 `backup-toolbar` 也增加 sticky 兜底;设置页底部保存和个人中心表单按钮不是顶部工具栏,保持原位置。 ## 当前代码基准与注意事项 diff --git a/apps/admin/src/components/BackupRestorePanel.vue b/apps/admin/src/components/BackupRestorePanel.vue index 8f60d07..e876351 100644 --- a/apps/admin/src/components/BackupRestorePanel.vue +++ b/apps/admin/src/components/BackupRestorePanel.vue @@ -222,12 +222,18 @@ onMounted(load); overflow: hidden; } .backup-toolbar { + position: sticky; + top: 0; + z-index: 6; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; - margin-bottom: 12px; + margin: 0 -12px 12px; + padding: 10px 12px; + background: var(--n-color); + border-bottom: 1px solid var(--n-border-color); } .backup-toolbar :deep(.n-upload) { width: auto; diff --git a/apps/admin/src/styles.css b/apps/admin/src/styles.css index 15f4610..63193d5 100644 --- a/apps/admin/src/styles.css +++ b/apps/admin/src/styles.css @@ -34,11 +34,18 @@ body, overflow: hidden; } .page-toolbar { + position: sticky; + top: 0; + z-index: 8; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; - margin-bottom: 16px; + margin: -16px -16px 16px; + padding: 12px 16px; + background: var(--n-color); + border-bottom: 1px solid var(--n-border-color); + box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04); } .page-toolbar .spacer { flex: 1 1 auto; diff --git a/apps/client/src/views/Trace.vue b/apps/client/src/views/Trace.vue index 476a64b..9890e1c 100644 --- a/apps/client/src/views/Trace.vue +++ b/apps/client/src/views/Trace.vue @@ -3,7 +3,7 @@
- {{ appName }} + {{ topbarTitle }}
-
- - - + +
+
✓
+
+
{{ data.antiCounterfeit.firstQuery ? t('anti.firstTitle') : t('anti.repeatTitle') }}
+
{{ data.antiCounterfeit.firstQuery ? t('anti.firstDesc') : t('anti.repeatDesc') }}
+
+ {{ t('anti.queryCount', { n: data.antiCounterfeit.queryCount }) }} + + · {{ t('anti.firstActivatedAt', { t: fmt(data.antiCounterfeit.firstActivatedAt) }) }} + +
+
{{ t('anti.queriedAt', { t: fmt(data.queriedAt) }) }}
+
+ {{ t('anti.code') }}:{{ data.code }} + +
+
+
+

{{ data.artwork.title }}

@@ -219,16 +220,51 @@

{{ t('section.cert') }}

-
-
- + +
+
@@ -242,17 +278,33 @@
{{ t('chain.code') }} {{ data.code || '-' }} +
@@ -305,6 +390,13 @@ const browserTitle = computed(() => { const archiveNo = data.value?.status === 'OK' ? data.value?.artwork?.archiveNo : ''; return archiveNo || appName.value || t('app.name'); }); +const topbarTitle = computed(() => { + const archiveNo = data.value?.status === 'OK' ? data.value?.artwork?.archiveNo : ''; + return archiveNo || appName.value || t('app.name'); +}); +const antiModalOpen = ref(false); +const certIndex = ref(0); +const currentCert = computed(() => data.value?.certificates?.[certIndex.value] || null); // 节点图片默认收缩,避免页面过长;点击展开 const expanded = ref>(new Set()); @@ -340,7 +432,12 @@ function safeUrl(v?: string): string { return /^(https?:\/\/|\/)/i.test(v) ? v : ''; } function openViewer(items: any[], index: number) { - openMediaViewer(items, index); + openMediaViewer(items.filter((item) => item?.url), index); +} +function switchCert(step: number) { + const total = data.value?.certificates?.length || 0; + if (!total) return; + certIndex.value = (certIndex.value + step + total) % total; } // 顶部媒体轮播:单张居中、两侧露出相邻媒体边界、定时切换并带切换动画。 @@ -603,6 +700,14 @@ watch([() => data.value?.artwork?.images, carouselInterval], () => { resetCarousel(); }); +watch( + () => data.value, + (value) => { + certIndex.value = 0; + antiModalOpen.value = value?.status === 'OK' && value?.antiCounterfeit?.firstQuery === true; + }, +); + watch( browserTitle, (title) => { @@ -636,20 +741,25 @@ watch( gap: 8px; height: 48px; padding: 0 14px; - background: linear-gradient(135deg, #1f3864, #2e5496); - color: #fff; + background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 249, 252, 0.96)); + color: #17324d; + border-bottom: 1px solid rgba(46, 84, 150, 0.12); + box-shadow: 0 6px 18px rgba(31, 56, 100, 0.06); + backdrop-filter: blur(12px); } .topbar-name { flex: 1; font-weight: 600; font-size: 15px; + letter-spacing: 0; } .topbar-icon { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; - background: rgba(255, 255, 255, 0.18); + background: var(--soft-bg); + border: 1px solid rgba(46, 84, 150, 0.12); flex-shrink: 0; } .lang-wrap { @@ -663,13 +773,14 @@ watch( height: 34px; border: none; background: transparent; - color: #fff; + color: #17324d; border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: transparent; } -.lang:active { - background: rgba(255, 255, 255, 0.18); +.lang:active, +.lang:hover { + background: rgba(46, 84, 150, 0.08); } .lang-menu { position: absolute; @@ -679,7 +790,8 @@ watch( margin: 0; padding: 6px; list-style: none; - background: #fff; + background: var(--card-bg); + border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); z-index: 10; @@ -692,11 +804,11 @@ watch( padding: 9px 12px; border-radius: 7px; font-size: 14px; - color: #333; + color: var(--text); cursor: pointer; } .lang-item:active { - background: #f0f3f8; + background: var(--soft-bg); } .lang-item.active { color: var(--brand); @@ -793,21 +905,7 @@ watch( word-break: break-all; } .code-copy { - display: inline-flex; - align-items: center; - justify-content: center; - vertical-align: middle; - margin-left: 6px; - padding: 2px; - border: none; - background: transparent; - color: #fff; - opacity: 0.9; - cursor: pointer; - -webkit-tap-highlight-color: transparent; -} -.code-copy:active { - opacity: 0.6; + display: none; } .carousel { position: relative; @@ -823,6 +921,10 @@ watch( transition-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1); will-change: transform; } +.carousel.no-anim .carousel-track, +.carousel.no-anim .carousel-slide { + transition: none !important; +} .carousel-slide { position: relative; flex: 0 0 80%; @@ -1084,28 +1186,49 @@ watch( margin-top: 4px; text-align: center; } -.cert-grid { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 12px; +.cert-carousel { + position: relative; + display: flex; + align-items: center; + justify-content: center; + min-height: 238px; + padding: 0 38px; +} +.cert { + width: min(100%, 300px); + text-align: center; } .cert img { width: 100%; - height: 150px; + height: 170px; object-fit: cover; border-radius: 10px; - background: #e7ecf3; + background: var(--soft-bg); + cursor: zoom-in; +} +.cert-placeholder { + height: 170px; + border-radius: 10px; + background: var(--soft-bg); + color: var(--muted); + display: flex; + align-items: center; + justify-content: center; + padding: 16px; + text-align: center; } .cert-head { display: flex; align-items: center; + justify-content: center; gap: 6px; margin-top: 6px; + min-width: 0; } .cert-name { font-size: 13px; font-weight: 600; - flex: 1; + max-width: 190px; } .cert-type { font-size: 11px; @@ -1118,6 +1241,52 @@ watch( .cert-issuer { font-size: 12px; } +.cert-nav { + position: absolute; + top: 82px; + width: 32px; + height: 44px; + border: 1px solid var(--border); + border-radius: 10px; + background: var(--card-bg); + color: var(--brand); + font-size: 24px; + line-height: 1; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; +} +.cert-nav.prev { + left: 0; +} +.cert-nav.next { + right: 0; +} +.cert-nav:active { + background: var(--soft-bg); +} +.cert-dots { + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + margin-top: 10px; +} +.cert-dots .dot { + width: 7px; + height: 7px; + padding: 0; + border: none; + border-radius: 50%; + background: #cfd8e3; + cursor: pointer; +} +.cert-dots .dot.active { + width: 18px; + border-radius: 4px; + background: var(--brand-2); +} .chain-row { display: flex; align-items: center; @@ -1138,13 +1307,30 @@ watch( .mono { font-family: 'SFMono-Regular', Consolas, monospace; } -.copy { - border: 1px solid #d0d7e2; - background: #f4f7fc; - border-radius: 6px; - padding: 2px 10px; +.icon-copy { + width: 28px; + height: 28px; + border: 1px solid var(--border); + background: var(--card-bg); + border-radius: 50%; color: var(--brand); - font-size: 12px; + display: inline-flex; + align-items: center; + justify-content: center; + flex: 0 0 auto; + cursor: pointer; +} +.icon-copy:active { + background: var(--soft-bg); +} +.anti-copy { + width: 24px; + height: 24px; + margin-left: 6px; + border-color: rgba(255, 255, 255, 0.38); + background: rgba(255, 255, 255, 0.12); + color: #fff; + vertical-align: middle; } .chain-link { display: inline-block; @@ -1185,4 +1371,70 @@ watch( .toast-leave-to { opacity: 0; } +.anti-modal-mask { + position: fixed; + inset: 0; + z-index: 50; + display: flex; + align-items: center; + justify-content: center; + padding: 24px; + background: rgba(15, 23, 42, 0.42); + backdrop-filter: blur(4px); +} +.anti-modal { + position: relative; + width: min(100%, 420px); +} +.anti-modal-card { + margin: 0; + box-shadow: 0 18px 48px rgba(15, 23, 42, 0.24); +} +.anti-modal-close { + position: absolute; + top: -12px; + right: -12px; + z-index: 2; + width: 32px; + height: 32px; + border: 1px solid rgba(15, 23, 42, 0.08); + border-radius: 50%; + background: var(--card-bg); + color: var(--text); + font-size: 22px; + line-height: 1; + cursor: pointer; + box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18); +} +.anti-modal-enter-active, +.anti-modal-leave-active { + transition: opacity 0.18s ease; +} +.anti-modal-enter-active .anti-modal, +.anti-modal-leave-active .anti-modal { + transition: transform 0.18s ease; +} +.anti-modal-enter-from, +.anti-modal-leave-to { + opacity: 0; +} +.anti-modal-enter-from .anti-modal, +.anti-modal-leave-to .anti-modal { + transform: translateY(8px) scale(0.98); +} +@media (prefers-color-scheme: dark) { + .topbar { + background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.96)); + color: var(--text); + border-bottom-color: rgba(148, 163, 184, 0.18); + box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); + } + .lang { + color: var(--text); + } + .lang:active, + .lang:hover { + background: rgba(148, 163, 184, 0.14); + } +}