feat(player): 接入创蓝短信手机注册与登录页优化
新增 SMS 验证码注册、8 国手机号选择与 Redis 频控;优化登录/注册 UI 及图形验证码样式。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,8 +20,13 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
loginPromptVisible.value = false;
|
||||
}
|
||||
|
||||
async function login(username: string, password: string) {
|
||||
const { data } = await api.post('/player/auth/login', { username, password });
|
||||
async function login(username: string, password: string, countryCode?: string) {
|
||||
const dial = countryCode?.replace(/\D/g, '');
|
||||
const { data } = await api.post('/player/auth/login', {
|
||||
username,
|
||||
password,
|
||||
...(dial ? { countryCode: dial } : {}),
|
||||
});
|
||||
token.value = data.data.token;
|
||||
user.value = data.data.user;
|
||||
localStorage.setItem('token', token.value);
|
||||
@@ -32,12 +37,23 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
return returnTo;
|
||||
}
|
||||
|
||||
async function register(username: string, password: string, inviteCode?: string) {
|
||||
async function register(
|
||||
phone: string,
|
||||
countryCode: string,
|
||||
password: string,
|
||||
smsCode: string,
|
||||
sessionId: string,
|
||||
inviteCode?: string,
|
||||
) {
|
||||
const locale = localStorage.getItem('locale') || 'zh-CN';
|
||||
const code = inviteCode?.trim();
|
||||
const dial = countryCode.replace(/\D/g, '');
|
||||
const { data } = await api.post('/player/auth/register', {
|
||||
username,
|
||||
phone,
|
||||
countryCode: dial,
|
||||
password,
|
||||
smsCode,
|
||||
sessionId,
|
||||
locale,
|
||||
...(code ? { inviteCode: code } : {}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user