123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- // 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) {
- }
-
- })
|