// index.js // 获取应用实例 import http from '../../base/httputil' const app = getApp() Page({ data: { host: app.globalData.host, current: 0, //当前所在页面的 index dofun: null, xunjianImgCount: '000,000', NoticeTitle: "登录查看公告", noticeItem: '', }, onReady() { }, onLoad() { }, onShow() { }, // 通知公告更多跳转 bindViewGengDuo() { if (app.globalToken == null) { wx.showToast({ title: '尚未登录,登录后即可使用', icon: 'none' }) return } wx.navigateTo({ url: '../notice/notice' }) }, initIndexPage() { if (app.globalToken == null || app.globalToken == '') { return } http.send_post("/system/AppIndexController/getIndexPageData", null, this.initIndexPageSuccess) }, initIndexPageSuccess(res) { if (res.code == 200) { this.setData({ xunjianImgCount: res.data.xunjianImgCount, }) if (res.data.noticeList.length > 0) { this.setData({ NoticeTitle: res.data.noticeList[0].noticeTitle, noticeItem: res.data.noticeList[0] }) } else { this.setData({ NoticeTitle: "暂无公告" }) } } }, goNoticeDetails(e) { let details = e.currentTarget.dataset.item if (app.globalToken == null) { wx.showToast({ title: '尚未登录,登录后即可使用', icon: 'none' }) return } if (details == null || details == '') { wx.showToast({ title: '暂无公告', icon: 'none' }) return } let competition = {}//这是一个很长的很多数据的对象 //转成String编码一下 competition = encodeURIComponent(JSON.stringify(details)) wx.navigateTo({  url:`../notice/notice_details?details=${competition}` })   }, onTabItemTap(item) { } })