//index.js
//获取应用实例
const app = getApp()

Page({
  onShow() {
    wx.setNavigationBarTitle({
      title: '活动详情'
    })
  },
  data: {
    UserInfo: app.globalData.UserInfo,
    ShowPopup: false,
    FormData: {
      Name: '',
      PhoneNum: '',
      IdCard: ''
    },
    SubmitOff: true,
    ActivityDetail: {
      Title: '示例标题',
      Publisher: '示例发布人',
      CreateDate: '2019-02-02',
      Content: '',
      CommentList: [{
        FloorUserIcon: '/assets/images/img1.jpg',
        FloorUserName: '楼主姓名',
        CreateDate: '2019-02-02 22:05',
        Content: '就看到杰卡斯大姐大就看到杰卡斯大姐大就看到杰卡斯大姐大就看到杰卡斯大姐大',
        ImgList: ['/assets/images/img1.jpg', '/assets/images/img2.jpg', '/assets/images/img5.jpg'],
        LikeNum: '0',
        Childs: [{
          Name: '回复人姓名',
          CreateDate: '2019-02-02 22:07',
          Content: 'us很大很大声',
          LikeNum: '15',
          ImgList: ['/assets/images/img1.jpg']
        }, {
          Name: '回复人姓名',
          CreateDate: '2019-02-02 22:07',
          Content: 'us很大很大声',
          LikeNum: '15',
          ImgList: []
        }]
      }, {
        FloorUserIcon: '/assets/images/img1.jpg',
        FloorUserName: '楼主姓名',
        CreateDate: '2019-02-02 22:05',
        Content: '就看到杰卡斯大姐大',
        ImgList: [],
        LikeNum: '0',
        Childs: [{
          Name: '回复人姓名',
          CreateDate: '2019-02-02 22:07',
          Content: 'us很大很大声',
          LikeNum: '15',
          ImgList: []
        }]
      }]
    }
  },
  AddComment() { // 添加评论
    wx.navigateTo({
      url: '/pages/ActivityDetail/comment?id='
    })
  },
  ShowSignUpPopup() { // 打开报名弹窗
    this.setData({
      ShowPopup: true
    })
  },
  ClosePopup() { // 关闭报名弹窗
    this.setData({
      ShowPopup: false,
      FormData: {
        Name: '',
        PhoneNum: '',
        IdCard: ''
      }
    })
  },
  FormInput(e) { // 输入form数据
    this.setData({
      FormData: {
        ...this.data.FormData,
        [e.target.dataset.name]: e.detail.value
      }
    })
  },
  Submit() { // 提交报名信息
    if (this.data.SubmitOff) {
      this.setData({
        SubmitOff: false
      })

    }
  }
})