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) { wx.setNavigationBarTitle({ title: '公告', //修改页面标题 }); 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 }) } }) }, })