exhibitor-item.vue 3.4 KB

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