uploading1: function () {
var that = this
wx.chooseImage({
count: 3, // 默认9
sizeType: ['original','compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
let tempFilePaths = res.tempFilePaths
console.log(tempFilePaths,"打印第一次")
let myDate = new Date()
let ossPath = 'seekings/' + myDate.getFullYear()
console.log(ossPath,"osspath")
for (var i = 0; i < tempFilePaths.length; i++) {
// 获取文件后缀
var pathArr = tempFilePaths[i].split('.')
console.log(pathArr,"pathArr")
// 随机生成文件名称
var fileRandName = Date.now() + "" + parseInt(Math.random() * 1000)
console.log(fileRandName,'fileRandName')
var fileName = fileRandName + '.' + pathArr[3]
console.log(fileName,"fileName")
// 要提交的key
var fileKey = ossPath + '/' + fileName
console.log(fileKey,"fileKey")
wx.uploadFile({
// url: 'https://scrkscrk.com/cqz',
url:"http://oss-cn-beijing.aliyuncs.com/cqz",
filePath: tempFilePaths[i],
name: 'file',
formData: {
name: tempFilePaths[i],
key: fileKey,
policy: 'policyBase64',
OSSAccessKeyId: 'LT89w90ecV00j7',
signature: 'nPdwauIvUMkrML0tbC5mtm5HbYW',
success_action_status: "200"
},
success: function (res) {
var data = res.data
console.log(data,"12")
console.log(res)
}
})
}
that.setData({
upliadImages: res.tempFilePaths
})
}
})
},