--- a/src/passport/register.tsx 2026-07-16 15:55:24.000000000 +0800 +++ b/src/passport/register.tsx 2026-07-16 15:54:30.000000000 +0800 @@ -4,9 +4,8 @@ import { Button, Checkbox } from '@nutui/nutui-react-taro' import { TenantId } from '@/config/app' import { getUserInfo, getWxOpenId } from '@/api/layout' -import { saveStorageByLoginUser, SERVER_API_URL } from '@/utils/server' +import { saveStorageByLoginUser } from '@/utils/server' import { isUserDisabled } from '@/utils/auth' -import request from '@/utils/request' import { getStoredInviteParams, parseInviteParams, @@ -26,6 +25,17 @@ detail: GetPhoneNumberDetail } +interface LoginResponse { + data: { + code?: number + message?: string + data?: { + access_token: string + user: any + } + } +} + async function getWeappLoginCode(): Promise { try { const res = await new Promise<{ code?: string }>((resolve, reject) => { @@ -181,9 +191,10 @@ // 获取小程序登录 code(用于后续绑定 openid) const wxLoginCode = await getWeappLoginCode() - const res: any = await request.post( - `${SERVER_API_URL}/wx-login/loginByMpWxPhone`, - { + const res = (await Taro.request({ + url: 'https://shop-api.websoft.top/api/wx-login/loginByMpWxPhone', + method: 'POST', + data: { code: phoneCode, encryptedData, iv, @@ -192,16 +203,19 @@ sceneType: 'save_referee', tenantId: TenantId, }, - { showError: false } - ) + header: { + 'content-type': 'application/json', + TenantId, + }, + })) as unknown as LoginResponse - if (res?.code === 1) { - Taro.showToast({ title: res.message || '登录失败', icon: 'none' }) + if ((res as any)?.data?.code === 1) { + Taro.showToast({ title: res.data.message || '登录失败', icon: 'none' }) return } - const token = res?.data?.access_token - const user = res?.data?.user + const token = res?.data?.data?.access_token + const user = res?.data?.data?.user if (!token || !user?.userId) { Taro.showToast({ title: '登录失败,请重试', icon: 'none' }) return