import httpRequest from '@/request/index'
// import { getCookieToken, getCookieCode } from '@/utils/auth'

// 上传方法  folder objType objKey file bucketName
export function uploadOn(folder, objType, objKey, file, bucketName, onUploadProgress) {
  const params = new FormData()
  params.append('folder', folder)
  params.append('objType', objType)
  params.append('objKey', objKey)
  params.append('file', file)
  params.append('docPath', "/user/sss")
  params.append('bucketName', bucketName)
  return httpRequest({
    url: 'f-center/dm/dmDoc/saveA',
    method: 'POST',
    headers: {
      'Blade-Auth': window.localStorage.getItem('token'),
      'code': window.localStorage.getItem('code'),
      'Content-Type': 'multipart/form-data'
    },
    data: params,
    onUploadProgress
  })
}

// 文件删除 todo
// 删除数据
export function del(docPath) {
  return httpRequest({
    url: process.env.VUE_APP_BASE_IMS_EXT + 'f-center/dm/dmDoc/remove?docPath=' + docPath,
    method: 'GET'
  })
}