整合前端仓库并保留提交历史
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)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 系统配置相关类型定义
|
||||
*/
|
||||
|
||||
/**
|
||||
* 配置项
|
||||
*/
|
||||
export interface ConfigItem {
|
||||
id: number
|
||||
group_code: string
|
||||
code: string
|
||||
name: string
|
||||
content: Record<string, any>
|
||||
is_sys: number
|
||||
enabled: number
|
||||
created_at: number
|
||||
updated_at: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点设置配置
|
||||
*/
|
||||
export interface SiteConfig {
|
||||
copyright: string
|
||||
icp: string
|
||||
icp_url: string
|
||||
network_security: string
|
||||
network_security_url: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 协议类型
|
||||
*/
|
||||
export type AgreementType = 'user' | 'privacy' | 'service'
|
||||
|
||||
/**
|
||||
* 短信/邮箱验证码类型
|
||||
*/
|
||||
export type SmsType = 'register' | 'login' | 'reset_password' | 'reset_password_email' | 'change_phone' | 'change_email'
|
||||
|
||||
Reference in New Issue
Block a user