Ver código fonte

展品信息

zhaosm 2 dias atrás
pai
commit
b9bc332b6b

+ 1 - 0
api/exhibitor.js

@@ -25,6 +25,7 @@ export const mettingList = get('/api/meeting/get-list') // 同期活动
 export const meetingCollect = post('/api/user/meeting/collect')
 export const meetingCancelCollect = post('/api/user/meeting/cancel-collect')
 export const meetingView = post('/api/user/meeting/view')
+export const mettingDesc = get('/api/global/metting-desc')
 
 export const exhibitorsCountryList = get('/api/exhibitors/country/list')
 export const productCategoryList = get('/api/product-category/list')

+ 7 - 1
pages/activity/components/activity-item.vue

@@ -2,7 +2,7 @@
 	<view class="activity-item" hover-class="active" @click="onClickActivity(item)">
 		<view class="activity-title">
 			<view>{{ item.title }}</view>
-			<view v-if="!favoritesHidden" @click="onCollect(item)" class="activity-favourites" :class="{ 'active': index === 1 }">
+			<view v-if="!favoritesHidden" @click.stop="onCollect(item)" class="activity-favourites" :class="{ 'active': index === 1 }">
 				<view v-if="item.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
 				<view v-else class="iconfont icon-Favourites-Add-Large"></view>
 				<view class="activity-favourites-text">收藏</view>
@@ -53,12 +53,18 @@
 					meetingCancelCollect({ id: item.id }).then(res => {
 						if (res.code === 0) {
 							item.is_collect = 0
+							this.$emit('updateItemCollect', {
+								id: item.id
+							})
 						}
 					})
 				} else {
 					meetingCollect({ id: item.id }).then(res => {
 						if (res.code === 0) {
 							item.is_collect = 1
+							this.$emit('updateItemCollect', {
+								id: item.id
+							})
 						}
 					})
 				}

+ 17 - 3
pages/activity/index.vue

@@ -5,12 +5,12 @@
 			<view class="main-container">
 				<view class="activity-head">
 					<view class="activity-head-title">同期活动</view>
-					<view class="activity-head-desc">今年慕尼黑上海电子生产设备展将围绕四大行业主题开展共计9场同期论坛,论坛围绕工业机器人、柔性制造、储能与新能源、汽车线束、智能座舱、智能制造、TGV先进材料、封装、胶粘剂、新能源汽车等热门话题展开更多探讨与交流。</view>
+					<view class="activity-head-desc">{{ mettingDesc }}</view>
 				</view>
 				<van-empty v-if="activityList.length === 0" description="暂无数据" />
 				<view v-else class="activity-list">
 					<template v-for="(item, index) in activityList">
-						<activity-item :item="item" :key="index" />
+						<activity-item :item="item" :key="index" @updateItemCollect="updateItemCollect"/>
 					</template>
 				</view>
 			</view>
@@ -22,7 +22,7 @@
 	import NavBar from '@/components/layout/nav-bar'
 	import UScrollView from '@/components/common/u-scroll-view'
 	import ActivityItem from '@/pages/activity/components/activity-item.vue'
-	import { mettingList } from '@/api/exhibitor'
+	import { mettingList, mettingDesc } from '@/api/exhibitor'
 	
 	export default {
 		options: {
@@ -43,9 +43,11 @@
 				},
 				activityListLoading: false,
 				activityListLastPage: 1,
+				mettingDesc: ''
 			}
 		},
 		created() {
+			this.getMettingDesc()
 			this.getList()
 		},
 		methods: {
@@ -65,6 +67,18 @@
 					this.activityListLoading = false
 				})
 			},
+			updateItemCollect(e) {
+				this.activityList.forEach((item) => {
+					if (item.id === e.id) {
+						item.is_collect = item.is_collect === 1 ? 0 : 1
+					}
+				})
+			},
+			getMettingDesc() {
+				mettingDesc().then(res => {
+					this.mettingDesc = res.data
+				})
+			}
 		}
 	}
 </script>

+ 43 - 4
pages/exhibitor/components/exhibit-item.vue

@@ -25,17 +25,17 @@
 						</view>
 					</button>
 				</view>
-				<view>
+				<view @click.stop="onCollect()">
 					<view v-if="item.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.stop="onLike()">
 					<view v-if="item.is_like" class="iconfont icon-aixin active"></view>
 					<view v-else class="iconfont icon-heart1"></view>
 					<view>点赞</view>
 				</view>
-				<view v-if="pollShow">
+				<view v-if="pollShow" @click.stop="onPoll()">
 					<view v-if="item.is_poll" class="iconfont icon-Ticket1 active"></view>
 					<view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
 					<view>投票</view>
@@ -46,7 +46,7 @@
 </template>
 
 <script>
