feat(api-keys): 优化隐私协议同意逻辑及样式
- 修正api-keys样式导入路径,改为developer路径 - 在开发者申请页面增加服务协议和隐私政策勾选框 - 提交时校验协议是否已勾选,未勾选时提示用户 - 优化申请页面协议区域样式及交互 - 在用户验证页面添加隐私政策同意勾选框 - 提交用户验证表单时检查协议同意状态 - 增加打开服务协议和隐私政策的链接跳转 - 更新项目配置,增加passport/webview路由配置 - 修复createTicket函数中日期格式正则表达式问题
This commit is contained in:
@@ -4,12 +4,19 @@
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "passport/webview/index",
|
||||
"pathName": "passport/webview/index",
|
||||
"query": "url=https%3A%2F%2Fwebsopy.websoft.top%2Fdeveloper",
|
||||
"scene": null,
|
||||
"launchMode": "default"
|
||||
},
|
||||
{
|
||||
"name": "passport/login",
|
||||
"pathName": "passport/login",
|
||||
"query": "",
|
||||
"scene": null,
|
||||
"launchMode": "default"
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "passport/invite/index",
|
||||
|
||||
@@ -187,7 +187,7 @@ export async function listTicketReply(ticketId: string): Promise<TicketReply[]>
|
||||
export async function createTicket(data: Partial<Ticket>): Promise<Ticket> {
|
||||
const newTicket: Ticket = {
|
||||
id: String(Date.now()),
|
||||
ticketNo: `TK${new Date().toISOString().replace(/[-:T]/g, '').slice(0, 12)}`,
|
||||
ticketNo: `TK${new Date().toISOString().replace(/[\-:T]/g, '').slice(0, 12)}`,
|
||||
title: data.title || '',
|
||||
content: data.content || '',
|
||||
type: data.type || 'technical',
|
||||
|
||||
@@ -31,6 +31,7 @@ const DeveloperApplyPage: React.FC = () => {
|
||||
experience: '',
|
||||
})
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
const [agreementChecked, setAgreementChecked] = useState(false)
|
||||
|
||||
// 加载申请记录
|
||||
const loadData = async (pageNum: number = 1, isRefresh = false) => {
|
||||
@@ -77,6 +78,15 @@ const DeveloperApplyPage: React.FC = () => {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查隐私协议是否同意
|
||||
if (!agreementChecked) {
|
||||
Taro.showToast({
|
||||
title: '请先同意服务协议和隐私政策',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
setSubmitting(true)
|
||||
try {
|
||||
await createApply({
|
||||
@@ -203,10 +213,27 @@ const DeveloperApplyPage: React.FC = () => {
|
||||
</View>
|
||||
|
||||
<View className="apply-page__agreement">
|
||||
<Text className="apply-page__agreement-text">
|
||||
点击提交即表示您同意《开发者协议》和《隐私政策》
|
||||
<View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
<View
|
||||
style={{
|
||||
width: '18px', height: '18px', borderRadius: '4px',
|
||||
border: agreementChecked ? 'none' : '1px solid #ccc',
|
||||
background: agreementChecked ? '#3b82f6' : 'transparent',
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
marginRight: '8px'
|
||||
}}
|
||||
onClick={() => setAgreementChecked(!agreementChecked)}
|
||||
>
|
||||
{agreementChecked && <Text style={{ color: '#fff', fontSize: '12px' }}>✓</Text>}
|
||||
</View>
|
||||
<Text className="apply-page__agreement-text" style={{ fontSize: '12px' }}>
|
||||
我已阅读并同意
|
||||
<Text style={{ color: '#3b82f6' }} onClick={() => Taro.navigateTo({ url: '/passport/webview/index?url=' + encodeURIComponent('https://websopy.websoft.top/agreement') })}>《开发者协议》</Text>
|
||||
和
|
||||
<Text style={{ color: '#3b82f6' }} onClick={() => Taro.navigateTo({ url: '/passport/webview/index?url=' + encodeURIComponent('https://websopy.websoft.top/privacy') })}>《隐私政策》</Text>
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<Button
|
||||
className="apply-page__submit"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// 复用 app/api-keys/index.scss 的样式
|
||||
@import '../../app/api-keys/index';
|
||||
// 复用 developer/app/api-keys/index.scss 的样式
|
||||
@import '../../developer/app/api-keys/index';
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
Button,
|
||||
Input,
|
||||
Radio,
|
||||
Checkbox,
|
||||
} from '@nutui/nutui-react-taro'
|
||||
import {UserVerify} from "@/api/system/userVerify/model";
|
||||
import {addUserVerify, myUserVerify, updateUserVerify} from "@/api/system/userVerify";
|
||||
@@ -16,6 +17,7 @@ import {uploadFile} from "@/api/system/file";
|
||||
function Index() {
|
||||
const [isUpdate, setIsUpdate] = useState<boolean>(false)
|
||||
const [submitText, setSubmitText] = useState<string>('提交')
|
||||
const [privacyAgreed, setPrivacyAgreed] = useState<boolean>(false)
|
||||
|
||||
const [FormData, setFormData] = useState<UserVerify>({
|
||||
userId: undefined,
|
||||
@@ -49,10 +51,29 @@ function Index() {
|
||||
})
|
||||
}
|
||||
|
||||
// 打开协议页面
|
||||
const openAgreement = (type: 'service' | 'privacy') => {
|
||||
const urlMap = {
|
||||
service: 'https://websopy.websoft.top/agreement',
|
||||
privacy: 'https://websopy.websoft.top/privacy',
|
||||
};
|
||||
const targetUrl = encodeURIComponent(urlMap[type]);
|
||||
Taro.navigateTo({ url: `/passport/webview/index?url=${targetUrl}` });
|
||||
};
|
||||
|
||||
// 提交表单
|
||||
const submitSucceed = (values: any) => {
|
||||
console.log('提交表单', values);
|
||||
if (FormData.status != 2 && FormData.status != undefined) return false;
|
||||
|
||||
// 检查隐私协议是否同意
|
||||
if (!privacyAgreed) {
|
||||
Taro.showToast({
|
||||
title: '请先同意隐私政策和服务协议',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (FormData.type == 0) {
|
||||
if (!FormData.sfz1 || !FormData.sfz2) {
|
||||
Taro.showToast({
|
||||
@@ -158,6 +179,26 @@ function Index() {
|
||||
onFinishFailed={(errors) => submitFailed(errors)}
|
||||
footer={
|
||||
FormData.status != 1 && FormData.status != 0 && (
|
||||
<div style={{ width: '100%' }}>
|
||||
{/* 隐私协议勾选 */}
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
marginBottom: '16px',
|
||||
fontSize: '12px'
|
||||
}}>
|
||||
<Checkbox
|
||||
checked={privacyAgreed}
|
||||
onChange={(value) => setPrivacyAgreed(value)}
|
||||
/>
|
||||
<span style={{ color: '#666', marginLeft: '8px' }}>
|
||||
我已阅读并同意
|
||||
<span style={{ color: '#3b82f6' }} onClick={() => openAgreement('service')}>《服务协议》</span>
|
||||
和
|
||||
<span style={{ color: '#3b82f6' }} onClick={() => openAgreement('privacy')}>《隐私政策》</span>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
@@ -170,6 +211,7 @@ function Index() {
|
||||
{submitText}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user