feat: unify invite flow with referral ref

This commit is contained in:
kate522 committed 2026-08-17 13:49:59 +08:00
1 parent f1d6809109
commit b501cf4611
47 files changed
+1083 -2548

No files matched your search

+4 -3
View File
@@ -184,7 +184,7 @@
const code = form.querySelector('[name="code"]')?.value?.trim()
const password = form.querySelector('[name="password"]')?.value
const confirm = form.querySelector('[name="password_confirm"]')?.value
const inviteCode = form.querySelector('[name="invite_code"]')?.value?.trim()
const ref = form.querySelector('[name="ref"]')?.value?.trim()
if (!phone || !code || !password) {
showToast('请填写完整信息', 'warning')
@@ -211,14 +211,15 @@
fetch(REST_BASE + '/auth/phone-register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ phone, code, password, invite_code: inviteCode, ...captchaData }),
body: JSON.stringify({ phone, code, password, ref, ...captchaData }),
})
.then(r => r.json().then(data => ({ ok: r.ok, data })))
.then(({ ok, data }) => {
if (ok && data.success) {
showToast(data.message || '注册成功', 'success')
if (data.notice) showToast(data.notice, 'warning')
setTimeout(() => {
window.location.href = data.data?.redirect || '/'
window.location.href = data.redirect || '/'
}, 500)
} else {
showToast(data.message || '注册失败', 'error')