uni.uploadFile({
url: uni.getStorageSync('serviceUrl') + 'fixedPlacePatrol/add',
name: 'files',
fileType: "image",
files: [...this.userInfo.map((item, index) => ({
name: "" + index,
uri: item
})), ...this.checkInfo.map(item => item.imgList.map((img, index) => ({
name: item.id + "-" + index,
uri: img
}))).flat(2)],
formData: {
userId: uni.getStorageSync("USERBEAN").id,
placeId: this.id,
...(this.taskId ? {
taskId: this.taskId
} : {}),
placeName: this.name,
placeType: this.placeType,
checkUser: uni.getStorageSync("USERBEAN").name,
checkResult: JSON.stringify(this.checkInfo.map(item => ({
id: item.id,
inspection: item.inspection,
result: item.result
}))),
suggestion: this.remark,
startCheckTime: this.strtime,
inspection: this.slectCheckDirection
},
header: {
"Authorization": uni.getStorageSync('user_token'),
"content-type": "multipart/form-data"
},
method: 'POST',
success: (uploadFileRes) => {
uni.resInterceptor(uploadFileRes);
uni.hideLoading();
if (uploadFileRes.statusCode == 200) {
var res = JSON.parse(uploadFileRes.data);
if (res.code == 200) {
uni.showToast({
title: '成功',
duration: 2000,
complete:()=> {
setTimeout(() => {
uni.navigateBack({
delta: this.taskId ? 2 : 1
})
}, 1000)
}
})
_this.dateProceed(4)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
this.isEnd = false;
}
} else {
uni.showToast({
title: uploadFileRes.errMsg,
icon: 'none'
})
this.isEnd = false;
}
},
fail: (err) => {
uni.hideLoading();
uni.showToast({
title: '网络异常,请稍候再试',
icon: 'none'
})
this.isEnd = false;
},
complete: () => {
setTimeout(() => {
uni.hideLoading()
}, 1000)
}
})
3 个回复
7***@qq.com (作者)
问题定位到最新位置,是因为IPHONE X手机拍照后加了水印后上传提交无反应
DCloud_iOS_XHY
使用新版本测试i一下,问题是否解决?
明月洁无暇
兄弟,问题解决了嘛