// pages/duty/rec-detail/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { topBarH: app.globalData.CustomBar, baseUrl: app.FILE_SERVER_URL, freshIng: false, id: "", detail: {}, enclosurelist: [] }, /** * 预览文件 */ filePre: function (params) { const url = params.currentTarget.dataset.url; const imgs = []; this.data.enclosurelist.forEach(item => { imgs.push(this.data.baseUrl + item.filepath) }) wx.previewImage({ urls: imgs, current: this.data.baseUrl + url }) }, /** * 获取附件 */ getFiles: function () { app.axios("GET", "common", "/upload/getFile", { otcid: this.data.detail.workId, otctype: app.FileType.resumptionAcs }).then(res => { if (res.code == 1) { this.data.enclosurelist = res.data; this.setData(this.data) } }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { const eventChannel = this.getOpenerEventChannel() eventChannel.on('getItem', (item) => { this.data.detail = item; this.setData(this.data) this.getFiles(); }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })