import {
  iactivity
} from '../../../api/api.js'
const globalData = getApp().data

Page({
  data: {
    status: {
      ready: "即将开始",
      registering: '马上参加'
    },
    curStatus: false
  },

  clickBotbtn() {
    if (this.data.curStatus == 'registering') {
      wx.navigateTo({
        url: '../register/register?id=' + this.data.activity.id
      })
    }
  },
  onLoad(args) {
    iactivity.loadActivitydetails({
      event_id: args.id
    }, r => {
      this.setData({
        activity: r.info,
        curStatus: r.info.status_attend == '报名中' ? 'registering' : r.info.status_attend == '未开始' ? 'ready' : false
      })
    })

  }

})