export const apiDown = (url, data = {}) => {
let data2 = secretFilter(data)
axiosDown({
url,
params: data2,
method: 'get',
responseType: 'blob',
headers: {
'moudleId': 'rim',
// 'Content-Type': _contentType,
token: getToken() ? getToken() : ''
}
}).then(response => {
console.info('apiGet res', response)
if (response.data.type == 'application/octet-stream') {
let filename = ''
if (response.config.params.fileName) {
filename = decrypt2(response.config.params.fileName)
}
if (response.config.params.id) {
console.info('response.config.params.id', response.config.params.id)
filename = base64ToStr(response.config.params.id).split('_')[1]
}
const blob = new Blob([response.data])
var downloadElement = document.createElement('a')
var href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = filename
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
}
})
}