imSend.js 1010 B

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