diff --git a/app/auth.tsx b/app/auth.tsx index 7de89ec..a65273d 100644 --- a/app/auth.tsx +++ b/app/auth.tsx @@ -9,6 +9,7 @@ import { APP_VERSION } from '@/app.config' import BannerSection from '@/components/BannerSection' import { phoneNumber, setAuthToken } from '@/lib/auth' import { isValidPhone } from '@/utils' +import { openUrl } from '@/utils/webview-helper' const APP_NAME = '多米' @@ -17,6 +18,7 @@ export default function Auth() { const [code, setCode] = useState('') const [loading, setLoading] = useState(false) const [countdown, setCountdown] = useState(0) + const [agreed, setAgreed] = useState(false) const canSendCode = useMemo(() => { return isValidPhone(phone) @@ -76,6 +78,11 @@ export default function Auth() { return } + if (!agreed) { + Toast.show({ title: '请先阅读并同意服务条款和隐私协议' }) + return + } + setLoading(true) try { // 使用 better-auth 的 phoneNumber.verify 进行验证和登录 @@ -104,7 +111,7 @@ export default function Auth() { } finally { setLoading(false) } - }, [phone, code]) + }, [phone, code, agreed]) return ( @@ -184,6 +191,31 @@ export default function Auth() { + + setAgreed(!agreed)} + className={`size-[20px] items-center justify-center border-[2px] border-black ${agreed ? 'bg-black' : 'bg-white'}`} + > + {agreed && } + + + 已阅读并同意 + openUrl('https://mixvideo.bowong.cc/terms', '服务条款')} + > + 服务条款 + + + openUrl('https://mixvideo.bowong.cc/privacy', '隐私协议')} + > + 隐私协议 + + + +