noticeDetail.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. var app = getApp();
  2. var that;
  3. var AParse = require('../../../Component/aParse/aParse.js');
  4. Page({
  5. data: {
  6. obj: {},
  7. id: '',
  8. },
  9. onShareAppMessage() {
  10. return {
  11. title: '公告',
  12. desc:'公告:'+ this.data.obj.name ? this.data.obj.name : '公告内容',
  13. path: 'pages/workbench/noticeDetail/noticeDetail?id=' + this.data.id
  14. };
  15. },
  16. onLoad(e) {
  17. that = this;
  18. dd.setNavigationBar({ title: "公告内容" });
  19. if (e.id) {
  20. // this.getList(e.id);
  21. this.setData({
  22. id: e.id
  23. })
  24. }
  25. },
  26. onShow() {
  27. if (app.globalData.userData) {
  28. dd.hideLoading();
  29. that.getList(that.data.id);
  30. } else {
  31. app.login(app.globalData.corpId, function (is) {
  32. if (is) {
  33. dd.hideLoading();
  34. that.getList(that.data.id);
  35. } else {
  36. dd.reLaunch({
  37. url: '../../noJurisdiction/noJurisdiction'
  38. })
  39. }
  40. }, function () { })
  41. }
  42. },
  43. getList(id) {
  44. /**
  45. * 使用说明:
  46. * AParse.AParse(bindName , type, data, target,imagePadding)
  47. * 1.bindName绑定的数据名(必填)
  48. * 2.type可以为html或者md(必填)
  49. * 3.data为传入的具体数据(必填)
  50. * 4.target为Page对象,一般为this(必填)
  51. * 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选)
  52. */
  53. app.$get("api/information/info", { id: id }).then((res) => {
  54. AParse.aParse('article', 'html',
  55. `${res.data.data.content.html}`
  56. , that, 5);
  57. this.setData({
  58. obj: res.data.data
  59. })
  60. })
  61. },
  62. });