import HouseApi from '../../apis/house'
const app = getApp();
const BASE = require('../../utils/basic');
Page({
  data: {
    agent_user: {},
    house_id: ''
  },
  ShureAppointment(e){
  },
  onShareAppMessage: function (res) {
    var path ='/pages/detail/detail?house=' + this.data.house_id;
    var arr = this.data.imglist;
    var imageurl = arr[0];
    return {
      title: this.data.house.title,
      path: path,
      imageUrl: imageurl, // 分享的封面图
      success: function(res) {
        app.ShowModel('恭喜', '转发成功~');
        // 转发成功
      },
      fail: function(res) {
        app.ShowModel('网络错误', '转发失败~');
        // 转发失败
      }
    }
  },
  onShow:function(e){
  },
  onLoad: function (options) {
    const house_id = options.house_id
    this.setData({
      house_id
    })
    this.getHouseAgent(house_id)
  },
  getHouseAgent (house_id) {
    HouseApi.getAgentByHouseId(house_id).then(res => {
      if (res.data && res.data[0]) {
        this.setData({
          agent_user: res.data[0]
        })
      }
    })
  }
});
