mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-15 05:19:17 +00:00
refactor: 小程序端代码瘦身与功能补齐
- 清理冗余代码与配置: - 删除废弃的 mock 适配器、通用 mock 模块与示例API - 移除冗余的 ts 类型文件与 patch 目录 - 简化 tsconfig 组件路径配置 - 新增功能与优化: - 新增全局水印组件与水印配置 - 接入微信小程序登录/手机号登录 - 新增系统参数配置 store 与国际化支持 - 新增 markdown 渲染插件与样式配置 - 优化 pinia 持久化逻辑修复 - 新增微信小程序 access_token 缓存配置 - 修复登录趋势数据结构定义 - 优化全局请求防抖重定向逻辑 - 页面与路由优化: - 补全引导页首次启动逻辑 - 统一页面底部安全区适配 - 更新页面路由类型声明 - 代码质量优化: - 移除无用 console.log 调试代码 - 修复全局弹窗重复重登录问题 - 优化 mp-html 组件配置
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { http } from '@/http'
|
||||
import { ContentTypeEnum } from '@/http/tools/enum'
|
||||
|
||||
const USER_BASE_URL = '/system/user'
|
||||
|
||||
@@ -20,15 +19,13 @@ const UserAPI = {
|
||||
/**
|
||||
* 当前用户头像上传
|
||||
*
|
||||
* @param body
|
||||
* @returns 上传后的文件路径
|
||||
* @param body 上传参数
|
||||
* @param body.filePath 本地临时文件路径(uni.chooseImage 选择结果)
|
||||
* @param body.name 上传字段名,后端约定为 file
|
||||
* @returns uni.uploadFile 成功回调(statusCode + data 响应体字符串,需调用方解析)
|
||||
*/
|
||||
uploadCurrentUserAvatar(body: Record<string, any>): Promise<UploadFileResult> {
|
||||
return http.Post(`${USER_BASE_URL}/current/avatar/upload`, body, {
|
||||
headers: {
|
||||
'Content-Type': ContentTypeEnum.FORM_DATA,
|
||||
},
|
||||
})
|
||||
uploadCurrentUserAvatar(body: { filePath: string, name?: string }): Promise<{ statusCode: number, data: string }> {
|
||||
return http.Post(`${USER_BASE_URL}/current/avatar/upload`, body, { requestType: 'upload' })
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -52,23 +49,28 @@ const UserAPI = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 注册用户
|
||||
* 注册用户(公开接口)
|
||||
*
|
||||
* @param body
|
||||
* @returns 忘记密码结果
|
||||
* @param body 注册参数
|
||||
* @param body.username 用户名(字母开头,3-32 位)
|
||||
* @param body.password 密码(6-128 位)
|
||||
* @param body.name 昵称(可选)
|
||||
* @returns 注册结果
|
||||
*/
|
||||
registerUser(body: RegisterForm): Promise<void> {
|
||||
return http.Post(`${USER_BASE_URL}/register`, body)
|
||||
return http.Post(`${USER_BASE_URL}/register`, body, { meta: { ignoreAuth: true } })
|
||||
},
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
* 忘记密码(公开接口)
|
||||
*
|
||||
* @param body
|
||||
* @returns 忘记密码结果
|
||||
* @param body 重置参数
|
||||
* @param body.username 用户名(字母开头,3-32 位)
|
||||
* @param body.new_password 新密码(6-128 位)
|
||||
* @returns 重置结果
|
||||
*/
|
||||
forgetPassword(body: ForgetPasswordForm): Promise<void> {
|
||||
return http.Post(`${USER_BASE_URL}/password/forget`, body)
|
||||
return http.Post(`${USER_BASE_URL}/password/forget`, body, { meta: { ignoreAuth: true } })
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -167,18 +169,17 @@ const UserAPI = {
|
||||
|
||||
export default UserAPI
|
||||
|
||||
/* 忘记密码表单 */
|
||||
/* 忘记密码表单(与后端 UserForgetPasswordSchema 一致,confirmPassword 为前端校验字段不提交) */
|
||||
export interface ForgetPasswordForm {
|
||||
username: string
|
||||
new_password: string
|
||||
confirmPassword: string
|
||||
}
|
||||
|
||||
/* 注册表单 */
|
||||
export interface RegisterForm {
|
||||
username: string
|
||||
password: string
|
||||
confirmPassword: string
|
||||
name?: string
|
||||
}
|
||||
|
||||
/* 分页查询表单 */
|
||||
@@ -213,6 +214,7 @@ export interface UserForm extends BaseFormType {
|
||||
gender?: number
|
||||
email?: string
|
||||
mobile?: string
|
||||
avatar?: string
|
||||
is_superuser?: boolean
|
||||
status?: number
|
||||
description?: string
|
||||
|
||||
Reference in New Issue
Block a user