var uploadTask = wx.uploadFile({
url: upDatas.url || app.globalData.swtBase + 'upimg.php?act=main',
filePath: filePath,
name: 'fileUrl',
header: {
userToken: wx.getStorageSync('userToken') || '',
},
formData: upDatas,
success: function (res) {
var data = res.data ? JSON.parse(res.data) : {}
var code = data.code || 0
var msg = data.msg || ''
var picurl = data.picurl || ''
if (msg == 'REQUEST FAILED' || !msg) {
https_debug(that, upDatas, res.data)
}
if (code == 999) {
wx.navigateBack()
tokenAdmin(true)
return
}
if (res.statusCode != 200 || !res.data) {
msg = '图片上传失败,稍后再试'
}
if (!picurl) {
code = 0
msg += '第' + upImgsFinishCount + '张图片上传失败。'
https_debug(that, upDatas, { msg: `失败了:${res}` })
}
if (code != 200) {
if (upDatas.loading == 'customize') {
that.setData({
loading: false,
})
} else if (upDatas.loading !== false) {
wx.hideLoading()
}
wx.showModal({
title: '提示',
content: msg,
showCancel: false,
})
https_debug(that, upDatas, res)
return
}
var filePathEncode = filePath.replace(/[^0-9a-zA-Z]/g, '')
that.setData({
[`tempUploadFiles.${filePathEncode}`]: picurl,
[`formDatas.list[${i}].pic[${j}]`]: picurl,
})
if (upImgsCount <= upImgsFinishCount) {
if (upDatas.loading == 'customize') {
} else if (upDatas.loading !== false) {
wx.hideLoading()
}
if (callback !== null) callback(that)
} else {
if (tempPic.length <= j + 1) {
upDatas.i = i + 1
upDatas.j = 0
} else {
upDatas.i = i
upDatas.j = j + 1
}
_uploadImages(app, that, upDatas, callback)
}
},
fail: function (err) {
console.log(err)
wx.showModal({
title: '提示',
content: '服务端错误',
showCancel: false,
success: function () {
wx.navigateBack()
},
})
},
})
只有华为P70有问题吗,fail报什么