地址案例:http://192.168.0.62:8082/admin/sys-file/load/school/7654
export function downLoadFile(fileId, filename) {
var fileurl = '/admin/sys-file/load/school/' + fileId
let token = sessionStorage.getItem('user_token')
// return uni.downloadFile({
return uni.request({
url: fileurl,
method: 'get',
responseType: 'blob',
header:{
'Authorization': 'Bearer ' + token,
'Content-Type': 'application/json;charset=UTF-8',
'Accept': 'application/json, text/plain, /',
},
}).then((response) => { // 处理返回的文件流
console.log(response)
const blob = response[1].tempFilePath
return blob//返回参数
})
}
返回的参数 乱码