import { Checkbox, CheckboxGroup, Text, View } from '@tarojs/components' import Taro from '@tarojs/taro' import { requestPlatformPrivacyAuthorization } from '@/lib/consent' import './index.scss' type Props = { agreed: boolean className?: string onChange: (agreed: boolean) => void } function openAgreement (type: 'service' | 'privacy') { Taro.navigateTo({ url: `/pages/agreement/index?type=${type}` }) } export default function PrivacyConsent ({ agreed, className = '', onChange }: Props) { return ( { const nextAgreed = event.detail.value.includes('agreed') if (!nextAgreed) { onChange(false) return } void requestPlatformPrivacyAuthorization().then((authorized) => { onChange(authorized) if (!authorized) { Taro.showToast({ title: '需同意隐私保护指引后才能继续', icon: 'none' }) } }) }} > 我已阅读并同意 openAgreement('service')}> 《用户服务协议》 openAgreement('privacy')}> 《隐私政策》 ) }