// pages/noticeDetail/noticeDetail.js import request from '../../utils/request' Page({ /** * 页面的初始数据 */ data: { noticeDetailList: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: async function (options) { // console.log(options.id); let id = options.id let result = await request('/front/notificationFront') //获取公告列表 // console.log(result); let noticeDetailList = this.data.noticeDetailList for (let i = 0; i < result.length; i++) { if (result[i].id == id) { noticeDetailList = result[i].iconList } } this.setData({ noticeDetailList }) // console.log(this.data.noticeDetailList); }, //点击预览图片 toPreviewImage() { let noticeDetailList = this.data.noticeDetailList var imgList = [] for(let j = 0;j < noticeDetailList.length;j++){ imgList[j] = noticeDetailList[j].icon } // console.log(imgList); wx.previewImage({ // current: imgList, // 当前显示图片的 http 链接 urls: imgList // 需要预览的图片 http 链接列表 }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })