feat: 协议的生效时间添加
This commit is contained in:
1 parent
d0a1427e12
commit
cc9fdf3475
2 files changed
+14
-3
No files matched your search
+2
-1
@@ -122,12 +122,13 @@ export const getContent = async (key) => {
|
|||||||
return clone(info);
|
return clone(info);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 协议页:标题 + 正文段落 + 更新日期 */
|
/** 协议页:标题 + 正文段落 + 生效日期 + 更新日期 */
|
||||||
export const getAgreement = async (type = "privacy") => {
|
export const getAgreement = async (type = "privacy") => {
|
||||||
const info = await getContent(type);
|
const info = await getContent(type);
|
||||||
return {
|
return {
|
||||||
title: (info && info.title) || FALLBACK_TITLE[type] || "",
|
title: (info && info.title) || FALLBACK_TITLE[type] || "",
|
||||||
blocks: toContentBlocks(info && info.body),
|
blocks: toContentBlocks(info && info.body),
|
||||||
|
validFrom: cnDate(info && info.valid_from),
|
||||||
updatedAt: cnDate(info && info.updated_at) || AGREEMENT_DATE,
|
updatedAt: cnDate(info && info.updated_at) || AGREEMENT_DATE,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,20 +3,30 @@
|
|||||||
* 协议页:?type=privacy | terms
|
* 协议页:?type=privacy | terms
|
||||||
* 合规必备页,「我的」与登录页均可直达。
|
* 合规必备页,「我的」与登录页均可直达。
|
||||||
*/
|
*/
|
||||||
import { ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import { onLoad, onShareAppMessage } from "@dcloudio/uni-app";
|
import { onLoad, onShareAppMessage } from "@dcloudio/uni-app";
|
||||||
import contentApi from "@/api/content";
|
import contentApi from "@/api/content";
|
||||||
|
|
||||||
const type = ref("privacy");
|
const type = ref("privacy");
|
||||||
const blocks = ref([]);
|
const blocks = ref([]);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
|
const validFrom = ref("");
|
||||||
const updatedAt = 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) => {
|
onLoad(async (options) => {
|
||||||
type.value = options?.type === "terms" ? "terms" : "privacy";
|
type.value = options?.type === "terms" ? "terms" : "privacy";
|
||||||
const res = await contentApi.getAgreement(type.value);
|
const res = await contentApi.getAgreement(type.value);
|
||||||
title.value = res.title;
|
title.value = res.title;
|
||||||
blocks.value = res.blocks || [];
|
blocks.value = res.blocks || [];
|
||||||
|
validFrom.value = res.validFrom;
|
||||||
updatedAt.value = res.updatedAt;
|
updatedAt.value = res.updatedAt;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -38,7 +48,7 @@ onShareAppMessage(() => ({
|
|||||||
<view class="h-[46px]" />
|
<view class="h-[46px]" />
|
||||||
|
|
||||||
<view class="px-5 pt-[18px] pb-10">
|
<view class="px-5 pt-[18px] pb-10">
|
||||||
<view class="text-[11.5px] text-ink3 mb-[18px]">更新日期:{{ updatedAt }}</view>
|
<view class="text-[11.5px] text-ink3 mb-[18px]">{{ metaText }}</view>
|
||||||
<view class="text-[19px] font-semibold mb-[6px] text-ink">{{ title }}</view>
|
<view class="text-[19px] font-semibold mb-[6px] text-ink">{{ title }}</view>
|
||||||
|
|
||||||
<template v-for="(block, i) in blocks" :key="i">
|
<template v-for="(block, i) in blocks" :key="i">
|
||||||
|
|||||||
Reference in new issue
Block a user