feat(project): init

This commit is contained in:
2026-03-10 17:06:22 +08:00
commit 1ae8509cce
70 changed files with 5141 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
import httpFetch from "@/api/fetch"
import { ResultData } from "@/api/typing"
import { Login } from "./types"
const BASE_PATH =
process.env.NEXT_PUBLIC_ENV === "production"
? "https://basis.soft.cowarobot.com"
: "https://basis.softtest.cowarobot.com"
// 获取验证码
export const getVerifyCode = (params: { phone: string }) => {
return httpFetch<ResultData<{}>>({
url: BASE_PATH + `/api/v1/basis/login/get_verify_code`,
method: "POST",
body: JSON.stringify(params),
})
}
// 账户登录
export const passwdLogin = (params: Login.ReqPasswdLogin) => {
return httpFetch<ResultData<Login.ResLogin>>({
url: BASE_PATH + `/api/v1/basis/login/passwd`,
method: "POST",
body: JSON.stringify(params),
isLogin: true,
})
}
// 验证码登录
export const verificationLogin = (params: Login.ReqVerificationLogin) => {
return httpFetch<ResultData<Login.ResLogin>>({
url: BASE_PATH + `/api/v1/basis/login/verification`,
method: "POST",
body: JSON.stringify(params),
isLogin: true,
})
}
// 飞书登录
export const fetchFeishuLogin = (params: Login.ReqFeishuLogin) => {
return httpFetch<ResultData<Login.ResLogin>>({
url: BASE_PATH + `/api/v1/basis/login/feishu`,
method: "POST",
body: JSON.stringify(params),
isLogin: true,
})
}
// 刷新token
export const refreshKey = (params: { token: string }) => {
return httpFetch<ResultData<Login.ResRefreshKey>>({
url: BASE_PATH + `/api/v1/basis/key/refresh`,
method: "POST",
body: JSON.stringify(params),
isRefresh: true,
})
}
// 删除cookie
export const deleteCookie = () => {
return httpFetch<ResultData<string>>({
url: `/api/session`,
method: "DELETE",
isDeleteCookie: true,
})
}