export default {
  // 发送房屋卡片
  sendVrMsg (house, room_id, toId, is_vr_invite) {
    let content = {
      house_name: house.title,
      image_url: house.detail_images[0],
      house_type: house.house_type,
      house_area: house.area,
      orientation: house.orientation,
      // price: `${(house.price/10000).toFixed(0)}万`,
      price: `${house.price}`,
      vr_link: is_vr_invite ? `${house.vrLink}${encodeURIComponent(`&room_id=${room_id}`)}` : '',
      house_id: house.house_id
    }
   
    return this.sendMsg({content, msgType: 'vr', toId})
  },
  // 发送文字
  sendTextMsg (content, toId) {
    return this.sendMsg({content, toId, msgType: 'text'})
  },
  sendMsg ({content, msgType, toId}) {
    let defaultContent = {
      fromId: getApp().globalData.userinfo.user_id,
      fromName: getApp().globalData.userinfo.phone,
      toId: toId,
      toName: 'xu',
      type: 'TYPE_ONE',
      msgType,
      content: content
    }
    return getApp().getIMHandler().newFriendSendMsg({content: defaultContent})
  }
}