소스 검색

展商详情

zhaosm 3 일 전
부모
커밋
bb71640248
4개의 변경된 파일73개의 추가작업 그리고 14개의 파일을 삭제
  1. 8 0
      api/exhibitor.js
  2. 3 2
      pages/exhibitor/components/exhibitor-item.vue
  3. 47 7
      pages/exhibitor/detail.vue
  4. 15 5
      pages/exhibitor/index.vue

+ 8 - 0
api/exhibitor.js

@@ -2,15 +2,22 @@ import { get, post, link, upload } from '@/utils/request'
 
 export const exhibitorsList = get('/api/exhibitors/list')
 export const exhibitorsInfo = get('/api/exhibitors/info')
+export const exhibitorsCollect = post('/api/exhibitors/collect')
+export const exhibitorsLike = post('/api/exhibitors/like')
+export const exhibitorsPoll = post('/api/exhibitors/poll')
 
 export const exhibitorsProductList = get('/api/exhibitors/product/list')
 export const exhibitorsProductInfo = get('/api/exhibitors/product/info')
+export const exhibitorsProductCollect = post('/api/exhibitors/product/collect')
+export const exhibitorsProductLike = post('/api/exhibitors/product/like')
+export const exhibitorsProductPoll = post('/api/exhibitors/product/poll')
 
 export const exhibitorsNewsList = get('/api/exhibitors/news/list')
 export const exhibitorsNewsInfo = get('/api/exhibitors/news/info')
 
 export const exhibitorsBoothActivityList = get('/api/exhibitors/booth-activity/list')
 export const exhibitorsBoothActivityInfo = get('/api/exhibitors/booth-activity/info')
+export const exhibitorsBoothActivityCollect = post('/api/exhibitors/booth-activity/collect')
 
 export const exhibitorsCountryList = get('/api/exhibitors/country/list')
 export const productCategoryList = get('/api/product-category/list')
@@ -22,3 +29,4 @@ export const exhibitorsViewLogList = get('/api/exhibitors/view-log')
 export const exhibitorsProductViewLogList = get('/api/exhibitors/product/view-log')
 
 export const exhibitorsSearch = get('/api/exhibitors/search') // 全局搜索
+export const globalPollShow = get('/api/global/poll-show') // 人气是否显示

+ 3 - 2
pages/exhibitor/components/exhibitor-item.vue

@@ -32,7 +32,7 @@
 					<view v-else class="iconfont icon-heart1"></view>
 					<view>点赞</view>
 				</view>
-				<view>
+				<view v-if="pollShow">
 					<view v-if="item.is_poll" class="iconfont icon-Ticket1 active"></view>
 					<view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
 					<view>投票</view>
