// pages/zhwj/zhwj.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { wjgk: './../../images/wjgk.jpg', qiyefuwu: app.globalData.imgUrl + '/images/qiyefuwu.png', dongtai1_1: app.globalData.imgUrl + '/image/dongtai1-1.jpg', dongtai2_1: app.globalData.imgUrl + '/image/dongtai2-1.jpg', dongtai3_1: app.globalData.imgUrl + '/image/dongtai3-1.jpg', iconList: [{ icon: 'cardboardfill', color: 'red', badge: 120, name: 'VR' }, { icon: 'recordfill', color: 'orange', badge: 1, name: '录像' }, { icon: 'picfill', color: 'yellow', badge: 0, name: '图像' }, { icon: 'noticefill', color: 'olive', badge: 22, name: '通知' }, { icon: 'upstagefill', color: 'cyan', badge: 0, name: '排行榜' }, { icon: 'clothesfill', color: 'blue', badge: 0, name: '皮肤' }, { icon: 'discoverfill', color: 'purple', badge: 0, name: '发现' }, { icon: 'questionfill', color: 'mauve', badge: 0, name: '帮助' }, { icon: 'commandfill', color: 'purple', badge: 0, name: '问答' }, { icon: 'brandfill', color: 'mauve', badge: 0, name: '版权' }], dataSet: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this; wx.showLoading(); wx.request({ url: app.globalData.url + '/api/question/publicMsgQuery', data: { page: 1, size: 1000, flag: '主动预防', }, success: function (res) { wx.hideLoading(); console.log('res', res); if (res.data.code == 0) { let content = res.data.data.result.content.map(({ createTime, ...i }) => ({ ...i, createTime: app.formatDate(createTime), })); console.log(content) that.setData({ dataSet: content }) } else { wx.showToast({ title: res.data.msg, }) } } }) }, // 跳转 linkFunction: function (event) { var str = event.currentTarget.dataset['str']; var id = event.currentTarget.dataset['id']; wx.navigateTo({ url: '../' + str + '/' + str + '?id=' + id }) }, })