业务交流通
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

listItem.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // components/listItem/listItem.js
  2. const app = getApp();
  3. const $request = require('../../utils/request.js');
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. // 数据
  10. item: {
  11. type: Object,
  12. },
  13. // index => 首页 detatil => 详情 homepage => 个人主页
  14. pageStatus: {
  15. type: String,
  16. value: 'index',
  17. },
  18. // 是否收藏
  19. isCollect: {
  20. type: Boolean,
  21. value: false,
  22. },
  23. // 是否显示收藏
  24. isShowCollect: {
  25. type: Boolean,
  26. value: false,
  27. },
  28. // 是否其他查看主页---用于是否显示聊一聊
  29. isOther: {
  30. type: Boolean,
  31. value: true,
  32. },
  33. // 类名
  34. listClass: {
  35. type: String,
  36. value: "",
  37. },
  38. customerId: {
  39. type: Number,
  40. value: null,
  41. },
  42. },
  43. /**
  44. * 组件的初始数据
  45. */
  46. data: {
  47. },
  48. /**
  49. * 组件的方法列表
  50. */
  51. methods: {
  52. getCustomerId() {
  53. return 123
  54. },
  55. // 进入详情
  56. goDetails(e) {
  57. if (this.data.listClass == 'disabled-model-view') {
  58. return
  59. }
  60. let value = e.currentTarget.dataset.value;
  61. this.triggerEvent('getItem', value);
  62. },
  63. // 进入个人主页
  64. goHomePage(e) {
  65. let customerid = e.currentTarget.dataset.customerid;
  66. wx.navigateTo({
  67. url: '/pages/index/components/homepage/homepage',
  68. success: function (res) {
  69. // 通过eventChannel向被打开页面传送数据
  70. res.eventChannel.emit('customerid', { customerid })
  71. }
  72. })
  73. },
  74. // 收藏
  75. productCollect(e) {
  76. this.triggerEvent('changeCollect');
  77. },
  78. // 聊一聊
  79. goToChat(e) {
  80. if (!app.globalData.customerId) {
  81. app.goLogin();
  82. return
  83. }
  84. let item = e.currentTarget.dataset.item;
  85. let businessCommunicationDemandId = item.businessCommunicationDemandId;
  86. $request.post('/statisticsBusinessCommunicationDemand/saveDemandCollect.action',
  87. { businessCommunicationDemandId }
  88. ).then(res => { }).catch(err => { console.log(err) })
  89. $request.post('/statisticsBusinessCommunicationDemand/demandPageView.action',
  90. { businessCommunicationDemandId, customerId: app.globalData.customerId }
  91. ).then(res => { }).catch(err => { console.log(err) })
  92. wx.navigateTo({
  93. url: "/pages/msgModule/wechat2/wechat2",
  94. success: function (res) {
  95. // 通过eventChannel向被打开页面传送数据
  96. res.eventChannel.emit('customerid', {
  97. customerid: item.customerId,
  98. businessCommunicationDemandId,
  99. chatHeads: item.chatHeads,
  100. info: item.info
  101. })
  102. }
  103. })
  104. },
  105. }
  106. })