noticeDetail.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // pages/noticeDetail/noticeDetail.js
  2. import request from '../../utils/request'
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. noticeDetailList: [], //公告列表
  9. notification:'' //公告描述
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: async function (options) {
  15. // console.log(options.id);
  16. let id = options.id
  17. let result = await request('/front/notificationFront') //获取公告列表
  18. console.log(result);
  19. let noticeDetailList = this.data.noticeDetailList
  20. let notification = this.data.notification
  21. for (let i = 0; i < result.length; i++) {
  22. if (result[i].id == id) {
  23. noticeDetailList = result[i].iconList
  24. notification = result[i].notification
  25. }
  26. }
  27. this.setData({
  28. noticeDetailList,
  29. notification
  30. })
  31. // console.log(this.data.noticeDetailList);
  32. },
  33. //点击预览图片
  34. toPreviewImage() {
  35. let noticeDetailList = this.data.noticeDetailList
  36. var imgList = []
  37. for(let j = 0;j < noticeDetailList.length;j++){
  38. imgList[j] = noticeDetailList[j].icon
  39. }
  40. // console.log(imgList);
  41. wx.previewImage({
  42. // current: imgList, // 当前显示图片的 http 链接
  43. urls: imgList // 需要预览的图片 http 链接列表
  44. })
  45. },
  46. /**
  47. * 生命周期函数--监听页面初次渲染完成
  48. */
  49. onReady() {
  50. },
  51. /**
  52. * 生命周期函数--监听页面显示
  53. */
  54. onShow() {
  55. },
  56. /**
  57. * 生命周期函数--监听页面隐藏
  58. */
  59. onHide() {
  60. },
  61. /**
  62. * 生命周期函数--监听页面卸载
  63. */
  64. onUnload() {
  65. },
  66. /**
  67. * 页面相关事件处理函数--监听用户下拉动作
  68. */
  69. onPullDownRefresh() {
  70. },
  71. /**
  72. * 页面上拉触底事件的处理函数
  73. */
  74. onReachBottom() {
  75. },
  76. /**
  77. * 用户点击右上角分享
  78. */
  79. onShareAppMessage() {
  80. }
  81. })