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 }}