exhibit-detail.vue 8.3 KB

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