exhibit-detail.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <page-layout class="exhibit-detail exhibitor-detail">
  3. <nav-bar title="展品介绍" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view>
  5. <view class="main-container">
  6. <view class="exhibit-image">
  7. <image :src="exhibit.pic + '?x-oss-process=image/resize,w_800'" mode="aspectFit"/>
  8. <view v-for="(item) in exhibit.product_attr_names" class="exhibit-tag">{{ item }}</view>
  9. </view>
  10. <view class="exhibit-name">{{ exhibit.name }}</view>
  11. <view class="exhibit-desc">{{ exhibit.summary }}</view>
  12. <view class="exhibit-tags exhibitor-tags">
  13. <view class="exhibitor-tags-category">产品分类:</view>
  14. <view class="exhibitor-tags-list">
  15. <view v-for="(item) in exhibit.product_cate_names" class="exhibitor-tag">{{ item }}</view>
  16. </view>
  17. </view>
  18. <view class="exhibit-tags exhibitor-tags">
  19. <view class="exhibitor-tags-category">应用领域:</view>
  20. <view class="exhibitor-tags-list">
  21. <view v-for="(item) in exhibit.application_areas_names" class="exhibitor-tag">{{ item }}</view>
  22. </view>
  23. </view>
  24. <view class="exhibit-operation exhibitor-operation">
  25. <view class="exhibitor-views">浏览:{{ exhibit.pv }}</view>
  26. <view class="exhibitor-action">
  27. <view v-if="pollShow.product_poll_show">
  28. <view class="iconfont icon-xiaochengxu-renqiicon"></view>
  29. <view>人气:{{ exhibit.poll_count }}</view>
  30. </view>
  31. <view>
  32. <button :plain="true" @click.stop="onShare">
  33. <view>
  34. <view class="iconfont icon-zhuanfa"></view>
  35. <view>分享</view>
  36. </view>
  37. </button>
  38. </view>
  39. <view @click="onCollect()">
  40. <view v-if="exhibit.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
  41. <view v-else class="iconfont icon-Favourites-Add-Large"></view>
  42. <view>收藏</view>
  43. </view>
  44. <view @click="onLike()">
  45. <view v-if="exhibit.is_like" class="iconfont icon-aixin active"></view>
  46. <view v-else class="iconfont icon-heart1"></view>
  47. <view>点赞</view>
  48. </view>
  49. <view v-if="pollShow.product_poll_show" @click="onPoll()">
  50. <view v-if="exhibit.is_poll" class="iconfont icon-Ticket1 active"></view>
  51. <view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
  52. <view>投票</view>
  53. </view>
  54. </view>
  55. </view>
  56. <exhibitor-card :exhibit="exhibit"></exhibitor-card>
  57. <disclaimer-text></disclaimer-text>
  58. </view>
  59. </u-scroll-view>
  60. <contact-us :show.sync="showContactUs" :qrcode_url="q_url" />
  61. <float-button @custom-event="updateContactStatus()"></float-button>
  62. <van-dialog id="van-dialog" />
  63. <u-share-action-sheet :show.sync="showShare" :show-info="shareInfo"/>
  64. </page-layout>
  65. </template>
  66. <script>
  67. import NavBar from '@/components/layout/nav-bar'
  68. import UScrollView from '@/components/common/u-scroll-view'
  69. import UShareActionSheet from '@/components/common/u-share-action-sheet'
  70. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  71. import floatButton from "@/components/layout/float-button"
  72. import ContactUs from '@/pages/index/components/contact-us.vue'
  73. import {
  74. exhibitorsProductInfo,
  75. globalPollShow,
  76. exhibitorsProductCollect,
  77. exhibitorsProductLike,
  78. exhibitorsProductPoll
  79. } from '@/api/exhibitor'
  80. import exhibitorCard from "@/pages/exhibitor/components/exhibitor-card";
  81. import PageLayout from "@/components/layout/page-layout";
  82. export default {
  83. options: {
  84. styleIsolation: 'shared'
  85. },
  86. components: {
  87. PageLayout,
  88. NavBar,
  89. UScrollView,
  90. UShareActionSheet,
  91. DisclaimerText,
  92. exhibitorCard,
  93. floatButton,
  94. ContactUs
  95. },
  96. computed: {},
  97. data() {
  98. return {
  99. showShare: false,
  100. shareInfo: null,
  101. exhibit: {
  102. is_collect: 0,
  103. is_like: 0,
  104. is_poll: 0,
  105. name: '',
  106. summary: '',
  107. product_cate_names: [],
  108. application_areas_names: [],
  109. product_attr_names: [],
  110. pic: '',
  111. poll_count: 0,
  112. pv: 0,
  113. exhibitors_logo: '',
  114. exhibitors_name_zh_cn: '',
  115. exhibitors_name_en_us: '',
  116. exhibitors_hall: '',
  117. exhibitors_booth_no: ''
  118. },
  119. id: 0,
  120. pollShow: {
  121. exhibitors_poll_show: 0,
  122. product_poll_show: 0
  123. },
  124. showContactUs: false,
  125. q_url: ''
  126. }
  127. },
  128. onLoad(options) {
  129. this.id = options.id
  130. this.getProductInfo()
  131. },
  132. created() {
  133. this.loadFontFace('Poppins')
  134. this.getGlobalPollShow()
  135. },
  136. methods: {
  137. getProductInfo() {
  138. exhibitorsProductInfo({id: this.id}).then(res => {
  139. if (res.code === 0) {
  140. this.exhibit = res.data
  141. }
  142. })
  143. },
  144. onShareAppMessage() {
  145. return this.shareInfo
  146. },
  147. onShare() {
  148. this.shareInfo = {
  149. title: this.exhibit.name,
  150. path: `/pages/exhibitor/exhibit-detail?id=` + this.id,
  151. imageUrl: this.exhibit.pic + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
  152. }
  153. this.showShare = true
  154. },
  155. getGlobalPollShow() {
  156. globalPollShow().then(res => {
  157. this.pollShow = res.data
  158. })
  159. },
  160. onCollect() { // 收藏
  161. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  162. return
  163. }
  164. exhibitorsProductCollect({id: this.id}).then(res => {
  165. if (res.code === 0) {
  166. this.exhibit.is_collect = this.exhibit.is_collect === 0 ? 1 : 0
  167. }
  168. })
  169. },
  170. onLike() { // 点赞
  171. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  172. return
  173. }
  174. exhibitorsProductLike({id: this.id}).then(res => {
  175. if (res.code === 0) {
  176. this.exhibit.is_like = this.exhibit.is_like === 0 ? 1 : 0
  177. }
  178. })
  179. },
  180. onPoll() { // 投票
  181. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  182. return
  183. }
  184. exhibitorsProductPoll({id: this.id}).then(res => {
  185. if (res.code === 0) {
  186. this.exhibit.is_poll = this.exhibit.is_poll === 0 ? 1 : 0
  187. if (this.exhibit.is_poll === 1) {
  188. this.exhibit.poll_count = this.exhibit.poll_count + 1
  189. } else {
  190. this.exhibit.poll_count = this.exhibit.poll_count - 1
  191. this.exhibit.poll_count = this.exhibit.poll_count < 0 ? 0 : this.exhibit.poll_count
  192. }
  193. }
  194. })
  195. },
  196. updateContactStatus(data) {
  197. this.showContactUs = data.showContactUs
  198. this.q_url = data.q_url
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. @import "@/static/style/pages/exhibitor-detail.scss";
  205. .exhibit-detail {
  206. .exhibit-image {
  207. position: relative;
  208. height: 438rpx;
  209. background-color: #FFFFFF;
  210. border-radius: 5rpx;
  211. border: 1rpx solid #D6D6D6;
  212. .exhibit-tag {
  213. position: absolute;
  214. top: 28rpx;
  215. left: 29rpx;
  216. padding: 12rpx 22rpx;
  217. color: $textActionColor;
  218. font-size: $fontSize0;
  219. background-color: lighten($textActionColor, 43%);
  220. }
  221. }
  222. .exhibitor-detail-link {
  223. @include link-button;
  224. }
  225. .exhibit-name {
  226. margin-top: 28rpx;
  227. font-family: Poppins, Poppins;
  228. font-weight: bold;
  229. font-size: $fontSize6;
  230. color: #000000;
  231. line-height: 42rpx;
  232. }
  233. .exhibit-desc {
  234. margin-top: 18rpx;
  235. font-family: Poppins, Poppins;
  236. font-size: $fontSize2;
  237. color: #555555;
  238. line-height: 35rpx;
  239. }
  240. }
  241. </style>