|
@@ -45,6 +45,8 @@ Component({
|
|
|
initFirst: true,
|
|
|
deviceId: '',
|
|
|
describe: "",
|
|
|
+ postFaultListImg: [],
|
|
|
+ postImg: [],
|
|
|
//报修记录用到的参数
|
|
|
faultList: []
|
|
|
|
|
@@ -346,6 +348,41 @@ Component({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ //从本机相册获取图片
|
|
|
+ getFaultImg: function () {
|
|
|
+
|
|
|
+ let that = this;
|
|
|
+ wx.chooseImage({
|
|
|
+ count: 9, // 默认9
|
|
|
+ sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
+ sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
+ success: function (res) {
|
|
|
+ // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ postFaultListImg: that.data.postFaultListImg.concat(res.tempFilePaths)
|
|
|
+ })
|
|
|
+ res.tempFilePaths.forEach((item, index) => {
|
|
|
+ httpUtil.wxUploadFile(httpUtil.interfaces.uploadImageList, item, index.toString(), {
|
|
|
+ 'userId': httpUtil.httpData.userId,
|
|
|
+ 'deviceId': that.data.deviceId
|
|
|
+ }).then((res: any) => {
|
|
|
+ //拿不到data
|
|
|
+ console.log("上传图片成功:", res)
|
|
|
+ console.log("上传图片成功:", res.data)
|
|
|
+ that.setData({
|
|
|
+ postImg: that.data.postImg.concat(res.data)
|
|
|
+ })
|
|
|
+ console.log(" that.data.postImg:", that.data.postImg)
|
|
|
+ }).catch((res => {
|
|
|
+ console.log("上传图片失败:", res)
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
//提交故障
|
|
|
submitFault: function (event: any) {
|
|
|
if (!this.data.deviceId) {
|
|
@@ -373,6 +410,15 @@ Component({
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ let img = '';
|
|
|
+ this.data.postImg.forEach((res, index) => {
|
|
|
+ if (index < this.data.postImg.length) {
|
|
|
+ img = img + res + ","
|
|
|
+ } else {
|
|
|
+ img = img + res
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
let params = {
|
|
|
city: this.data.cityValue,
|
|
|
classId: this.data.classId,
|
|
@@ -414,6 +460,8 @@ Component({
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
getFaultByUserId: function () {
|