exhibit-detail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. this.shareInfo = {
  151. title: this.exhibit.name,
  152. path: `/pages/exhibitor/exhibit-detail?id=` + this.id,
  153. imageUrl: this.exhibit.pic + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
  154. }
  155. }
  156. })
  157. },
  158. onShareAppMessage() {
  159. return this.shareInfo
  160. },
  161. onShareTimeline() {
  162. return this.shareInfo
  163. },
  164. onShare() {
  165. this.shareInfo = {
  166. title: this.exhibit.name,
  167. path: `/pages/exhibitor/exhibit-detail?id=` + this.id,
  168. imageUrl: this.exhibit.pic + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
  169. }
  170. this.showShare = true
  171. },
  172. getGlobalPollShow() {
  173. globalPollShow().then(res => {
  174. this.pollShow = res.data
  175. })
  176. },
  177. onCollect() { // 收藏
  178. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  179. return
  180. }
  181. exhibitorsProductCollect({id: this.id}).then(res => {
  182. if (res.code === 0) {
  183. this.exhibit.is_collect = this.exhibit.is_collect === 0 ? 1 : 0
  184. }
  185. })
  186. },
  187. onLike() { // 点赞
  188. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  189. return
  190. }
  191. exhibitorsProductLike({id: this.id}).then(res => {
  192. if (res.code === 0) {
  193. this.exhibit.is_like = this.exhibit.is_like === 0 ? 1 : 0
  194. }
  195. })
  196. },
  197. onPoll() { // 投票
  198. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  199. return
  200. }
  201. exhibitorsProductPoll({id: this.id}).then(res => {
  202. if (res.code === 0) {
  203. this.exhibit.is_poll = this.exhibit.is_poll === 0 ? 1 : 0
  204. if (this.exhibit.is_poll === 1) {
  205. this.exhibit.poll_count = this.exhibit.poll_count + 1
  206. } else {
  207. this.exhibit.poll_count = this.exhibit.poll_count - 1
  208. this.exhibit.poll_count = this.exhibit.poll_count < 0 ? 0 : this.exhibit.poll_count
  209. }
  210. }
  211. })
  212. }
  213. }
  214. }
  215. </script>
  216. <style lang="scss">
  217. @import "@/static/style/pages/exhibitor-detail.scss";
  218. .exhibit-detail {
  219. .exhibit-image {
  220. position: relative;
  221. height: 438rpx;
  222. background-color: #FFFFFF;
  223. border-radius: 5rpx;
  224. border: 1rpx solid #D6D6D6;
  225. .iconfont {
  226. position: absolute;
  227. right: 24rpx;
  228. top: 24rpx;
  229. font-size: $fontSize5;
  230. }
  231. .exhibit-tag {
  232. position: absolute;
  233. top: 28rpx;
  234. left: 29rpx;
  235. padding: 12rpx 22rpx;
  236. color: $textActionColor;
  237. font-size: $fontSize0;
  238. background-color: lighten($textActionColor, 43%);
  239. }
  240. }
  241. .exhibitor-detail-link {
  242. @include link-button;
  243. }
  244. .exhibit-name {
  245. margin-top: 28rpx;
  246. font-weight: bold;
  247. font-size: $fontSize6;
  248. color: #000000;
  249. line-height: 42rpx;
  250. }
  251. .exhibit-desc {
  252. //margin-top: 18rpx;
  253. font-size: $fontSize3;
  254. color: #333333;
  255. line-height: 1.5;
  256. }
  257. .exhibitor-info-list {
  258. display: flex;
  259. align-items: center;
  260. grid-gap: 24rpx;
  261. margin: 10rpx 0;
  262. justify-content: flex-end;
  263. //margin-top: 50rpx;
  264. .exhibitor-info-item {
  265. display: flex;
  266. align-items: center;
  267. grid-gap: 8rpx;
  268. font-size: $fontSize1;
  269. color: #555555;
  270. .iconfont {
  271. font-size: $fontSize2;
  272. }
  273. }
  274. }
  275. }
  276. </style>