uniapp的uni.uploader上传api在安卓端正常,ios不正常?
部分代码
var header = {
"sign": signMD5,
"Authorization": token,
"nonce": nocer,
"deviceId": systemInfo.deviceId,
"deviceName": systemInfo.model,
"deviceType": "2",
"appVersion": "1.0.0",
"timestamp": timestamp, // 时间:年月日时分秒
// "Content-Type": "multipart/form-data",
// "Content-Type": "application/json;charset=UTF-8"
}
// let addressInfo = uni.getStorageSync('locationInfo')
// let addressLoaction = addressInfo.address.province + addressInfo.address.city + addressInfo.address
// .district + addressInfo.address.street + addressInfo.address.streetNum
let uploadUrl = ""
if (this.openWatermark) {
uploadUrl = config.baseUrl + 'upload4base64'
} else {
uploadUrl = config.baseUrl + 'common/upload'
}
return new Promise((resolve, reject) => {
console.log(lists[i].thumb, 'lists');
let a = uni.uploadFile({
url: uploadUrl,
filePath: lists[i].thumb,
name: 'file',
formData: {
user: 'test',
address: '123',
lng: 112.23,
lat: 11.22,
// address: addressLoaction,
// lng: addressInfo.longitude,
// lat: addressInfo.latitude,
realname: this.userInfo.trueName,
file: lists[i].thumb
},
header: header,
success: (res => {
console.log(res);
setTimeout(() => {
var data = JSON.parse(res.data)
let item = this[`fileList${event.name}`][
fileListLen
]
this[`fileList${event.name}`].splice(fileListLen,
1,
Object.assign(item, {
status: 'success',
message: '',
url: data.url
}))
fileListLen++
this.dataForm.checkImgs = this.fileList3.map(
item =>
item.url).join(',')
resolve(data)
this.uploadFileLoading = false
}, 1000)
})
});
})
formData的参数在安卓上调用时,后端可以全部接收,而在ios上后端接收到的file参数为null
求大佬解答哦?