-	
+	import { exhibitorsProductCollect, exhibitorsProductLike, exhibitorsProductPoll } from '@/api/exhibitor'
 	export default {
 		options: {
 			styleIsolation: 'shared'
@@ -78,6 +78,45 @@
 			},
 			onClickExhibit(item) {
 				this.navigateTo('/pages/exhibitor/exhibit-detail?id=' + item.id)
+			},
+			onCollect() { // 收藏
+				this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.item.id)
+				exhibitorsProductCollect({ id: this.item.id }).then(res => {
+					if (res.code === 0) {
+						let is_collect = this.item.is_collect === 0 ? 1 : 0
+						this.$emit('updateItemValue', {
+							id: this.item.id,
+							key: 'is_collect',
+							value: is_collect
+						})
+					}
+				})
+			},
+			onLike() { // 点赞
+				this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.item.id)
+				exhibitorsProductLike({ id: this.item.id }).then(res => {
+					if (res.code === 0) {
+						let is_like = this.item.is_like === 0 ? 1 : 0
+						this.$emit('updateItemValue', {
+							id: this.item.id,
+							key: 'is_like',
+							value: is_like
+						})
+					}
+				})
+			},
+			onPoll() { // 投票
+				this.checkAuth('/pages/exhibitor/exhibit-detail?id=' + this.item.id)
+				exhibitorsProductPoll({ id: this.item.id }).then(res => {
+					if (res.code === 0) {
+						let is_poll = this.item.is_poll === 0 ? 1 : 0
+						this.$emit('updateItemValue', {
+							id: this.item.id,
+							key: 'is_poll',
+							value: is_poll
+						})
+					}
+				})
 			}
 		}
 	}

+ 43 - 4
pages/exhibitor/components/exhibitor-item.vue

@@ -22,17 +22,17 @@
 						</view>
 					</button>
 				</view>
-				<view>
+				<view @click.stop="onCollect()">
 					<view v-if="item.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.stop="onLike()">
 					<view v-if="item.is_like" class="iconfont icon-aixin active"></view>
 					<view v-else class="iconfont icon-heart1"></view>
 					<view>点赞</view>
 				</view>
-				<view v-if="pollShow">
+				<view v-if="pollShow" @click.stop="onPoll()">
 					<view v-if="item.is_poll" class="iconfont icon-Ticket1 active"></view>
 					<view v-else class="iconfont icon-xiaochengxu-toupiaoicon"></view>
 					<view>投票</view>
@@ -43,7 +43,7 @@
 </template>
 
 <script>
-	
+	import { exhibitorsCollect, exhibitorsLike, exhibitorsPoll } from '@/api/exhibitor'
 	export default {
 		options: {
 			styleIsolation: 'shared'
@@ -63,6 +63,45 @@
 		created() {
 		},
 		methods: {
+			onCollect() { // 收藏
+				this.checkAuth('/pages/exhibitor/detail?id=' + this.item.id)
+				exhibitorsCollect({ id: this.item.id }).then(res => {
+					if (res.code === 0) {
+						let is_collect = this.item.is_collect === 0 ? 1 : 0
+						this.$emit('updateItemValue', {
+							id: this.item.id,
+							key: 'is_collect',
+							value: is_collect
+						})
+					}
+				})
+			},
+			onLike() { // 点赞
+				this.checkAuth('/pages/exhibitor/detail?id=' + this.item.id)
+				exhibitorsLike({ id: this.item.id }).then(res => {
+					if (res.code === 0) {
+						let is_like = this.item.is_like === 0 ? 1 : 0
+						this.$emit('updateItemValue', {
+							id: this.item.id,
+							key: 'is_like',
+							value: is_like
+						})
+					}
+				})
+			},
+			onPoll() { // 投票
+				this.checkAuth('/pages/exhibitor/detail?id=' + this.item.id)
+				exhibitorsPoll({ id: this.item.id }).then(res => {
+					if (res.code === 0) {
+						let is_poll = this.item.is_poll === 0 ? 1 : 0
+						this.$emit('updateItemValue', {
+							id: this.item.id,
+							key: 'is_poll',
+							value: is_poll
+						})
+					}
+				})
+			},
 			onShare(item) {
 				const shareInfo = {
 					title: item.name,

+ 13 - 1
pages/exhibitor/exhibit.vue

@@ -24,7 +24,7 @@
 				<van-empty v-if="exhibitList.length === 0" description="暂无数据" />
 				<view v-else class="exhibit-list exhibitor-list">
 					<template v-for="(item, index) in exhibitList">
-						<exhibit-item :item="item" :key="index" :pollShow="pollShow.product_poll_show" @share="onShare" />
+						<exhibit-item :item="item" :key="index" :pollShow="pollShow.product_poll_show" @share="onShare" @updateItemValue="updateItemValue()"/>
 					</template>	
 				</view>
 			</view>
@@ -186,6 +186,18 @@
 			},
 			onSearch() {
 				this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
+			},
+			getGlobalPollShow() {
+				globalPollShow().then(res => {
+					this.pollShow = res.data
+				})
+			},
+			updateItemValue(e) {
+				this.exhibitList.forEach((item) => {
+					if (item.id === e.id) {
+						item[e.key] = e.value
+					}
+				})
 			}
 		}
 	}

+ 8 - 1
pages/exhibitor/index.vue

@@ -24,7 +24,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" :pollShow="pollShow.exhibitors_poll_show" @share="(e) => $emit('share', e)" />
+						<exhibitor-item :item="item" :key="index" :pollShow="pollShow.exhibitors_poll_show" @share="(e) => $emit('share', e)" @updateItemValue="updateItemValue()" />
 					</template>	
 				</view>
 			</view>
@@ -179,6 +179,13 @@
 				globalPollShow().then(res => {
 					this.pollShow = res.data
 				})
+			},
+			updateItemValue(e) {
+				this.exhibitorList.forEach((item) => {
+					if (item.id === e.id) {
+						item[e.key] = e.value
+					}
+				})
 			}
 		}
 	}