| | |
| | | // index.ts |
| | | |
| | | import { imageProps } from "miniprogram/miniprogram_npm/@vant/weapp/uploader/shared" |
| | | |
| | | // 获取应用实例 |
| | | const userDetail = getApp() |
| | | |
| | | Page({ |
| | | data: { |
| | | remarks: '', |
| | | reportDetail: {}, |
| | | isShow: false, |
| | | causeIndex: 0, |
| | | images:[] |
| | | images: [] |
| | | }, |
| | | |
| | | //查看图片 |
| | | face(){ |
| | | wx.previewMedia({ |
| | | sources:[{url:userDetail.globalData.imageUrl+"/img/"+this.data.reportDetail.pic}] |
| | | }) |
| | | }, |
| | | |
| | | //查看图片 |
| | | face() { |
| | | wx.previewMedia({ |
| | | sources: [{ url: userDetail.globalData.imageUrl + "/img/" + this.data.reportDetail.pic }] |
| | | }) |
| | | }, |
| | | |
| | | onLoad(e) { |
| | | wx.request( |
| | | { |
| | | url: userDetail.globalData.url+"/report/" + e.id, |
| | | url: userDetail.globalData.url + "/report/" + e.id, |
| | | method: "GET", |
| | | header: { 'token': wx.getStorageSync('token') }, |
| | | success: (res) => { |
| | | console.log(res) |
| | | if(res.data.data.reportMaterials!=null){ |
| | | this.setData({ |
| | | images:res.data.data.reportMaterials.split(",") |
| | | }) |
| | | let imgs = [] |
| | | if (res.data.data.idCardMaterials) { |
| | | imgs.push(...res.data.data.idCardMaterials.split(",")) |
| | | if (res.data.data.contractMaterials) { |
| | | imgs.push(...res.data.data.contractMaterials.split(",")) |
| | | if (res.data.data.transactionMaterials) { |
| | | imgs.push(...res.data.data.transactionMaterials.split(",")) |
| | | if (res.data.data.elseMaterials) { |
| | | imgs.push(...res.data.data.elseMaterials.split(",")) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.setData({ |
| | | images: imgs.map(i => userDetail.globalData.imageUrl + "/img/" + i) |
| | | }) |
| | | this.setData({ |
| | | reportDetail: res.data.data |
| | | }) |
| | | for (let index = 0; index < this.data.images.length; index++) { |
| | | if(this.data.images!=null&&this.data.images[index]!=""&&this.data.images!=undefined){ |
| | | this.data.images[index]=userDetail.globalData.imageUrl+"/img/"+this.data.images[index] |
| | | } else{ |
| | | this.data.images=[] |
| | | } |
| | | } |
| | | this.setData({ |
| | | images:this.data.images |
| | | remarks: res.data.data.remarks |
| | | }) |
| | | console.log(this.data.images); |
| | | |
| | | // for (let index = 0; index < this.data.images.length; index++) { |
| | | // if (this.data.images != null && this.data.images[index] != "" && this.data.images != undefined) { |
| | | // this.data.images[index] = userDetail.globalData.imageUrl + "/img/" + this.data.images[index] |
| | | // } |
| | | // } |
| | | // this.setData({ |
| | | // images: this.data.images |
| | | // }) |
| | | } |
| | | }) |
| | | |