feat 完善注释

This commit is contained in:
Ironsp
2026-10-01 17:24:57 +08:00
parent 2b59f68fd7
commit 9f4a5c7cda
183 changed files with 485 additions and 3615 deletions

View File

@@ -8,16 +8,8 @@ import type {
} from '@/types/business/user'
import { isPhone, isValidPassword } from '@/utils/validate'
/**
* PC 端 clientId(sys_client 种子数据,grantType 含 password)。
* 与请求头 clientid 同源(见 @/utils/request),改一处即可整体生效。
*/
export const PC_CLIENT_ID = CLIENT_ID
/**
* 账号密码登录:POST /auth/login
* 后端要求请求体含 clientId + grantType + username + password(api-decrypt 未开启,明文即可)
*/
export function loginByAccountApi(data: { username: string; password: string }): Promise<AuthLoginResult> {
return request<AuthLoginResult>({
url: '/auth/login',
@@ -31,10 +23,6 @@ export function loginByAccountApi(data: { username: string; password: string }):
})
}
/**
* 账号密码注册:POST /auth/register
* userType=sys_user;需后端开启注册开关(sys.account.registerUser=true),否则返回「当前系统没有开启注册功能!」
*/
export function registerByAccountApi(data: { username: string; password: string }): Promise<RegisterResult> {
return request<RegisterResult>({
url: '/auth/register',
@@ -53,13 +41,11 @@ export function registerByAccountApi(data: { username: string; password: string
const SIX_DIGIT_CODE = /^\d{6}$/
/** 发送短信验证码 */
export function sendSmsCode(phone: string): Promise<void> {
if (!isPhone(phone)) return Promise.reject(new Error('手机号格式不正确'))
return Promise.resolve()
}
/** 手机验证码登录(mock:验证码须为 6 位数字) */
export function loginBySms(params: LoginBySmsParams): Promise<LoginResult> {
const { phone, code } = params
if (!isPhone(phone)) return Promise.reject(new Error('手机号格式不正确'))
@@ -90,7 +76,6 @@ function validateAuthForm(
return null
}
/** 重置密码 */
export function resetPassword(params: ResetPasswordParams): Promise<void> {
const message = validateAuthForm(
params.phone,