exhibitor-item.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. this.checkAuth('/pages/exhibitor/detail?id=' + this.item.id)
  67. exhibitorsCollect({ id: this.item.id }).then(res => {
  68. if (res.code === 0) {
  69. let is_collect = this.item.is_collect === 0 ? 1 : 0
  70. this.$emit('updateItemValue', {
  71. id: this.item.id,
  72. key: 'is_collect',
  73. value: is_collect
  74. })
  75. }
  76. })
  77. },
  78. onLike() { // 点赞
  79. this.checkAuth('/pages/exhibitor/detail?id=' + this.item.id)
  80. exhibitorsLike({ id: this.item.id }).then(res => {
  81. if (res.code === 0) {
  82. let is_like = this.item.is_like === 0 ? 1 : 0
  83. this.$emit('updateItemValue', {
  84. id: this.item.id,
  85. key: 'is_like',
  86. value: is_like
  87. })
  88. }
  89. })
  90. },
  91. onPoll() { // 投票
  92. this.checkAuth('/pages/exhibitor/detail?id=' + this.item.id)
  93. exhibitorsPoll({ id: this.item.id }).then(res => {
  94. if (res.code === 0) {
  95. let is_poll = this.item.is_poll === 0 ? 1 : 0
  96. this.$emit('updateItemValue', {
  97. id: this.item.id,
  98. key: 'is_poll',
  99. value: is_poll
  100. })
  101. }
  102. })
  103. },
  104. onShare(item) {
  105. const shareInfo = {
  106. title: item.name,
  107. path: `/pages/exhibitor/exhibit-detail?id=` + item.id,
  108. imageUrl: item.logo
  109. }
  110. this.$emit('share', {
  111. detail: shareInfo
  112. })
  113. },
  114. onClickExhibitor(id) {
  115. this.navigateTo('/pages/exhibitor/detail?id=' + id)
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss">
  121. </style>