imSend.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. export default {
  2. // 发送房屋卡片
  3. sendVrMsg (house, room_id, toId, is_vr_invite) {
  4. console.log(house, 'house')
  5. let content = {
  6. house_name: house.title,
  7. image_url: house.detail_images[0],
  8. house_type: house.house_type,
  9. house_area: house.area,
  10. orientation: house.orientation,
  11. price: `${(house.price/10000).toFixed(0)}万`,
  12. vr_link: is_vr_invite ? `${house.vrLink}${encodeURIComponent(`&room_id=${room_id}`)}` : '',
  13. house_id: house.house_id
  14. }
  15. return this.sendMsg({content, msgType: 'vr', toId})
  16. },
  17. // 发送文字
  18. sendTextMsg (content, toId) {
  19. return this.sendMsg({content, toId, msgType: 'text'})
  20. },
  21. sendMsg ({content, msgType, toId}) {
  22. let defaultContent = {
  23. fromId: getApp().globalData.userinfo.viewerId,
  24. fromName: getApp().globalData.userinfo.phone,
  25. toId: toId,
  26. toName: 'xu',
  27. type: 'TYPE_ONE',
  28. msgType,
  29. content: content
  30. }
  31. return getApp().getIMHandler().newFriendSendMsg({content: defaultContent})
  32. }
  33. }