// pages/mainPage/mainPage.js import ProApi from '../../net/api/projectApi'; const screenInfo = wx.getWindowInfo(); const statusBarHeight = screenInfo.statusBarHeight; // 状态栏高度 const app = getApp() Page({ /** * 页面的初始数据 */ data: { statusBarHeight: statusBarHeight, imgAssets: app.globalData.imgAssetsUrl, localImgAssets: app.globalData.localAssets, appTitle: app.globalData.appTitle, recommendList: [{ id: '1', content: '生成真实系统 | 可下载安装包' }, { id: '2', content: '提供材料撰写 | 提供一键导出' }, { id: '2', content: '不下证书就退款 | 免费补正也退款' }, { id: '2', content: '全托管包下证 | 也可自行申报' } ], docCount: 0, cerCount: 0, recommendDesc: '', shareTitle: '欢迎体验喵著' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getMainProCount() }, onShareAppMessage() { const promise = new Promise(resolve => { setTimeout(() => { resolve({ title: '欢迎体验喵著' }) }, 2000) }) return { title: '欢迎体验喵著', path: '/pages/mainPage/mainPage', imageUrl: this.data.imgAssets + '/wx_share_img.png', promise } }, //分享朋友圈 onShareTimeline() { return { title: this.data.shareTitle, query: 'from=timeline', imageUrl: this.data.imgAssets + '/wx_share_img.png' } }, getMainProCount() { ProApi.doGetMainProCount() .then(res => { this.setData({ recommendDesc: `${this.data.appTitle}网累计辅助编写资料 ${res.data[0]} 万套,通过平台代办下发证书 ${res.data[1]} 万件` }) }) .catch(err => { console.log(err) }) }, openLogin() { wx.navigateTo({ url: '/pages/login/login', }) } })