exhibit-detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view 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. <u-panel title="展商信息">
  57. <view class="exhibitor-card">
  58. <view class="exhibitor-info">
  59. <view class="exhibitor-logo">
  60. <image :src="exhibit.exhibitors_logo + '?x-oss-process=image/resize,w_400'" mode="widthFix" />
  61. </view>
  62. <view class="exhibitor-name-cn">{{ exhibit.exhibitors_name_zh_cn }}</view>
  63. <view class="exhibitor-name-en">{{ exhibit.exhibitors_name_en_us }}</view>
  64. <view class="exhibitor-detail-link">
  65. <van-button type="primary" @click="onClickDetail">
  66. <template>
  67. <view>点击了解展商更多信息</view> <view class="arrow iconfont icon-right-s"></view>
  68. </template>
  69. </van-button>
  70. </view>
  71. </view>
  72. <view class="exhibitor-number">
  73. <view class="exhibitor-number-label">我们的展位号</view>
  74. <view class="exhibitor-number-text">{{ exhibit.exhibitors_hall }}馆 {{ exhibit.exhibitors_booth_no }}</view>
  75. </view>
  76. </view>
  77. </u-panel>
  78. <disclaimer-text></disclaimer-text>
  79. </view>
  80. </u-scroll-view>
  81. <u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
  82. </view>
  83. </template>
  84. <script>
  85. import NavBar from '@/components/layout/nav-bar'
  86. import UScrollView from '@/components/common/u-scroll-view'
  87. import UShareActionSheet from '@/components/common/u-share-action-sheet'
  88. import UPanel from '@/components/common/u-panel'
  89. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  90. import { exhibitorsProductInfo, globalPollShow, exhibitorsProductCollect, exhibitorsProductLike, exhibitorsProductPoll } from '@/api/exhibitor'
  91. export default {
  92. options: {
  93. styleIsolation: 'shared'
  94. },
  95. components: {
  96. NavBar,
  97. UScrollView,
  98. UShareActionSheet,
  99. UPanel,
  100. DisclaimerText
  101. },
  102. computed: {},
  103. data() {
  104. return {
  105. showShare: false,
  106. shareInfo: null,
  107. exhibit: {
  108. is_collect: 0,
  109. is_like: 0,
  110. is_poll: 0,
  111. name: '',
  112. summary: '',
  113. product_cate_names: [],
  114. application_areas_names: [],
  115. product_attr_names: [],
  116. pic: '',
  117. poll_count: 0,
  118. pv: 0,
  119. exhibitors_logo: '',
  120. exhibitors_name_zh_cn: '',
  121. exhibitors_name_en_us: '',
  122. exhibitors_hall: '',
  123. exhibitors_booth_no: ''
  124. },
  125. id: 0,
  126. pollShow: {
  127. exhibitors_poll_show: 0,
  128. product_poll_show: 0
  129. }
  130. }
  131. },
  132. onLoad(options) {
  133. this.id = options.id
  134. this.getProductInfo()
  135. },
  136. created() {
  137. this.loadFontFace('Poppins')
  138. this.getGlobalPollShow()
  139. },
  140. methods: {
  141. getProductInfo() {
  142. exhibitorsProductInfo({id: this.id}).then(res => {
  143. if (res.code === 0) {
  144. this.exhibit = res.data
  145. }
  146. })
  147. },
  148. onShareAppMessage() {
  149. return this.shareInfo
  150. },
  151. onShare() {
  152. this.shareInfo = {
  153. title: this.exhibit.name,
  154. path: `/pages/exhibitor/exhibit-detail?id=` + this.id,
  155. imageUrl: this.exhibit.pic + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
  156. }
  157. this.showShare = true
  158. },
  159. onClickDetail(e) {
  160. this.navigateTo('/pages/exhibitor/detail?id=' + this.exhibit.exhibitors_id)
  161. },
  162. getGlobalPollShow() {
  163. globalPollShow().then(res => {
  164. this.pollShow = res.data
  165. })
  166. },
  167. onCollect() { // 收藏
  168. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  169. return
  170. }
  171. exhibitorsProductCollect({ id: this.id }).then(res => {
  172. if (res.code === 0) {
  173. this.exhibit.is_collect = this.exhibit.is_collect === 0 ? 1 : 0
  174. }
  175. })
  176. },
  177. onLike() { // 点赞
  178. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  179. return
  180. }
  181. exhibitorsProductLike({ id: this.id }).then(res => {
  182. if (res.code === 0) {
  183. this.exhibit.is_like = this.exhibit.is_like === 0 ? 1 : 0
  184. }
  185. })
  186. },
  187. onPoll() { // 投票
  188. if (!this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.id)) {
  189. return
  190. }
  191. exhibitorsProductPoll({ id: this.id }).then(res => {
  192. if (res.code === 0) {
  193. this.exhibit.is_poll = this.exhibit.is_poll === 0 ? 1 : 0
  194. if (this.exhibit.is_poll === 1) {
  195. this.exhibit.poll_count = this.exhibit.poll_count + 1
  196. } else {
  197. this.exhibit.poll_count = this.exhibit.poll_count - 1
  198. this.exhibit.poll_count = this.exhibit.poll_count < 0 ? 0 : this.exhibit.poll_count
  199. }
  200. }
  201. })
  202. },
  203. }
  204. }
  205. </script>
  206. <style lang="scss">
  207. @import "@/static/style/pages/exhibitor-detail.scss";
  208. .exhibit-detail{
  209. .exhibit-image{
  210. position: relative;
  211. height: 438rpx;
  212. background-color: #FFFFFF;
  213. border-radius: 5rpx;
  214. border: 1rpx solid #D6D6D6;
  215. .exhibit-tag{
  216. position: absolute;
  217. top: 28rpx;
  218. left: 29rpx;
  219. padding: 12rpx 22rpx;
  220. color: $textActionColor;
  221. font-size: $fontSize0;
  222. background-color: lighten($textActionColor, 43%);
  223. }
  224. }
  225. .exhibitor-detail-link{
  226. @include link-button;
  227. }
  228. .exhibit-name{
  229. margin-top: 28rpx;
  230. font-family: Poppins, Poppins;
  231. font-weight: bold;
  232. font-size: $fontSize6;
  233. color: #000000;
  234. line-height: 42rpx;
  235. }
  236. .exhibit-desc{
  237. margin-top: 18rpx;
  238. font-family: Poppins, Poppins;
  239. font-size: $fontSize2;
  240. color: #555555;
  241. line-height: 35rpx;
  242. }
  243. .exhibitor-card{
  244. display: flex;
  245. background-color: #FFFFFF;
  246. .exhibitor-info{
  247. padding: 36rpx;
  248. flex: 1;
  249. }
  250. .exhibitor-logo{
  251. width: 194rpx;
  252. image{
  253. height: auto;
  254. }
  255. }
  256. .exhibitor-detail-link{
  257. margin-top: 36rpx;
  258. }
  259. .exhibitor-name-cn,.exhibitor-name-en{
  260. font-family: Poppins, Poppins;
  261. font-size: $fontSize3;
  262. color: #000000;
  263. line-height: 28rpx;
  264. }
  265. .exhibitor-name-en{
  266. margin-top: 10rpx;
  267. font-size: $fontSize2;
  268. }
  269. .exhibitor-number{
  270. @include display-flex-center;
  271. flex-direction: column;
  272. width: 267rpx;
  273. background-color: $buttonPrimaryColor;
  274. color: #FFFFFF;
  275. }
  276. .exhibitor-number-text{
  277. width: 161rpx;
  278. text-align: center;
  279. font-family: Poppins, Poppins;
  280. font-weight: bold;
  281. font-size: 55rpx;
  282. line-height: 64rpx;
  283. margin-top: 30rpx;
  284. }
  285. .exhibitor-number-label{
  286. font-family: Poppins, Poppins;
  287. font-size: $fontSize3;
  288. line-height: 28rpx;
  289. color: rgba(255, 255, 255, 0.74);
  290. }
  291. }
  292. .u-panel{
  293. margin-top: 54rpx;
  294. padding: 0;
  295. .u-panel-title{
  296. &:after{
  297. display: none;
  298. }
  299. }
  300. }
  301. }
  302. </style>