勾选阅读并同意
This commit is contained in:
parent
9fcbc0346a
commit
8fc4f0c7e6
34
app/auth.tsx
34
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 (
|
||||
<Block className="relative flex-1 bg-black">
|
||||
|
|
@ -184,6 +191,31 @@ export default function Auth() {
|
|||
</Block>
|
||||
</Block>
|
||||
|
||||
<Block className="mt-[8px] flex-row items-center gap-[8px]">
|
||||
<Block
|
||||
onClick={() => setAgreed(!agreed)}
|
||||
className={`size-[20px] items-center justify-center border-[2px] border-black ${agreed ? 'bg-black' : 'bg-white'}`}
|
||||
>
|
||||
{agreed && <Ionicons color="#FFE500" name="checkmark" size={14} />}
|
||||
</Block>
|
||||
<Block className="flex-row flex-wrap items-center">
|
||||
<Text className="font-700 text-[12px] text-black">已阅读并同意</Text>
|
||||
<Text
|
||||
className="font-700 text-[12px] text-black underline"
|
||||
onClick={() => openUrl('https://mixvideo.bowong.cc/terms', '服务条款')}
|
||||
>
|
||||
服务条款
|
||||
</Text>
|
||||
<Text className="font-700 text-[12px] text-black">和</Text>
|
||||
<Text
|
||||
className="font-700 text-[12px] text-black underline"
|
||||
onClick={() => openUrl('https://mixvideo.bowong.cc/privacy', '隐私协议')}
|
||||
>
|
||||
隐私协议
|
||||
</Text>
|
||||
</Block>
|
||||
</Block>
|
||||
|
||||
<Block
|
||||
className={`font-900 mt-[8px] flex-row items-center justify-center gap-[8px] border-[3px] border-black py-[14px] shadow-hard-black ${loading ? 'bg-gray-300' : 'bg-accent'}`}
|
||||
onClick={handleLogin}
|
||||
|
|
|
|||
Loading…
Reference in New Issue