wlcb-miniapp-syzl/pages/reportHandle/reportHandle.js
dong_bo0602 e330cfd092 all
2022-08-19 14:28:03 +08:00

111 lines
2.2 KiB
JavaScript

// pages/reportHandle/reportHandle.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
baseImgUrl: app.baseUrls.baseImgUrl,
reportUrl: app.baseUrls.appealReportUrl,
visitsId: '',
handleList: []
},
getList: function () {
var self = this
app.restAjax.get(app.restAjax.path(app.apis.reportHandle + self.data.visitsId, [app.baseUrls.appealReportUrl]), {}, {
headers: {
token: app.globalData.token
}
}, function (code, data) {
for (let i = 0; i < data.rows.length; i++) {
data.rows[i].handlePhoto = data.rows[i].handlePhoto.split(',')
if (data.rows[i].handlePhoto.length == 1 && data.rows[i].handlePhoto[0] == '') {
data.rows[i].handlePhoto = []
}
}
console.log(data)
self.setData({
handleList: data.rows
})
}, function (code, data) {
console.log(data)
})
},
previewImg: function (e) {
var urls = []
var cur = e.currentTarget.dataset.cur
var self = this
for (let i = 0; i < self.data.handleList[cur].handlePhoto.length; i++) {
var url = self.data.reportUrl + self.data.baseImgUrl + self.data.handleList[cur].handlePhoto[i]
urls.push(url)
}
wx.previewImage({
urls: urls,
})
},
checkDetail: function (e) {
wx.navigateTo({
url: '../reportHandleDetail/reportHandleDetail?visitsHandleId=' + e.currentTarget.dataset.handle,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
visitsId: options.visitsId
})
this.getList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})