data: {
location:"NONE", //发布地点
imageList: [], //图片名称
topicInfo:"", //话题
topicId: "", //话题ID
article:"", //正文
remind:"", //提醒谁看
phone:"", //手机号
token :"", // token
image_onlion_Path:["asdsadasd"],
},
uploadFile:function(){
var onlineImageList = [];
var that = this
// var cos = new COS({
// SecretId: 'AKIDW3Rgszw84ylQxMzNn7KOJ6kFPSL5c5MU',
// SecretKey: 'GQSMXmtsjR0QhuIalzTp250nU6digZSD',
// });
// 去后端获取一个临时密钥
var cos = newCOS({
getAuthorization: function (options, callback) {
// 服务端 JS 和 PHP 示例:https://github.com/tencentyun/cos-js-sdk-v5/blob/master/server/
// 服务端其他语言参考 COS STS SDK :https://github.com/tencentyun/qcloud-cos-sts-sdk
// STS 详细文档指引看:https://cloud.tencent.com/document/product/436/14048
wx.request({
url: 'http://127.0.0.1:8000/api/credential/
data: {
// 可从 options 取需要的参数
},
success: function (result) {
var data = result.data;
var credentials = data.credentials;
callback({
TmpSecretId: credentials.tmpSecretId,
TmpSecretKey: credentials.tmpSecretKey,
XCosSecurityToken: credentials.sessionToken,
ExpiredTime: data.expiredTime,
});
}
});
}
});
for (var index inthis.data.imageList) {
var filePath = this.data.imageList[index];
// var filename = filePath.split(".")[2]
cos.postObject({
Bucket: '桶的名字+id'
Region: 'ap-beijing'
Key: index + ".png"
FilePath: filePath,
onProgress: function (info) {
console.log('进度条', JSON.stringify(info));
}
},
function (err, data, url) {
onlineImageList.push(data.Location);
that.setData({
image_onlion_Path: that.data.image_onlion_Path.concat(data.Location),
})
}
);
this.data.imageList[index] = index + ".png"
}
console.log(this.data)
wx.request({
url: 'http://127.0.0.1:8000/app01/note/
data: { data: that.data },
method: 'post'
success: function (res) {
console.log(res);
}
})
wx.request向后端发送的数据丢失
在python中打印出来的数据丢了,各位大佬,麻烦看看哪里出错了,谢谢