import request from '@/utils/request'
// 文件上传
export function upload(data) {
    return request({
      url: '/common/upload',
      method: 'post',
      data: data
    })
  }

  // 文件查询
  export function openFiles(query) {
    return request({
      url: '/file-manager/open',
      method: 'get',
      params: query
    })
  }

  // 创建文件夹
  export function addFile(data) {
    return request({
      url: `/file-manager/create?path=${data.path}&dirName=${data.dirName}`,
      method: 'post',
      data
    })
  }

  // 修改文件夹或文件名称
  export function editFile(data) {
    return request({
      url: `/file-manager/rename?path=${data.path}&originName=${data.originName}&newName=${data.newName}`,
      method: 'post',
      data
    })
  }

   // 删除文件夹或文件名称
   export function delFile(data) {
    return request({
      url: `/file-manager/delete?path=${data.path}&name=${data.name}`,
      method: 'delete',
      data
    })
  }

  // 资源文件上传
export function managerUpload(data) {
  return request({
    url: '/file-manager/upload',
    method: 'post',
    data: data
  })
}