// pages/my/cleanReport/cleanReport.js var app = getApp() Page({ /** * 页面的初始数据 */ data: { imgArr:[ 'http://bpic.588ku.com/element_origin_min_pic/16/10/30/528aa13209e86d5d9839890967a6b9c1.jpg', 'http://bpic.588ku.com/element_origin_min_pic/16/10/30/54fcef525fa8f6037d180f3c26f3be65.jpg', 'http://bpic.588ku.com/element_origin_min_pic/16/10/30/62e3ca3a02dddb002eff00482078d194.jpg', 'http://bpic.588ku.com/element_origin_min_pic/16/10/31/c7167fcfb4ebcd12621c05b0c852e98e.jpg', 'http://bpic.588ku.com/element_origin_min_pic/16/10/31/c7167fcfb4ebcd12621c05b0c852e98e.jpg', 'http://bpic.588ku.com/element_origin_min_pic/16/10/31/c7167fcfb4ebcd12621c05b0c852e98e.jpg', ], id: '' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({id:options.id}) }, onShow(){ this.detail() }, detail() { var that = this; app.api.useApi(app.globalData.baseAppUrl + "api/CleaningReport", { order_id: that.data.id, }, "get").then(function (res) { if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading({ success: (res) => { }, }) }, 2000); } else { console.log(res.message.data); } }).catch(function (err) { console.log(222); }) }, previewImg(e){ console.log(e.currentTarget.dataset.src); let that = this; wx.previewImage({ current:e.currentTarget.dataset.src, //当前图片地址 urls: that.data.imgArr, //所有要预览的图片的地址集合 数组形式 }) } })