@@ -53,7 +53,8 @@
 		props: {
 			// 数据
 			item: Object,
-			footerHidden: Boolean
+			footerHidden: Boolean,
+			pollShow: Number
 		},
 		data() {
 			return {

+ 47 - 7
pages/exhibitor/detail.vue

@@ -42,7 +42,7 @@
 				<view class="exhibitor-operation">
 					<view class="exhibitor-views">浏览:{{ exhibitor.pv }}</view>
 					<view class="exhibitor-action">
-						<view>
+						<view v-if="pollShow.exhibitors_poll_show">
 							<view class="iconfont icon-xiaochengxu-renqiicon"></view>
 							<view>人气:{{ exhibitor.poll_count }}</view>
 						</view>
@@ -54,17 +54,17 @@
 								</view>
 							</button>
 						</view>
-						<view>
+						<view @click="onCollect()">
 							<view v-if="exhibitor.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
 							<view v-else class="iconfont icon-Favourites-Add-Large"></view>
 							<view>收藏</view>
 						</view>
-						<view>
+						<view @click="onLike()">
 							<view v-if="exhibitor.is_like" class="iconfont icon-aixin active"></view>
 							<view v-else class="iconfont icon-heart1"></view>
 							<view>点赞</view>
 						</view>
-						<view>
+						<view v-if="pollShow.exhibitors_poll_show" @click="onPoll()">
 							<view v-if="exhibitor.is_poll" class="iconfont icon-Ticket1 active"></view>
 							<view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
 							<view>投票</view>
@@ -95,7 +95,7 @@
 	import ExhibitRecommend from '@/pages/exhibitor/components/exhibit-recommend.vue'
 	import NewsRecommend from '@/pages/news/components/news-recommend.vue'
 	import ActivityRecommend from '@/pages/activity/components/activity-recommend.vue'
-	import { exhibitorsInfo } from '@/api/exhibitor'
+	import { exhibitorsInfo, exhibitorsCollect, exhibitorsLike, exhibitorsPoll, globalPollShow } from '@/api/exhibitor'
 	
 	export default {
 		options: {
@@ -132,11 +132,16 @@
 					pv: 0,
 					poll_count: 0
 				},
-				exhibitorId: 0
+				exhibitorId: 0,
+				pollShow: {
+					exhibitors_poll_show: 0,
+					product_poll_show: 0
+				}
 			}
 		},
 		created() {
 			this.loadFontFace('Poppins')
+			this.getGlobalPollShow()
 		},
 		methods: {
 			getExhibitorsInfo() {
@@ -153,13 +158,48 @@
 					imageUrl: this.exhibitor.logo + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
 				}
 			},
-			onShare(item) {
+			onShare() {
 				this.shareInfo = {
 					title: this.exhibitor.name_zh_cn,
 					path: `/pages/exhibitor/detail?id=` + this.exhibitor.id,
 					imageUrl: this.exhibitor.logo + '?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
 				}
 				this.showShare = true
+			},
+			onCollect() { // 收藏
+				this.checkAuth('/pages/exhibitor/detail?id=' + this.exhibitor.id)
+				exhibitorsCollect({ id: this.exhibitor.id }).then(res => {
+					if (res.code === 0) {
+						this.exhibitor.is_collect = this.exhibitor.is_collect === 0 ? 1 : 0
+					}
+				})
+			},
+			onLike() { // 点赞
+				this.checkAuth('/pages/exhibitor/detail?id=' + this.exhibitor.id)
+				exhibitorsLike({ id: this.exhibitor.id }).then(res => {
+					if (res.code === 0) {
+						this.exhibitor.is_like = this.exhibitor.is_like === 0 ? 1 : 0
+					}
+				})
+			},
+			onPoll() { // 投票
+				this.checkAuth('/pages/exhibitor/detail?id=' + this.exhibitor.id)
+				exhibitorsPoll({ id: this.exhibitor.id }).then(res => {
+					if (res.code === 0) {
+						this.exhibitor.is_poll = this.exhibitor.is_poll === 0 ? 1 : 0
+						if (this.exhibitor.is_poll === 1) {
+							this.exhibitor.poll_count = this.exhibitor.poll_count + 1
+						} else {
+							this.exhibitor.poll_count = this.exhibitor.poll_count - 1
+							this.exhibitor.poll_count = this.exhibitor.poll_count < 0 ? 0 : this.exhibitor.poll_count
+						}
+					}
+				})
+			},
+			getGlobalPollShow() {
+				globalPollShow().then(res => {
+					this.pollShow = res.data
+				})
 			}
 		}
 	}

+ 15 - 5
pages/exhibitor/index.vue

@@ -25,7 +25,7 @@
 				<van-empty v-if="exhibitorList.length === 0" description="暂无数据" />
 				<view v-else class="exhibitor-list">
 					<template v-for="(item, index) in exhibitorList">
-						<exhibitor-item :item="item" :key="index" @share="(e) => $emit('share', e)" />
+						<exhibitor-item :item="item" :key="index" :pollShow="pollShow.exhibitors_poll_show" @share="(e) => $emit('share', e)" />
 					</template>	
 				</view>
 			</view>
@@ -39,7 +39,7 @@
 	import USearch from '@/components/common/u-search'
 	import UDropdownSelect from '@/components/common/u-dropdown-select'
 	import ExhibitorItem from '@/pages/exhibitor/components/exhibitor-item.vue'
-	import { exhibitorsList, productCategoryList, exhibitorsHallList, applicationAreasList } from '@/api/exhibitor'
+	import { exhibitorsList, productCategoryList, exhibitorsHallList, applicationAreasList, globalPollShow } from '@/api/exhibitor'
 	
 	export default {
 		options: {
@@ -63,7 +63,7 @@
 					page_size: 10,
 					keyword: '',
 					country: '',
-					hall: '',
+					hall_id: '',
 					product_cate_id: '',
 					application_areas_id: ''
 				},
@@ -72,7 +72,11 @@
 				exhibitorListLastPage: 1,
 				categories: [],
 				halls: [],
-				applicationAreass: []
+				applicationAreass: [],
+				pollShow: {
+					exhibitors_poll_show: 0,
+					product_poll_show: 0
+				}
 			}
 		},
 		created() {
@@ -81,6 +85,7 @@
 			this.getExhibitorsHallList()
 			this.getApplicationAreasList()
 			this.getExhibitorsList()
+			this.getGlobalPollShow()
 		},
 		methods: {
 			getApplicationAreasList() {
@@ -130,7 +135,7 @@
 			searchExhibitorsList() {
 				this.exhibitorsParams.application_areas_id = this.searchApplicationAreas || ''
 				this.exhibitorsParams.product_cate_id = this.searchCategoryId || ''
-				this.exhibitorsParams.hall = this.searchHall || ''
+				this.exhibitorsParams.hall_id = this.searchHall || ''
 				this.exhibitorsParams.page = 1
 				this.getExhibitorsList()
 			},
@@ -169,6 +174,11 @@
 			},
 			onSearch() {
 				this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
+			},
+			getGlobalPollShow() {
+				globalPollShow().then(res => {
+					this.pollShow = res.data
+				})
 			}
 		}
 	}