fix(login): fix

This commit is contained in:
2026-03-16 15:55:33 +08:00
parent fb31c13336
commit 37ecb4641b
6 changed files with 50 additions and 31 deletions

View File

@@ -4,13 +4,13 @@ import { Login } from "./types"
const BASE_PATH =
process.env.NEXT_PUBLIC_ENV === "production"
? "https://basis.soft.cowarobot.com"
: "https://basis.softtest.cowarobot.com"
? "https://label.soft.cowarobot.com"
: "https://label.softtest.cowarobot.com"
// 获取验证码
export const getVerifyCode = (params: { phone: string }) => {
return httpFetch<ResultData<{}>>({
url: BASE_PATH + `/api/v1/basis/login/get_verify_code`,
url: BASE_PATH + `/api/v1/label_server/login/get_verify_code`,
method: "POST",
body: JSON.stringify(params),
})
@@ -18,10 +18,10 @@ export const getVerifyCode = (params: { phone: string }) => {
// 账户登录
export const passwdLogin = (params: Login.ReqPasswdLogin) => {
return httpFetch<ResultData<Login.ResLogin>>({
url: BASE_PATH + `/api/v1/basis/login/passwd`,
return httpFetch<Login.ResLabelLogin>({
url: BASE_PATH + `/api/v1/label_server/user/login`,
method: "POST",
body: JSON.stringify(params),
body: JSON.stringify({ ...params, name: params.account || params.phone }),
isLogin: true,
})
}
@@ -29,7 +29,7 @@ export const passwdLogin = (params: Login.ReqPasswdLogin) => {
// 验证码登录
export const verificationLogin = (params: Login.ReqVerificationLogin) => {
return httpFetch<ResultData<Login.ResLogin>>({
url: BASE_PATH + `/api/v1/basis/login/verification`,
url: BASE_PATH + `/api/v1/label_server/login/verification`,
method: "POST",
body: JSON.stringify(params),
isLogin: true,
@@ -39,7 +39,7 @@ export const verificationLogin = (params: Login.ReqVerificationLogin) => {
// 飞书登录
export const fetchFeishuLogin = (params: Login.ReqFeishuLogin) => {
return httpFetch<ResultData<Login.ResLogin>>({
url: BASE_PATH + `/api/v1/basis/login/feishu`,
url: BASE_PATH + `/api/v1/label_server/login/feishu`,
method: "POST",
body: JSON.stringify(params),
isLogin: true,
@@ -49,7 +49,7 @@ export const fetchFeishuLogin = (params: Login.ReqFeishuLogin) => {
// 刷新token
export const refreshKey = (params: { token: string }) => {
return httpFetch<ResultData<Login.ResRefreshKey>>({
url: BASE_PATH + `/api/v1/basis/key/refresh`,
url: BASE_PATH + `/api/v1/label_server/user/refresh_token`,
method: "POST",
body: JSON.stringify(params),
isRefresh: true,

View File

@@ -58,6 +58,19 @@ export namespace Login {
refresh_token: string
}
export interface ResLabelLogin {
all_projects: Record<string, Array<number>>
base_city: string
collect_projects: Array<number>
group_name: string
name: string
permissions: Record<string, Record<string, [boolean, any, string]>>
refresh_token: string
token: string
uid: number
work_status: number
}
export interface ResRefreshKey {
access: string
refresh: string