refactor: vite.config.ts 类型修复与 Vite 8 迁移适配
- 修复 vite.config.ts 中 command 隐式 any 类型错误 - 修复 proxy 中 path 参数隐式 any 类型错误 - 将无效的 oxc.drop 配置迁移为 Vite 8 原生方式(build.rolldownOptions.output.minify.compress) - 引入 defineConfig + ConfigEnv 提供完整类型推导 - JS 文件迁移为 TypeScript(user.ts, routerGuard.ts 等) - 更新 API 层类型定义
This commit is contained in:
107
src/api/user.ts
Normal file
107
src/api/user.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import request, { BASE_URL } from '@/utils/request'
|
||||
import type { ApiResult } from '@/types/api'
|
||||
|
||||
/**
|
||||
* 登录返回,对应后端 com.haizhiyustc.system.vo.SysUserLoginVO
|
||||
*/
|
||||
export interface LoginResult {
|
||||
/** 用户id */
|
||||
userId: string;
|
||||
/** 登录令牌 */
|
||||
token: string;
|
||||
/** 令牌请求头名称 */
|
||||
tokenName: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户个人资料,对应后端 UserInfoVO.UserInfoProfile
|
||||
*/
|
||||
export interface UserProfile {
|
||||
/** 账号id */
|
||||
id?: string;
|
||||
/** 头像 */
|
||||
avatar?: string;
|
||||
/** 登录账号 */
|
||||
account?: string;
|
||||
/** 账户名 */
|
||||
name?: string;
|
||||
/** 性别 */
|
||||
gender?: string;
|
||||
/** 邮箱 */
|
||||
email?: string;
|
||||
/** 手机号 */
|
||||
phone?: string;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登录用户信息,对应后端 com.haizhiyustc.system.vo.UserInfoVO
|
||||
*/
|
||||
export interface UserInfoVO {
|
||||
/** 账号名 */
|
||||
name?: string;
|
||||
/** 角色 */
|
||||
role?: string;
|
||||
/** 角色列表 */
|
||||
roles?: string[];
|
||||
/** 权限列表 */
|
||||
permissions?: string[];
|
||||
/** 用户个人资料 */
|
||||
profile?: UserProfile;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export function getPublicKey() {
|
||||
return request<ApiResult<string>>({
|
||||
url: 'admin/account/publicKey'
|
||||
})
|
||||
}
|
||||
|
||||
export function login(data: Record<string, unknown>) {
|
||||
return request<ApiResult<LoginResult>>({
|
||||
url: 'admin/account/login',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function captcha(): string {
|
||||
return BASE_URL + '/admin/account/captcha'
|
||||
}
|
||||
|
||||
export function getInfo() {
|
||||
return request<ApiResult<UserInfoVO>>({
|
||||
url: 'admin/account/info',
|
||||
})
|
||||
}
|
||||
|
||||
export function updateInfo(data: Record<string, unknown>) {
|
||||
return request<ApiResult<unknown>>({
|
||||
url: 'admin/account/update',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updatePwd(data: Record<string, unknown>) {
|
||||
return request<ApiResult<unknown>>({
|
||||
url: 'admin/account/updatePwd',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 发送重置密码验证码
|
||||
export function getVerifyCode(data: Record<string, unknown>) {
|
||||
return request<ApiResult<unknown>>({
|
||||
url: '/admin/sysUser/getVerifyCode',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//忘记密码
|
||||
export function resetUserPassword(data: Record<string, unknown>) {
|
||||
return request<ApiResult<unknown>>({
|
||||
url: '/admin/sysUser/resetUserPassword',
|
||||
data
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user