var app = getApp(); var that; var AParse = require('../../../Component/aParse/aParse.js'); Page({ data: { obj: {}, id: '', }, onShareAppMessage() { return { title: '公告', desc:'公告:'+ this.data.obj.name ? this.data.obj.name : '公告内容', path: 'pages/workbench/noticeDetail/noticeDetail?id=' + this.data.id }; }, onLoad(e) { that = this; dd.setNavigationBar({ title: "公告内容" }); if (e.id) { // this.getList(e.id); this.setData({ id: e.id }) } }, onShow() { if (app.globalData.userData) { dd.hideLoading(); that.getList(that.data.id); } else { app.login(app.globalData.corpId, function (is) { if (is) { dd.hideLoading(); that.getList(that.data.id); } else { dd.reLaunch({ url: '../../noJurisdiction/noJurisdiction' }) } }, function () { }) } }, getList(id) { /** * 使用说明: * AParse.AParse(bindName , type, data, target,imagePadding) * 1.bindName绑定的数据名(必填) * 2.type可以为html或者md(必填) * 3.data为传入的具体数据(必填) * 4.target为Page对象,一般为this(必填) * 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选) */ app.$get("api/information/info", { id: id }).then((res) => { AParse.aParse('article', 'html', `${res.data.data.content.html}` , that, 5); this.setData({ obj: res.data.data }) }) }, });