feat: 适配5.x后端,重构前端架构
主要变更: 1. 重构API目录结构,采用模块化设计,适配5.x后端接口规范 2. 优化布局组件,提升用户界面体验 3. 增强国际化支持,完善多语言配置 4. 新增权限控制功能,支持前端路由权限管理 5. 优化认证流程,支持JWT认证机制 6. 新增中间件和插件,提升系统扩展性 7. 优化状态管理,采用更清晰的模块化设计 8. 新增搜索框、广告等组件,丰富页面功能 9. 更改包管理工具从npm到pnpm,提升依赖管理效率 10. 完善配置系统,支持多环境配置 适配5.x后端特性: - 采用新的API接口规范 - 支持JWT认证机制 - 适配后端权限控制体系 - 支持后端国际化接口 - 优化数据交互方式
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import request from '~/utils/request'
|
||||
import type { SiteConfig, AgreementType, SmsType } from './types'
|
||||
|
||||
/**
|
||||
* 按分组获取配置
|
||||
*/
|
||||
export function getConfigByGroup(groupCode: string, options?: {
|
||||
enabled_only?: boolean
|
||||
with_metadata?: boolean
|
||||
}) {
|
||||
return request.get(`/system/config/group/${groupCode}`, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* 按 code 获取配置
|
||||
*/
|
||||
export function getConfigByCode(code: string, options?: { group_code?: string}) {
|
||||
return request.get(`/system/config/code/${code}`, options)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取协议内容
|
||||
*/
|
||||
export function getAgreementContent(key: AgreementType): Promise<string> {
|
||||
return request.get(`/agreement/${key}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
*/
|
||||
export function sendSmsVerificationCode(data: {
|
||||
type: SmsType
|
||||
phone: string
|
||||
[key: string]: any
|
||||
}): Promise<boolean> {
|
||||
return request.post(`/sms/${data.type}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码图片
|
||||
*/
|
||||
export function getCaptchaImage() {
|
||||
return request.get('/captcha', { time: Date.now() }, {
|
||||
showSuccessMessage: false,
|
||||
returnFullResponse: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取远程图片
|
||||
*/
|
||||
export function fetchRemoteImage(data: { url: string }): Promise<string> {
|
||||
return request.post('/image/fetch', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Base64 格式图片
|
||||
*/
|
||||
export function fetchBase64Image(data: { url: string }): Promise<string> {
|
||||
return request.post('/image/base64', data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user