cantact-user.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import ImSend from './../../utils/imSend'
  2. import { loginByUserInfo } from '../../utils/login'
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. agent_user: Object,
  9. house_id: String
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. },
  16. pageLifetimes: {
  17. show () {
  18. this.setData({
  19. loginStatus: getApp().globalData.token ? true : false
  20. })
  21. }
  22. },
  23. /**
  24. * 组件的方法列表
  25. */
  26. methods: {
  27. makePhone () {
  28. wx.makePhoneCall({
  29. phoneNumber: this.properties.agent_user.phone,
  30. })
  31. },
  32. toAgentDetail () {
  33. wx.navigateTo({
  34. url: `/pages/agent-detail/agent-detail?agency_id=${this.properties.agent_user.agency_user_id}`,
  35. })
  36. },
  37. senMsg () {
  38. ImSend.sendVrMsg(getApp().globalData.last_house, '', this.properties.agent_user.agency_user_id, false).then(res => {
  39. wx.navigateTo({
  40. url: `/pages/chat/chat?toId=${this.properties.agent_user.agency_user_id}&toName=${this.properties.agent_user.name}`,
  41. })
  42. })
  43. },
  44. bindgetuserinfo (e) {
  45. const { action } = e.currentTarget.dataset
  46. loginByUserInfo().then(res => {
  47. this.setData({
  48. loginStatus: getApp().globalData.token ? true : false
  49. })
  50. this[action] && this[action]()
  51. })
  52. }
  53. }
  54. })