feat(#558): 微信登录前端 - 授权按钮、回调页、绑定弹窗 (#672)
CI/CD Pipeline / Staging E2E Tests (push) Failing after 2m31s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1372h41m40s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 1372h41m44s
CI/CD Pipeline / Build Production Web Image (push) Failing after 1372h41m44s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 1372h41m46s
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been skipped
CI/CD Pipeline / Unit Tests (push) Has been skipped
CI/CD Pipeline / Integration Tests (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (push) Has been skipped
CI/CD Pipeline / Build Staging API Image (push) Has been skipped
CI/CD Pipeline / Build Staging Web Image (push) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (push) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Failing after 1373h13m52s
CI/CD Pipeline / Build Production API Image (push) Failing after 1373h13m54s
CI/CD Pipeline / ACR Image Cleanup (push) Has been skipped

Co-authored-by: xiaoxia <dev@xiaoxiajianji.com>
Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #672.
This commit is contained in:
2026-07-21 10:47:31 +08:00
committed by auto-approve-bot
parent beabc932e6
commit 9a1eb14fbb
5 changed files with 407 additions and 3 deletions
+64
View File
@@ -121,3 +121,67 @@ export const verifyEmail = async (token: string): Promise<{ message: string }> =
const response = await apiClient.post("/auth/verify-email", { token })
return response.data
}
/* ========== 微信登录 ========== */
export interface WechatAuthUrlResponse {
auth_url: string
state: string
}
export interface WechatCallbackResponse {
access_token: string
refresh_token?: string | null
user_id: string
display_name: string
avatar_url: string
is_new_user: boolean
binding_complete: boolean
expires_in: number
}
export interface SendVerificationCodeRequest {
target: "email" | "phone"
value: string
purpose: "bind" | "login" | "reset_password"
}
export interface BindContactRequest {
target: "email" | "phone"
value: string
code: string
}
export interface BindContactResponse {
message: string
user: User
}
// 获取微信授权链接
export const getWechatAuthUrl = async (): Promise<WechatAuthUrlResponse> => {
const response = await apiClient.get("/auth/wechat/url")
return response.data
}
// 微信回调登录
export const wechatCallback = async (
code: string,
state: string,
): Promise<WechatCallbackResponse> => {
const response = await apiClient.post("/auth/wechat/callback", { code, state })
return response.data
}
// 发送验证码
export const sendVerificationCode = async (
data: SendVerificationCodeRequest,
): Promise<{ message: string }> => {
const response = await apiClient.post("/auth/send-verification-code", data)
return response.data
}
// 绑定联系方式
export const bindContact = async (data: BindContactRequest): Promise<BindContactResponse> => {
const response = await apiClient.post("/auth/bind-contact", data)
return response.data
}