var app = getApp() var WXAPI = require('../../utils/server.js'); Page({ data: { notice: [], radioindex: '', pro_id: 0, num: 0, flag: false, cartId: 0, numbers: "" }, // 下拉刷新 onPullDownRefresh: function () { wx.showNavigationBarLoading() //在标题栏中显示加载 this.DataonLoad(); // complete wx.hideNavigationBarLoading() //完成停止加载 wx.stopPullDownRefresh() //停止下拉刷新 }, onShow: function () { this.DataonLoad(); }, onLoad: function (options) { var that = this; WXAPI.messageList({ accessId: app.globalData.accessId, storeId: 239, storeType: 1, }).then(res => { if (res.code == 200) { var data = res.data var notice = data.message; if (notice == '') { var notice = [] } that.setData({ notice: notice }) } }) }, // 数据加载 DataonLoad: function () { var that = this; WXAPI.messageList({ accessId: app.globalData.accessId, storeId: 239, storeType: 1, }).then(res => { if (res.code == 200) { var data = res.data var notice = data.message; if (notice == '') { var notice = [] } that.setData({ notice: notice }) } }) }, navToIndex: function (e) { var item = e.currentTarget.dataset.item var index = e.currentTarget.dataset.index wx.navigateTo({ url: '/pages/notice/index?id=' + item.id+'&index='+index, }) } })