1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import {miniProgramConfig} from '../../api/other';
- const app = getApp();
- Page({
- data: {
- banners: [],
- introduction:'',
- start_time:'',
- end_time:''
- },
- async onLoad(){
- const res = await miniProgramConfig();
- app.globalData.programConfig = res.data;
- this.setData({
- banners:res.data.carousels,
- introduction:res.data.marathon_event.introduction,
- start_time:res.data.marathon_event.start_time,
- end_time:res.data.marathon_event.end_time
- })
- },
- onShow() {
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- this.getTabBar().setData({
- selected: 0
- })
- }
- },
- goPage(e){
- const index = e.currentTarget.dataset.index;
- if(index == 0){
- wx.navigateTo({
- url: `/pages/rules/rules?type=${index}`
- })
- }else if(index == 1){
- wx.navigateTo({
- url: `/pages/rules/rules?type=${index}`
- })
- }
- },
- goRegister() {
- wx.navigateTo({
- url: '/pages/register/register'
- })
- },
- // 打开分享弹框
- onShowShare() {
- const tabbar = this.getTabBar && this.getTabBar()
- if (tabbar && tabbar.openShare) {
- tabbar.openShare()
- } else {
- console.log("没找到 tabbar 组件")
- }
- },
- onShareAppMessage() {
- return {
- path: '/pages/index/index',
- imageUrl: app.globalData.programConfig.share_img
- }
- },
- })
|