3 回复
//删除图片
const delFile = new Promise((reslove, reject) => { //删除图片
//删除图片
wx.cloud.deleteFile({
fileList: [this.data.customer.fileId],
success: res => {
console.log("1/删除图片")
reslove(res)
},
fail: err => {
reject(err)
}
})
})
delFile.then(res => { //上传图片
//上传图片
let fileName = app.globalData.openid + Date.now() + '.png'
wx.cloud.uploadFile({
cloudPath: fileName,
filePath: this.data.showImg,
success: res => {
console.log("2/上传图片")
return Promise.resolve(res)
},
fail: err => {
return Promise.reject(err)
}
})
}).then(res => {
//保存信息
customerDb.add({
data: {
phone: this.data.customer.phone,
},
success: res => {
console.log('3/保存信息')
return Promise.resolve(res)
},
fial: err => {
console.log(err)
return Promise.reject(err)
}
})
}).then(res => {
this.showMsg('提交成功')
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
})
undefined 我重新发吧,感觉他自动把我代码删除了