exhibit-detail.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <page-layout class="exhibit-detail exhibitor-detail" v-if="exhibit && exhibit.name">
  3. <nav-bar title="展品介绍" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view>
  5. <view class="main-container">
  6. <view class="exhibit-image" @click="onClickAlbum(exhibit.pic)">
  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 class="iconfont icon-Search"></view>
  10. </view>
  11. <view class="exhibit-name">{{ exhibit.name }}</view>
  12. <view class="exhibitor-info-list">
  13. <view class="exhibitor-info-item">
  14. <view class="iconfont icon-View"></view>浏览:{{ exhibit.pv }}
  15. </view>
  16. <view class="exhibitor-info-item" v-if="pollShow.product_poll_show">
  17. <view class="iconfont icon-xiaochengxu-renqiicon"></view>
  18. <view>人气:{{ exhibit.poll_count }}</view>
  19. </view>
  20. </view>
  21. <view class="exhibit-desc">{{ exhibit.summary }}</view>
  22. <view class="exhibit-tags exhibitor-tags">
  23. <view class="exhibitor-tags-category">产品分类:</view>
  24. <view class="exhibitor-tags-list">
  25. <view v-for="(item) in exhibit.product_cate_names" class="exhibitor-tag">{{ item }}</view>
  26. </view>
  27. </view>
  28. <view class="exhibit-tags exhibitor-tags">
  29. <view class="exhibitor-tags-category">应用领域:</view>
  30. <view class="exhibitor-tags-list">
  31. <view v-for="(item) in exhibit.application_areas_names" class="exhibitor-tag">{{ item }}</view>
  32. </view>
  33. </view>
  34. <exhibitor-card :exhibit="exhibit"></exhibitor-card>
  35. <disclaimer-text></disclaimer-text>
  36. <view class="exhibit-operation exhibitor-operation">
  37. <view class="exhibitor-action">
  38. <view @click.stop="onShare()">
  39. <view class="iconfont icon-zhuanfa"></view>
  40. <view>分享</view>
  41. </view>
  42. <view @click="onCollect()">
  43. <view v-if="exhibit.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
  44. <view v-else class="iconfont icon-Favourites-Add-Large"></view>
  45. <view>收藏</view>
  46. </view>
  47. <view @click="onLike()">
  48. <view v-if="exhibit.is_like" class="iconfont icon-aixin active"></view>
  49. <view v-else class="iconfont icon-heart1"></view>
  50. <view>点赞</view>
  51. </view>
  52. <view v-if="pollShow.product_poll_show" @click="onPoll()">
  53. <view v-if="exhibit.is_poll" class="iconfont icon-Ticket1 active"></view>
  54. <view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
  55. <view>投票</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </u-scroll-view>
  61. <float-button></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. }
  125. },
  126. onLoad(options) {
  127. this.id = options.id
  128. this.getProductInfo()
  129. },
  130. created() {
  131. this.getGlobalPollShow()
  132. uni.$on('refreshData', (val) => {
  133. if (val === 'pages/exhibitor/exhibit-detail') {
  134. this.getProductInfo()
  135. }
  136. })
  137. },
  138. methods: {
  139. onClickAlbum(url) {
  140. const pics = [url]
  141. uni.previewImage({
  142. current: 0,
  143. urls: pics
  144. })
  145. },
  146. getProductInfo() {
  147. exhibitorsProductInfo({id: this.id}).then(res => {
  148. if (res.code === 0) {
  149. this.exhibit = res.data
  150. }
  151. })
  152. },
  153. onShareAppMessage() {
  154. return this.shareInfo
  155. },
  156. onShare() {
  157. this.shareInfo = {
  158. title: this.exhibit.name,
  159. path: `/pages/exhibitor/exhibit-detail?id=` + this.id,
  160. imageUrl: this.exhibit.pic + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
  161. }
  162. this.showShare = true
  163. },
  164. getGlobalPollShow() {
  165. globalPollShow().then(res => {
  166. this.pollShow = res.data
  167. })
  168. },
  169. onCollect() { // 收藏
  170. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  171. return
  172. }
  173. exhibitorsProductCollect({id: this.id}).then(res => {
  174. if (res.code === 0) {
  175. this.exhibit.is_collect = this.exhibit.is_collect === 0 ? 1 : 0
  176. }
  177. })
  178. },
  179. onLike() { // 点赞
  180. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  181. return
  182. }
  183. exhibitorsProductLike({id: this.id}).then(res => {
  184. if (res.code === 0) {
  185. this.exhibit.is_like = this.exhibit.is_like === 0 ? 1 : 0
  186. }
  187. })
  188. },
  189. onPoll() { // 投票
  190. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  191. return
  192. }
  193. exhibitorsProductPoll({id: this.id}).then(res => {
  194. if (res.code === 0) {
  195. this.exhibit.is_poll = this.exhibit.is_poll === 0 ? 1 : 0
  196. if (this.exhibit.is_poll === 1) {
  197. this.exhibit.poll_count = this.exhibit.poll_count + 1
  198. } else {
  199. this.exhibit.poll_count = this.exhibit.poll_count - 1
  200. this.exhibit.poll_count = this.exhibit.poll_count < 0 ? 0 : this.exhibit.poll_count
  201. }
  202. }
  203. })
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang="scss">
  209. @import "@/static/style/pages/exhibitor-detail.scss";
  210. .exhibit-detail {
  211. .exhibit-image {
  212. position: relative;
  213. height: 438rpx;
  214. background-color: #FFFFFF;
  215. border-radius: 5rpx;
  216. border: 1rpx solid #D6D6D6;
  217. .iconfont {
  218. position: absolute;
  219. right: 24rpx;
  220. top: 24rpx;
  221. font-size: $fontSize5;
  222. }
  223. .exhibit-tag {
  224. position: absolute;
  225. top: 28rpx;
  226. left: 29rpx;
  227. padding: 12rpx 22rpx;
  228. color: $textActionColor;
  229. font-size: $fontSize0;
  230. background-color: lighten($textActionColor, 43%);
  231. }
  232. }
  233. .exhibitor-detail-link {
  234. @include link-button;
  235. }
  236. .exhibit-name {
  237. margin-top: 28rpx;
  238. font-weight: bold;
  239. font-size: $fontSize6;
  240. color: #000000;
  241. line-height: 42rpx;
  242. }
  243. .exhibit-desc {
  244. //margin-top: 18rpx;
  245. font-size: $fontSize3;
  246. color: #333333;
  247. line-height: 1.5;
  248. }
  249. .exhibitor-info-list {
  250. display: flex;
  251. align-items: center;
  252. grid-gap: 24rpx;
  253. margin: 10rpx 0;
  254. justify-content: flex-end;
  255. //margin-top: 50rpx;
  256. .exhibitor-info-item {
  257. display: flex;
  258. align-items: center;
  259. //grid-gap: 12rpx;
  260. font-size: $fontSize1;
  261. color: #555555;
  262. .iconfont {
  263. font-size: $fontSize2;
  264. }
  265. }
  266. }
  267. }
  268. </style>