feat: rbac接入完成,file接入完成
This commit is contained in:
+34
-3
@@ -1,9 +1,9 @@
|
||||
import { post } from '@/lib/request'
|
||||
import { USE_MOCK, delay, paginate, mockId } from '@/mock'
|
||||
import type { SystemOss } from '../system'
|
||||
import type { SystemOss, StorageConfig } from '../system'
|
||||
import type { PageResult } from '@/lib/request'
|
||||
|
||||
const BASE_URL = '/file/oss'
|
||||
const BASE_URL = '/file'
|
||||
|
||||
const mockFiles: SystemOss[] = [
|
||||
{ id: '1', name: 'avatar.jpg', key: 'avatars/1.jpg', url: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=800&q=80', suffix: 'jpg', createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() },
|
||||
@@ -17,7 +17,7 @@ export async function getFileList(params: { current: number; pageSize: number; k
|
||||
if (params.keyword) list = list.filter(f => f.name.includes(params.keyword!))
|
||||
return paginate(list, params.current, params.pageSize)
|
||||
}
|
||||
return post<PageResult<SystemOss>>(`${BASE_URL}/getFileList`, params)
|
||||
return post<PageResult<SystemOss>>(`${BASE_URL}/list`, params)
|
||||
}
|
||||
|
||||
export async function uploadFile(_file: File) {
|
||||
@@ -47,3 +47,34 @@ export async function deleteFile(ids: string[]) {
|
||||
}
|
||||
return post<null>(`${BASE_URL}/delete`, { ids })
|
||||
}
|
||||
|
||||
// ==================== Storage Config APIs ====================
|
||||
const CONFIG_URL = '/file/config'
|
||||
|
||||
export async function getStorageConfigList(params: { current: number; pageSize: number; type?: string; name?: string }) {
|
||||
if (USE_MOCK) {
|
||||
await delay()
|
||||
return paginate([], params.current, params.pageSize)
|
||||
}
|
||||
return post<PageResult<StorageConfig>>(`${CONFIG_URL}/list`, params)
|
||||
}
|
||||
|
||||
export async function createStorageConfig(data: Partial<StorageConfig>) {
|
||||
if (USE_MOCK) return delay()
|
||||
return post<null>(`${CONFIG_URL}/create`, data)
|
||||
}
|
||||
|
||||
export async function updateStorageConfig(data: Partial<StorageConfig>) {
|
||||
if (USE_MOCK) return delay()
|
||||
return post<null>(`${CONFIG_URL}/update`, data)
|
||||
}
|
||||
|
||||
export async function deleteStorageConfig(ids: string[]) {
|
||||
if (USE_MOCK) return delay()
|
||||
return post<null>(`${CONFIG_URL}/delete`, { ids })
|
||||
}
|
||||
|
||||
export async function setDefaultStorageConfig(id: string) {
|
||||
if (USE_MOCK) return delay()
|
||||
return post<null>(`${CONFIG_URL}/setDefault`, { id })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user