From cc9fdf34757521b199ac5aed98e13cda5b43e745 Mon Sep 17 00:00:00 2001 From: zoujing Date: Fri, 18 Sep 2026 16:02:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=8F=E8=AE=AE=E7=9A=84=E7=94=9F?= =?UTF-8?q?=E6=95=88=E6=97=B6=E9=97=B4=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/content.js | 3 ++- src/pages-sub/agreement/index.vue | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/api/content.js b/src/api/content.js index 81116c2..05675e8 100644 --- a/src/api/content.js +++ b/src/api/content.js @@ -122,12 +122,13 @@ export const getContent = async (key) => { return clone(info); }; -/** 协议页:标题 + 正文段落 + 更新日期 */ +/** 协议页:标题 + 正文段落 + 生效日期 + 更新日期 */ export const getAgreement = async (type = "privacy") => { const info = await getContent(type); return { title: (info && info.title) || FALLBACK_TITLE[type] || "", blocks: toContentBlocks(info && info.body), + validFrom: cnDate(info && info.valid_from), updatedAt: cnDate(info && info.updated_at) || AGREEMENT_DATE, }; }; diff --git a/src/pages-sub/agreement/index.vue b/src/pages-sub/agreement/index.vue index f320cb3..b1061e4 100644 --- a/src/pages-sub/agreement/index.vue +++ b/src/pages-sub/agreement/index.vue @@ -3,20 +3,30 @@ * 协议页:?type=privacy | terms * 合规必备页,「我的」与登录页均可直达。 */ -import { ref } from "vue"; +import { computed, ref } from "vue"; import { onLoad, onShareAppMessage } from "@dcloudio/uni-app"; import contentApi from "@/api/content"; const type = ref("privacy"); const blocks = ref([]); const title = ref(""); +const validFrom = ref(""); const updatedAt = ref(""); +/** 页眉日期行:生效日期 + 更新日期(接口缺哪项就不显示哪项) */ +const metaText = computed(() => { + const parts = []; + if (validFrom.value) parts.push(`生效日期:${validFrom.value}`); + if (updatedAt.value) parts.push(`更新日期:${updatedAt.value}`); + return parts.join(" · "); +}); + onLoad(async (options) => { type.value = options?.type === "terms" ? "terms" : "privacy"; const res = await contentApi.getAgreement(type.value); title.value = res.title; blocks.value = res.blocks || []; + validFrom.value = res.validFrom; updatedAt.value = res.updatedAt; }); @@ -38,7 +48,7 @@ onShareAppMessage(() => ({ - 更新日期:{{ updatedAt }} + {{ metaText }} {{ title }}