diff --git a/src/app.config.ts b/src/app.config.ts index 0c54a6e..d317854 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -33,7 +33,8 @@ export default defineAppConfig({ 'goodsRefundResult/index', // 商品退款结果(成功,失败) 'historyCoupons/index', // 历史优惠券 'helpCenter/index', // 帮助中心 - 'agreement/index', // 协议 + 'agreement/index', // 协议列表 + 'agreementDetail/index', // 协议详情 'editProfile/index', // 编辑资料 'vipBenefits/index', // VIP权益 'benefitDetail/index', // 权益详情 diff --git a/src/pagesUser/agreement/index.tsx b/src/pagesUser/agreement/index.tsx index 96817ec..4551157 100644 --- a/src/pagesUser/agreement/index.tsx +++ b/src/pagesUser/agreement/index.tsx @@ -1,40 +1,26 @@ /** - * 协议页 + * 协议列表页 */ import { View, Text } from '@tarojs/components' -import Taro, { useLoad } from '@tarojs/taro' +import Taro from '@tarojs/taro' import { Cell } from '@taroify/core' import './index.scss' -// 协议列表 const agreementList = [ - { id: 1, title: '用户协议', type: 'user' }, + { id: 1, title: '用户服务协议', type: 'user' }, { id: 2, title: '隐私政策', type: 'privacy' }, { id: 3, title: '台球充值服务协议', type: 'recharge' }, - { id: 4, title: 'VIP用户协议', type: 'vip' }, - { id: 5, title: '其他/视频授权协议', type: 'video' }, - { id: 6, title: '协议列表标题协议列表标题协议列表标题协议标题协议标题', type: 'test' }, ] const Agreement = () => { - useLoad(() => { - console.log('协议页面加载') - }) - - // 点击协议项 const handleAgreementClick = (agreement: { id: number; title: string; type: string }) => { - console.log('点击协议', agreement) - // TODO: 跳转到协议详情页 - Taro.showToast({ - title: '功能开发中', - icon: 'none', - duration: 2000 + Taro.navigateTo({ + url: `/pagesUser/agreementDetail/index?type=${agreement.type}`, }) } return ( - {/* 协议列表 */} {agreementList.map((agreement) => ( = { + user: userAgreement, + privacy: privacyPolicy, + recharge: rechargeAgreement, +} + +const AgreementDetail = () => { + const [doc, setDoc] = useState(null) + + useLoad((options) => { + const type = options.type || 'user' + const agreement = docMap[type] || userAgreement + setDoc(agreement) + Taro.setNavigationBarTitle({ title: agreement.title }) + }) + + if (!doc) return null + + return ( + + {doc.title} + {doc.updateDate} + {doc.sections.map((section, idx) => ( + + {section.title} + {section.body} + + ))} + + ) +} + +export default AgreementDetail