feat(miniprogram): 用户协议 + 隐私政策页面,登录需勾选同意
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

- 新增 legal/user-agreement 和 legal/privacy-policy 页面
- 登录页增加协议勾选复选框(未勾选时拦截登录/绑定)
- 协议链接可点击跳转查看全文
- RichText 渲染 HTML 格式协议内容
This commit is contained in:
iven
2026-04-24 12:58:27 +08:00
parent 6776a82926
commit afc307e373
6 changed files with 212 additions and 0 deletions

View File

@@ -6,9 +6,14 @@ import './index.scss';
export default function Login() {
const [needBind, setNeedBind] = useState(false);
const [agreed, setAgreed] = useState(false);
const { login, bindPhone, loading } = useAuthStore();
const handleWechatLogin = async () => {
if (!agreed) {
Taro.showToast({ title: '请先阅读并同意用户协议', icon: 'none' });
return;
}
try {
const { code } = await Taro.login();
const success = await login(code);
@@ -24,6 +29,10 @@ export default function Login() {
};
const handleGetPhone = async (e: { detail: { errMsg: string; encryptedData: string; iv: string } }) => {
if (!agreed) {
Taro.showToast({ title: '请先阅读并同意用户协议', icon: 'none' });
return;
}
if (e.detail.errMsg !== 'getPhoneNumber:ok') {
Taro.showToast({ title: '需要授权手机号', icon: 'none' });
return;
@@ -63,6 +72,18 @@ export default function Login() {
</Button>
)}
</View>
<View className='agreement-row'>
<View className={`checkbox ${agreed ? 'checked' : ''}`} onClick={() => setAgreed(!agreed)}>
{agreed && <Text className='check-mark'>&#10003;</Text>}
</View>
<Text className='agreement-text'>
<Text className='agreement-link' onClick={() => Taro.navigateTo({ url: '/pages/legal/user-agreement' })}></Text>
<Text className='agreement-link' onClick={() => Taro.navigateTo({ url: '/pages/legal/privacy-policy' })}></Text>
</Text>
</View>
</View>
);
}