import { useLoading } from '../../behaviors/loading'; import { useOptions } from './options-proxy.js'; import { useInsepction } from './inspection-proxy.js'; import { useSupervision } from './supervision-proxy.js'; import { useNotice } from './notice-proxy.js'; import { useNews } from './news-proxy.js'; const app = getApp(); Page({ behaviors: [useLoading, useOptions, useInsepction, useSupervision, useNotice, useNews], data: { placeholder: '搜索企业详情', userName: app.globalData.userInfo.name, }, onLoad(options) { this.setData({ userName: app.globalData.userInfo.name }); }, onShow() { this.getTabBar().init(); this._fetchUnReadNoticeNum(); }, onPullDownRefresh() { this._startLoad(); }, onReachBottom() { this._loadMore(); }, /** * 初始加载 * 当所有筛选条件都获取到初始值后,执行一次初始化加载 * 包括场景类型、区域、时间三个选项,全部获取初始值后,执行加载 */ optionsCount: 0, init() { this.optionsCount++; if (this.optionsCount == 3) this._startLoad(); }, _fetchData(page) { const array = []; // 执法动态 const f3 = this._enforcementNews(page); array.push(f3); if (page == 1) { // 线上监管 this.fetchSupervision(page); // 现场巡查 this.fetchInspection(page); // 工作提醒 const f1 = this._fetchNotice(page); array.push(f1); const f4 = this._fetchUnReadNoticeNum(page); array.push(f4); // 守法培训 const f2 = this._complianceTraining(page); array.push(f2); } return Promise.all(array).then(res => { return res[0]; }); }, navToSearchPage() { wx.navigateTo({ url: '/pages/enterprise/search/index', success: result => {}, fail: res => {}, complete: res => {}, }); }, });