var app = getApp() var WxParse = require('../../wxParse/wxParse.js'); var WXAPI = require('../../utils/server.js'); Page({ data: { notice: {}, radioindex: '', pro_id: 0, num: 0, flag: false, cartId: 0, numbers: "", bindData: {}, }, // 下拉刷新 onPullDownRefresh: function () { wx.showNavigationBarLoading() //在标题栏中显示加载 this.DataonLoad(); wx.hideNavigationBarLoading() //完成停止加载 wx.stopPullDownRefresh() //停止下拉刷新 }, onLoad: function (options) { var index = options.index 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[index]; var detail = data.message[index].content; WxParse.wxParse('detail', 'html', detail, that, 5);//处理规则的富文本框 if (notice == '') { var notice = {} } that.setData({ notice: notice }) } }) }, // 数据加载 DataonLoad: function () { var that = this; WXAPI.messageList({ }).then(res => { if (res.code == 200) { var data = res.data var notice = data.message; var detail = data.message[0].detail; WxParse.wxParse('detail', 'html', detail, that, 5);//处理规则的富文本框 if (notice == '') { var notice = [] } that.setData({ notice: notice }) } }) }, })