index.ts 1.2 KB

1234567891011121314151617181920212223242526272829
  1. import request from '@/axios'
  2. import type { fileList } from './types'
  3. import { REQUEST_BASE } from '@/constants'
  4. export const getFileList = (params: fileList): Promise<IResponse> => {
  5. return request.get({ url: `${REQUEST_BASE}/file`, params })
  6. }
  7. export const getFileType = (params: fileList = {}): Promise<IResponse> => {
  8. return request.get({ url: `${REQUEST_BASE}/file/category`, params })
  9. }
  10. export const setFileType = (data: {
  11. pid?: string | number
  12. name: string
  13. file_type: number
  14. }): Promise<IResponse> => {
  15. return request.post({ url: `${REQUEST_BASE}/file/category`, data })
  16. }
  17. export const delFileType = (id: string | number): Promise<IResponse> => {
  18. return request.delete({ url: `${REQUEST_BASE}/file/category/${id}` })
  19. }
  20. export const upOnlineFile = (data: { pid: number; images: string }): Promise<IResponse> => {
  21. return request.post({ url: `${REQUEST_BASE}/file/online/upload`, data })
  22. }
  23. export const delFile = (data: { ids: string }): Promise<IResponse> => {
  24. return request.post({ url: `${REQUEST_BASE}/file/delete`, data })
  25. }
  26. export const updateFile = (data: { id: number; real_name: string }): Promise<IResponse> => {
  27. return request.put({ url: `${REQUEST_BASE}/update/${data.id}`, data })
  28. }