// pages/duty/rec-detail/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { topBarH: app.globalData.CustomBar, freshIng: false, id: "", detail: {}, enclosurelist: [] }, /** * 下载文件 */ downFile: function (params) { const item = params.currentTarget.dataset.item; console.info(app.FILE_SERVER_URL + item.FilePath) wx.downloadFile({ url: app.FILE_SERVER_URL + item.FilePath, //仅为示例,并非真实的资源 success(res) { if (res.statusCode === 200) { wx.openDocument({ filePath: res.tempFilePath, }) } } }) }, /** * 获取附件 */ getFiles: function () { app.axios("GET", "common", "/upload/getFile", { OTCId: this.data.id, OTCType: app.FileType.resumptionAcs }).then(res => { if (res.code == 1) { this.data.enclosurelist = res.data; this.setData(this.data) } }) }, /** * 获取详情 */ getData: function (params) { app.axios("GET", "app", "/performDuties/getListdetail", { listdetailid: this.data.id }).then(res => { this.data.freshIng = false; if (res.code == 1) { this.data.detail = res.data this.getFiles(); } this.setData(this.data) }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { const eventChannel = this.getOpenerEventChannel() eventChannel.on('getItemId', (id) => { this.setData({ id }) this.getData(); }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })