const util = require('../../utils/util.js') Page({ data: { publisherId: '', publisherInfo: {}, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if (options.id) { this.setData({ publisherId: options.id }) wx.showLoading({ title: "加载中" }) wx.cloud.callFunction({ name: 'getPublisher', data: { pub_id: this.data.publisherId } }).then(res => { wx.hideLoading() if (res.result.status !== 'OK') { wx.showToast({ title: res.result.errMsg, icon: 'none' }) return } this.setData({ publisherInfo: res.result.data }) }) } else { const eventChannel = this.getOpenerEventChannel() eventChannel.on('loadCommonData', res => { this.setData({ publisherId: res.data._id, publisherInfo: res.data }) }) } } })