From a2c4f49ee671acd1ab671e835c3854cd3735a63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 15 Jul 2026 16:52:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(dashboard):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E9=9D=A2=E6=9D=BF=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90=E5=8F=8A=E8=BF=90=E8=A1=8C=E5=A4=A9=E6=95=B0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 统一从 app_product.product_id=65 和 app_subscription 获取面板数据,替代原硬编码和 tenant/siteStore - 字段映射调整,软件名称、版本号、运行状态、创建时间等均改用 product 与 subscription 字段 - 删除硬编码的 systemInfo reactive,移除不必要的 reactive 导入 - 新增 productStatusText 计算属性,对 publishStatus 状态做文字和颜色映射 - 重写运行天数计算,改用订阅生效时间 startTime,修正续费重置计数的边界响应 - 模板绑定全部字段,增加骨架屏 loading 状态,避免界面闪烁 - 添加「系统运行」字段提示信息,明确起算时间语义 - 保持 loadSubscriptionInfo 调用 getProductDetail,无新增接口请求 - 确保 vue-tsc 类型校验无新增错误 --- .workbuddy/memory/2026-07-15.md | 20 ++++++++++++++++++++ src/views/shop/dashboard/index.vue | 15 ++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.workbuddy/memory/2026-07-15.md b/.workbuddy/memory/2026-07-15.md index 30c6b51..ef40be7 100644 --- a/.workbuddy/memory/2026-07-15.md +++ b/.workbuddy/memory/2026-07-15.md @@ -146,3 +146,23 @@ - form reactive 默认值新增 `paymentVoucher: undefined`,对齐 `ShopOrder` model。 - `ShopOrder` model 中 `paymentVoucher?: string` 字段早就存在(payTime 之后),无需改 model/API。 - 用户场景:仅线下付款(payType=9)的订单才有此凭证图,条件渲染自然处理。 + +## Dashboard 基本信息 6 字段数据源重构(product + subscription) + +- 需求:dashboard「基本信息」面板原先混用硬编码/tenant/siteStore,改为统一从 `app_product.product_id=65` + `app_subscription` 读取,语义更准确。 +- 字段映射决策(用户确认): + - 系统名称 → `currentProduct.productName`(原硬编码 '小程序商城') + - 版本号 → `currentProduct.version`(原硬编码 '2.0.0') + - 运行状态 → `currentProduct.publishStatus` + 中文映射 + a-tag 颜色(原 `siteStore.statusText`) + - 创建时间 → `currentSubscription.startTime`(原 `tenantStore.company?.createTime`) + - 到期时间 → `currentSubscription.expireTime`(保持不变,原本就是这个) + - 系统运行天数 → 自 `currentSubscription.startTime` 起累计(原自 `tenantStore.company?.createTime`;后改为 startTime,与"创建时间"行同源,语义统一) +- 改动 `src/views/shop/dashboard/index.vue`: + - 删除硬编码 `systemInfo` reactive(已确认 cms 那两个 systemInfo 是独立 const,互不影响)。 + - import 移除 `reactive`。 + - 新增 `productStatusText` computed:publishStatus → {text,color} 映射(published=已发布/green、pending_review=审核中/orange、developing=开发中/blue、rejected=已驳回/red、deprecated=已下架/red),未知状态显示原始值,无 product 显示 '-'。 + - 重写 `runDays` computed:数据源由 `tenantStore.company?.createTime` 改为 `currentSubscription.value?.startTime`(与"创建时间"行同源),注释说明续费新增订阅记录会重置计数的边界行为。 + - 模板 6 个字段全部重绑,每个字段加 `subscriptionLoading` 骨架屏分支(避免空白/老数据闪现)。 + - 「系统运行」加 `a-tooltip title="自您首次开通小程序商城起"`(用户要求)。 +- 数据流复用:`loadSubscriptionInfo()` 原本就调 `getProductDetail(65)` 填充 `currentProduct`,无需新增接口调用。 +- 类型校验:vue-tsc 对 `shop/dashboard/index.vue` 行级错误 0 条;cms 那批历史错误与本次无关。 diff --git a/src/views/shop/dashboard/index.vue b/src/views/shop/dashboard/index.vue index 3269f61..1a8adf6 100644 --- a/src/views/shop/dashboard/index.vue +++ b/src/views/shop/dashboard/index.vue @@ -158,7 +158,7 @@