exhibit-item.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="exhibit-item exhibitor-item" hover-class="active" @click="onClickExhibit(item)">
  3. <view class="exhibit-body">
  4. <view class="exhibitor-body">
  5. <view class="exhibitor-logo"><image :src="item.pic + '?x-oss-process=image/resize,w_400'" mode="aspectFit" /></view>
  6. <view class="exhibitor-name">{{ item.name }}</view>
  7. <view class="exhibitor-number">
  8. <view class="exhibitor-number-label">展位号:</view>
  9. <view class="exhibitor-number-text">{{ item.hall_booth_no }}</view>
  10. </view>
  11. </view>
  12. <view class="exhibitor-name">
  13. <view class="exhibitor-name-cn">{{ item.exhibitors_name_zh_cn }}</view>
  14. <view class="exhibitor-name-en">{{ item.exhibitors_name_en_us }}</view>
  15. </view>
  16. </view>
  17. <view v-if="!footerHidden" class="exhibitor-footer">
  18. <view class="exhibitor-views">浏览:{{ item.pv }}</view>
  19. <view class="exhibitor-action">
  20. <view>
  21. <button @click.stop="onShare(item)" :plain="true">
  22. <view>
  23. <view class="iconfont icon-zhuanfa"></view>
  24. <view>分享</view>
  25. </view>
  26. </button>
  27. </view>
  28. <view @click.stop="onCollect()">
  29. <view v-if="item.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
  30. <view v-else class="iconfont icon-Favourites-Add-Large"></view>
  31. <view>收藏</view>
  32. </view>
  33. <view @click.stop="onLike()">
  34. <view v-if="item.is_like" class="iconfont icon-aixin active"></view>
  35. <view v-else class="iconfont icon-heart1"></view>
  36. <view>点赞</view>
  37. </view>
  38. <view v-if="pollShow" @click.stop="onPoll()">
  39. <view v-if="item.is_poll" class="iconfont icon-Ticket1 active"></view>
  40. <view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
  41. <view>投票</view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { exhibitorsProductCollect, exhibitorsProductLike, exhibitorsProductPoll } from '@/api/exhibitor'
  49. export default {
  50. options: {
  51. styleIsolation: 'shared'
  52. },
  53. components: {
  54. },
  55. props: {
  56. // 数据
  57. item: Object,
  58. footerHidden: Boolean,
  59. pollShow: Number
  60. },
  61. data() {
  62. return {
  63. }
  64. },
  65. created() {
  66. },
  67. methods: {
  68. onShare(item) {
  69. const shareInfo = {
  70. title: item.name,
  71. path: `/pages/exhibitor/exhibit-detail?id=` + item.id,
  72. imageUrl: item.pic + '?x-oss-process=image/resize,w_400'
  73. }
  74. this.$emit('share', {
  75. detail: shareInfo
  76. })
  77. },
  78. onClickExhibit(item) {
  79. this.navigateTo('/pages/exhibitor/exhibit-detail?id=' + item.id)
  80. },
  81. onCollect() { // 收藏
  82. if (!this.checkAuth('/pages/exhibitor/exhibit')) {
  83. return
  84. }
  85. exhibitorsProductCollect({ id: this.item.id }).then(res => {
  86. if (res.code === 0) {
  87. let is_collect = this.item.is_collect === 0 ? 1 : 0
  88. this.$emit('updateItemValue', {
  89. id: this.item.id,
  90. key: 'is_collect',
  91. value: is_collect
  92. })
  93. }
  94. })
  95. },
  96. onLike() { // 点赞
  97. if (!this.checkAuth('/pages/exhibitor/exhibit')) {
  98. return
  99. }
  100. exhibitorsProductLike({ id: this.item.id }).then(res => {
  101. if (res.code === 0) {
  102. let is_like = this.item.is_like === 0 ? 1 : 0
  103. this.$emit('updateItemValue', {
  104. id: this.item.id,
  105. key: 'is_like',
  106. value: is_like
  107. })
  108. }
  109. })
  110. },
  111. onPoll() { // 投票
  112. if (!this.checkAuth('/pages/exhibitor/exhibit')) {
  113. return
  114. }
  115. exhibitorsProductPoll({ id: this.item.id }).then(res => {
  116. if (res.code === 0) {
  117. let is_poll = this.item.is_poll === 0 ? 1 : 0
  118. this.$emit('updateItemValue', {
  119. id: this.item.id,
  120. key: 'is_poll',
  121. value: is_poll
  122. })
  123. }
  124. })
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss">
  130. </style>