2***@qq.com
2***@qq.com
  • 发布:2025-03-17 18:52
  • 更新:2025-03-18 10:59
  • 阅读:100

uni.uploadFile上传参数丢失

分类:uni-app

uni.uploadFile上传空字符串""的时候其他端后端都能获取空字符只有在苹果app端后端获取的是为none的,有没有大神遇到过一样的问题

2025-03-17 18:52 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com (作者)

就是参数中的para1后端获取到的是none
let formData={
"appid": appid,
"para1": '',
"unixtime": Date.parse(new Date()) / 1000,
"sign": this.EncryptDate(appid, appid + (Date.parse(new Date()) / 1000).toString() + ''),
}

const task = uni.uploadFile({
url: this.action,
filePath: this.lists[index].url,
name: this.name,
formData: formData,
header: this.header,
success: res => {
// 判断是否json字符串,将其转为json格式
let data = this.toJson && this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data;
if (![200, 201, 204].includes(res.statusCode)) {
this.uploadError(index, data);
} else {
// 上传成功
this.lists[index].response = data;
this.lists[index].progress = 100;
this.lists[index].error = false;
this.$emit('on-success', data, index, this.lists, this.index);
}
},
fail: e => {
this.uploadError(index, e);
},
complete: res => {
uni.hideLoading();
this.uploading = false;
this.uploadFile(index + 1);
this.$emit('on-change', res, index, this.lists, this.index);
}
});

要回复问题请先登录注册