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

  /**
   * 页面的初始数据
   */
  data: {
    IMG_NAME: app.IMG_NAME,
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 1000
  },

  //轮播高度自适应——获取图片高度
  imgHeight: function (e) {
    var winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度
    var imgh = e.detail.height; //图片高度
    var imgw = e.detail.width; //图片宽度
    var swiperH = winWid * imgh / imgw + "px"
    this.setData({
      Height: swiperH //设置高度
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this
    that.getList(options.id)
  },
  onShow() {},
  getList(id) {
    let that = this
    app.AjaxRequest('GET', {
        'content-type': 'application/json',
        'Authorization': 'Bearer ' + app.Getopenid()
      }, '/room/detail', {
        roomId: id,
      },
      function (res) {
        if (res.code == 0) {
          wx.setNavigationBarTitle({
            title: res.data.name,
          })
          that.setData({
            roomDetail: res.data
          })
        }
      })
  },
  phoneCall() {
    wx.makePhoneCall({
      phoneNumber: JSON.stringify(this.data.datas.contract)
    })
  },
  regist() {
    wx.navigateTo({
      url: '../apply/apply?id=' + this.data.roomDetail.id,
    })
  }
})