var WxParse = require('../../../wxParse/wxParse.js')
let app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    IMG_NAME: app.IMG_NAME
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let that = this
    that.setData({
      id: options.id
    })
  },
  onShow() {
    if (this.data.id) {
      this.getList()
    }
  },
  getList() {
    let that = this
    app.AjaxRequest('GET', {
        'content-type': 'application/json',
        'Authorization': 'Bearer ' + app.Getopenid()
      }, '/activity/signDetail', {
        id: that.data.id,
      },
      function (res) {
        if (res.code == 0) {
          that.setData({
            actBegin: res.data.actBegin.substring(0, res.data.actBegin.length - 3),
            actEnd: res.data.actEnd.substring(0, res.data.actEnd.length - 3),
            datas: res.data
          })
          if (res.data.content) {
            var article = res.data.content
            WxParse.wxParse('article', 'html', article, that)
          }
        }
      })
  },
  phoneCall() {
    wx.makePhoneCall({
      phoneNumber: JSON.stringify(this.data.datas.contract)
    })
  },
  regist() {
    wx.navigateTo({
      url: '../registration/registration?actId=' + this.data.datas.id,
    })
  }
})