打包项目
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
import { requestDeleteJson, requestGetJson, requestPostJson, requestPutJson } from '@/shared/api/http'
|
||||
|
||||
export interface AdminUserItem {
|
||||
id: number
|
||||
username?: string
|
||||
role?: 'super_admin' | 'admin' | 'normal' | string
|
||||
creator_username?: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface AdminSimpleUser {
|
||||
id: number
|
||||
username: string
|
||||
}
|
||||
|
||||
export interface AdminUsersResponse {
|
||||
success: boolean
|
||||
current_user_role?: 'super_admin' | 'admin' | 'normal' | string
|
||||
admins?: AdminSimpleUser[]
|
||||
items?: AdminUserItem[]
|
||||
total?: number
|
||||
page?: number
|
||||
page_size?: number
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AdminMutationResponse {
|
||||
success: boolean
|
||||
msg?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AdminHistoryItem {
|
||||
id: number
|
||||
username?: string
|
||||
panel_type?: string
|
||||
created_at?: string
|
||||
long_image_url?: string | null
|
||||
result_urls?: string[]
|
||||
}
|
||||
|
||||
export interface AdminHistoryResponse {
|
||||
success: boolean
|
||||
items?: AdminHistoryItem[]
|
||||
total?: number
|
||||
page?: number
|
||||
page_size?: number
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AdminColumnPermissionItem {
|
||||
column_key?: string
|
||||
}
|
||||
|
||||
export interface AdminColumnPermissionResponse {
|
||||
success: boolean
|
||||
items?: AdminColumnPermissionItem[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
export function getAdminUsers(query = '') {
|
||||
const suffix = query ? `?${query}` : ''
|
||||
return requestGetJson<AdminUsersResponse>(`/api/admin/users${suffix}`)
|
||||
}
|
||||
|
||||
export function createAdminUser(payload: {
|
||||
username: string
|
||||
password: string
|
||||
role: string
|
||||
created_by_id?: number
|
||||
}) {
|
||||
return requestPostJson<AdminMutationResponse>('/api/admin/user', payload)
|
||||
}
|
||||
|
||||
export function updateAdminUser(
|
||||
userId: number | string,
|
||||
payload: {
|
||||
password?: string
|
||||
role?: string
|
||||
},
|
||||
) {
|
||||
return requestPutJson<AdminMutationResponse>(`/api/admin/user/${userId}`, payload)
|
||||
}
|
||||
|
||||
export function deleteAdminUser(userId: number | string) {
|
||||
return requestDeleteJson<AdminMutationResponse>(`/api/admin/user/${userId}`)
|
||||
}
|
||||
|
||||
export function getAdminHistory(query = '') {
|
||||
const suffix = query ? `?${query}` : ''
|
||||
return requestGetJson<AdminHistoryResponse>(`/api/admin/history${suffix}`)
|
||||
}
|
||||
|
||||
export function getUserColumnPermissions(userId: string | number) {
|
||||
return requestGetJson<AdminColumnPermissionResponse>(`/api/admin/user/${userId}/column-permissions`)
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import { requestGetJson, requestPostJson } from '@/shared/api/http'
|
||||
|
||||
export interface LoginResponse {
|
||||
success: boolean
|
||||
redirect?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AuthCheckResponse {
|
||||
logged_in: boolean
|
||||
redirect?: string
|
||||
}
|
||||
|
||||
export async function checkAuth() {
|
||||
return requestGetJson<AuthCheckResponse>('/api/auth/check')
|
||||
}
|
||||
|
||||
export async function login(username: string, password: string) {
|
||||
const formData = new FormData()
|
||||
formData.set('username', username)
|
||||
formData.set('password', password)
|
||||
|
||||
return requestPostJson<LoginResponse>('/login', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export async function logout() {
|
||||
try {
|
||||
await requestGetJson('/logout', {
|
||||
validateStatus: () => true,
|
||||
})
|
||||
} catch {
|
||||
// logout should still continue on the client even if backend responds abnormally
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
import { requestGetJson, requestPostJson } from '@/shared/api/http'
|
||||
|
||||
export interface UploadFileVo {
|
||||
fileKey: string
|
||||
originalFilename?: string
|
||||
localPath?: string
|
||||
size?: number
|
||||
}
|
||||
|
||||
export interface ConvertTemplateVo {
|
||||
id: number
|
||||
templateCode: string
|
||||
templateName: string
|
||||
outputFilename: string
|
||||
isDefault?: boolean
|
||||
builtIn?: boolean
|
||||
}
|
||||
|
||||
export interface UploadedSourceFileDto {
|
||||
fileKey: string
|
||||
originalFilename?: string
|
||||
}
|
||||
|
||||
export interface ConvertResultItemVo {
|
||||
resultId?: number
|
||||
sourceFilename?: string
|
||||
outputFilename?: string
|
||||
success: boolean
|
||||
error?: string
|
||||
downloadUrl?: string
|
||||
}
|
||||
|
||||
export interface ConvertRunVo {
|
||||
total: number
|
||||
successCount: number
|
||||
failedCount: number
|
||||
items: ConvertResultItemVo[]
|
||||
}
|
||||
|
||||
export interface StandardApiResponse<T> {
|
||||
success: boolean
|
||||
message?: string
|
||||
data?: T
|
||||
}
|
||||
|
||||
export function getConvertTemplates() {
|
||||
return requestGetJson<StandardApiResponse<ConvertTemplateVo[]>>('/api/convert/templates')
|
||||
}
|
||||
|
||||
export function uploadTempFile(file: File) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return requestPostJson<StandardApiResponse<UploadFileVo>, FormData>('/api/files/upload', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
})
|
||||
}
|
||||
|
||||
export function runConvert(files: UploadedSourceFileDto[], templateId: number) {
|
||||
return requestPostJson<StandardApiResponse<ConvertRunVo>>('/api/convert/run', {
|
||||
files,
|
||||
templateId,
|
||||
})
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { requestGetJson } from '@/shared/api/http'
|
||||
|
||||
export interface DedupeHistoryItem {
|
||||
sourceFilename?: string
|
||||
outputFilename?: string
|
||||
downloadUrl?: string
|
||||
success: boolean
|
||||
}
|
||||
|
||||
export interface DedupeHistoryVo {
|
||||
items: DedupeHistoryItem[]
|
||||
}
|
||||
|
||||
export interface StandardApiResponse<T> {
|
||||
success: boolean
|
||||
message?: string
|
||||
data?: T
|
||||
}
|
||||
|
||||
export function getDedupeHistory() {
|
||||
return requestGetJson<StandardApiResponse<DedupeHistoryVo>>('/api/dedupe/history')
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { requestGetJson, requestPostJson } from '@/shared/api/http'
|
||||
|
||||
export interface VersionResponse {
|
||||
version?: string
|
||||
has_update?: boolean
|
||||
latest_version?: string
|
||||
desc?: string
|
||||
file_url?: string
|
||||
}
|
||||
|
||||
export interface UpdateStartResponse {
|
||||
success: boolean
|
||||
error?: string
|
||||
}
|
||||
|
||||
export function fetchVersion() {
|
||||
return requestGetJson<VersionResponse>('/api/version')
|
||||
}
|
||||
|
||||
export function startUpdate(fileUrl: string) {
|
||||
return requestPostJson<UpdateStartResponse>('/api/update/do', { file_url: fileUrl })
|
||||
}
|
||||
Reference in New Issue
Block a user