文档
测试

故障设备图片上传

POST
服务器地址:https://www.yeranwangluo.com/weChat_UserInfo/uploadImg.do 本机调试:http://localhost:8080/xingwang/weChat_UserInfo/uploadImg.do

请求参数

参数名
类型
描述
必填
file
MultipartFile
文件、图片...
必填
openid
String
微信用户身份标识
必填
productId
String
故障设备编号
必填

响应参数

参数名
类型
描述
必填
imgUrl
Sting
图片地址
可选
msg
String
提示消息
可选

说明 / 示例

wx.uploadFile({ url: app.globalData.wechatUser_urlPath + 'uploadImg.do', filePath: that.data.imgList[i], name: 'file', header: { 'content-type': 'multipart/form-data', }, formData: { 'openid': wx.getStorageSync('openid'), 'productId': that.data.productId }, success: function (res) { var jsonObj = JSON.parse(res.data); if (jsonObj.msg != '') { wx.hideLoading(); wx.showModal({ title: '温馨提示', content: jsonObj.msg, showCancel: false, confirmText: '返回主页', success(res) { if (res.confirm) { wx.redirectTo({ url: '../index/index' }) } } }) } else { images_list.push(jsonObj.imgUrl); console.log('转JSON字符前' + images_list); if (that.data.imgList.length == images_list.length) { var photo = JSON.stringify(images_list); console.log('转JSON字符后' + photo); wx.request({ url: app.globalData.wechatUser_urlPath + 'failureToReport.do', method: 'POST', header: { "Content-Type": "application/x-www-form-urlencoded" }, data: { openid: wx.getStorageSync('openid'), productId: that.data.productId, textareaBValue: that.data.textareaBValue, index: that.data.index, images: photo }, success(res) { wx.hideLoading(); wx.showModal({ title: '温馨提示', content: res.data.msg, showCancel: false, success(res){ if (res.confirm) { that.setData({ disabled: true }) } } }) } }) } } } })