Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/zhaosm' into zhaosm

yanj 2 dní pred
rodič
commit
ef7c9772d1

+ 2 - 2
api/exhibitor.js

@@ -24,7 +24,7 @@ export const exhibitorsBoothActivityCollect = post('/api/exhibitors/booth-activi
 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 mettingView = post('/api/user/meeting/view')
 export const mettingDesc = get('/api/global/metting-desc')
 
 export const exhibitorsCountryList = get('/api/exhibitors/country/list')
@@ -36,5 +36,5 @@ export const exhibitorsHallList = get('/api/exhibitors/hall/list')
 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 globalSearch = get('/api/exhibitors/search') // 全局搜索
 export const globalPollShow = get('/api/global/poll-show') // 人气是否显示

+ 21 - 11
pages/activity/components/activity-item.vue

@@ -8,11 +8,11 @@
 				<view class="activity-favourites-text">收藏</view>
 			</view>
 		</view>
-		<view class="activity-time">{{ formatDate(item.pub_date) }} | {{ item.address }}</view>
-		<view class="activity-views">浏览:{{ item.view }}</view>
+		<view class="activity-time">{{ formatDate(item.start_date || item.start_time || '') }} | {{ item.address }}</view>
+		<view class="activity-views">浏览:{{ item.view || item.pv || 0 }}</view>
 		<view class="activity-desc">
 			<view>
-				{{ item.description }}
+				{{ item.description || item.content || '' }}
 			</view>
 			<view>
 				<van-button class="activity-detail-link" type="primary">
@@ -26,7 +26,7 @@
 </template>
 
 <script>
-	import { meetingCollect, meetingCancelCollect, meetingView } from '@/api/exhibitor'
+	import { meetingCollect, meetingCancelCollect, mettingView } from '@/api/exhibitor'
 	
 	export default {
 		options: {
@@ -37,7 +37,8 @@
 		props: {
 			// 数据
 			item: Object,
-			favoritesHidden: Boolean
+			favoritesHidden: Boolean,
+			platform: String
 		},
 		data() {
 			return {
@@ -52,18 +53,20 @@
 				if (item.is_collect === 1) {
 					meetingCancelCollect({ id: item.id }).then(res => {
 						if (res.code === 0) {
-							item.is_collect = 0
-							this.$emit('updateItemCollect', {
-								id: item.id
+							this.$emit('updateItemValue', {
+								id: item.id,
+								key: 'is_collect',
+								value: 0
 							})
 						}
 					})
 				} else {
 					meetingCollect({ id: item.id }).then(res => {
 						if (res.code === 0) {
-							item.is_collect = 1
-							this.$emit('updateItemCollect', {
-								id: item.id
+							this.$emit('updateItemValue', {
+								id: item.id,
+								key: 'is_collect',
+								value: 1
 							})
 						}
 					})
@@ -77,7 +80,14 @@
 			  return `${year}年${month}月${day}日`;
 			},
 			onClickActivity(item){
+				this.saveMeetingView(item)
 				this.navigateTo(this.websiteUrl + '/' + item.urla)
+			},
+			saveMeetingView(item) {
+				if (this.platform !== 'metting') return
+				mettingView({ id: item.id }).then(res => {
+					
+				})
 			}
 		}
 	}

+ 4 - 4
pages/activity/index.vue

@@ -10,7 +10,7 @@
 				<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" @updateItemCollect="updateItemCollect"/>
+						<activity-item :item="item" :key="index" platform="metting" @updateItemValue="updateItemValue()"/>
 					</template>
 				</view>
 				<!-- <disclaimer-text></disclaimer-text> -->
@@ -38,7 +38,7 @@
 		},
 		data() {
 			return {
-				activityList: [{ favourited: true }, {}, {}],
+				activityList: [],
 				activityParams: {
 					page: 1,
 					page_size: 10,
@@ -70,10 +70,10 @@
 					this.activityListLoading = false
 				})
 			},
-			updateItemCollect(e) {
+			updateItemValue(e) {
 				this.activityList.forEach((item) => {
 					if (item.id === e.id) {
-						item.is_collect = item.is_collect === 1 ? 0 : 1
+						item[e.key] = e.value
 					}
 				})
 			},

+ 234 - 19
pages/index/search.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="search-index">
 		<nav-bar title="搜索" @init="onInitNavbar"></nav-bar>
-		<u-scroll-view>
+		<u-scroll-view :tabbar-conflict="false" @scroll-near-lower="onScrollToLower">
 			<view class="main-container">
 				<u-search v-model="searchKeyword" placeholder="搜索展商 / 展品名称 / 会议" @search="onClickSearch"/>
 				<view class="search-result-text">搜索结果</view>
@@ -12,19 +12,12 @@
 					<u-tabs :active.sync="tabActive" :tabs="tabs" tab-style="default" @change="tabChange"/>
 					<view v-if="tabActive === 1" class="search-result-list exhibit-list">
 						<template v-for="(item, index) in exhibitorList">
-							<exhibitor-item :item="item" :key="index" />
-							<exhibitor-item :item="item" :key="index" />
-							<exhibitor-item :item="item" :key="index" />
-							<exhibitor-item :item="item" :key="index" />
-							<exhibitor-item :item="item" :key="index" />
-							<exhibitor-item :item="item" :key="index" />
-							<exhibitor-item :item="item" :key="index" />
-							<exhibitor-item :item="item" :key="index" />
+							<exhibitor-item :item="item" :key="index" @updateItemValue="updateItemValue()"/>
 						</template>
 					</view>
 					<view v-else-if="tabActive === 2" class="search-result-list exhibit-list">
 						<template v-for="(item, index) in exhibitList">
-							<exhibit-item :item="item" :key="index" />
+							<exhibit-item :item="item" :key="index" @updateItemValue="updateItemValue()"/>
 						</template>
 					</view>
 					<view v-else-if="tabActive === 3" class="search-result-list exhibit-list">
@@ -34,12 +27,12 @@
 					</view>
 					<view v-else-if="tabActive === 4" class="search-result-list exhibit-list">
 						<template v-for="(item, index) in activityList">
-							<activity-item :item="item" :key="index" />
+							<activity-item :item="item" :key="index" @updateItemValue="updateItemValue()"/>
 						</template>
 					</view>
 					<view v-else-if="tabActive === 5" class="search-result-list exhibit-list">
-						<template v-for="(item, index) in activityList">
-							<activity-item :item="item" :key="index" />
+						<template v-for="(item, index) in mettingList">
+							<activity-item :item="item" :key="index" platform="metting" @updateItemValue="updateItemValue()"/>
 						</template>
 					</view>
 				</template>
@@ -58,6 +51,7 @@
 	import ExhibitorItem from '@/pages/exhibitor/components/exhibitor-item.vue'
 	import NewsItem from '@/pages/news/components/news-item.vue'
 	import ActivityItem from '@/pages/activity/components/activity-item.vue'
+	import { globalSearch, mettingList, exhibitorsList, exhibitorsProductList, exhibitorsNewsList, exhibitorsBoothActivityList } from '@/api/exhibitor'
 	import DisclaimerText from '@/components/disclaimer-text/index.vue'
 	export default {
 		options: {
@@ -79,7 +73,7 @@
 				searchKeyword: '',
 				tabActive: 1,
 				isEmpty: false,
-				tabs: [{
+				defaultTabs: [{
 					label: '展商',
 					value: 1
 				}, {
@@ -95,16 +89,59 @@
 					label: '同期活动',
 					value: 5
 				}],
-				exhibitorList: [{ favourited: true }, { liked: true }, { voted: true }, {}],
-				exhibitList: [{ favourited: true }, { liked: true }, { voted: true }],
-				newsList: [{}, {}, {}, {}],
-				activityList: [{ favourited: true }, {}, {}, {}, {}]
+				tabs: [],
+				exhibitorList: [],
+				exhibitorListLoading: false,
+				exhibitorListLastPage: 1,
+				exhibitorListParams: {
+					page: 1,
+					page_size: 10,
+					keyword: ''
+				},
+				exhibitList: [],
+				exhibitListLoading: false,
+				exhibitListLastPage: 1,
+				exhibitListParams: {
+					page: 1,
+					page_size: 10,
+					keyword: ''
+				},
+				newsList: [],
+				newsListLoading: false,
+				newsListLastPage: 1,
+				newsListParams: {
+					page: 1,
+					page_size: 10,
+					keyword: ''
+				},
+				activityList: [],
+				activityListLoading: false,
+				activityListLastPage: 1,
+				activityListParams: {
+					page: 1,
+					page_size: 10,
+					keyword: ''
+				},
+				mettingList: [],
+				mettingListLoading: false,
+				mettingListLastPage: 1,
+				mettingListParams: {
+					page: 1,
+					page_size: 10,
+					keyword: ''
+				},
+				listParams: {
+					page: 1,
+					page_size: 10,
+					keyword: ''
+				}
 			}
 		},
 		onLoad(options) {
 			console.log('options')
 			console.log(options.query)
 			this.searchKeyword = options.query
+			this.onClickSearch()
 		},
 		created() {},
 		methods: {
@@ -112,7 +149,185 @@
 
 			},
 			onClickSearch() {
-
+				this.listParams.page = 1
+				this.listParams.keyword = this.searchKeyword
+				this.exhibitorListParams = {...this.listParams}
+				this.exhibitListParams = {...this.listParams}
+				this.newsListParams = {...this.listParams}
+				this.activityListParams = {...this.listParams}
+				this.mettingListParams = {...this.listParams}
+				this.tabs = [...this.defaultTabs]
+				this.getGlobalSearch()
+				this.getMettingList()
+			},
+			getGlobalSearch() { // 全局搜索
+				globalSearch(this.listParams).then(res => {
+					if (res.code === 0) {
+						this.exhibitorList = res.data.exhibitors_list.data ?? []
+						this.exhibitorListLastPage = res.data.exhibitors_list.last_page ?? 1
+						this.exhibitList = res.data.product_list.data ?? []
+						this.exhibitListLastPage = res.data.product_list.last_page ?? 0
+						this.newsList = res.data.news_list.data ?? []
+						this.newsListLastPage = res.data.news_list.last_page ?? 0
+						this.activityList = res.data.booth_activity_list.data ?? []
+						this.activityListLastPage = res.data.booth_activity_list.last_page ?? 0
+						if (this.exhibitorList.length === 0) {
+							this.tabs = this.tabs.filter(item => item.value !== 1);
+						}
+						if (this.exhibitList.length === 0) {
+							this.tabs = this.tabs.filter(item => item.value !== 2);
+						}
+						if (this.newsList.length === 0) {
+							this.tabs = this.tabs.filter(item => item.value !== 3);
+						}
+						if (this.activityList.length === 0) {
+							this.tabs = this.tabs.filter(item => item.value !== 4);
+						}
+					}
+				})
+			},
+			getExhibitorsList() { // 展商
+				this.exhibitorListLoading = true
+				exhibitorsList(this.exhibitorListParams).then(res => {
+					if (res.data.data) {
+						if (this.exhibitorListParams.page > 1) {
+							this.exhibitorList = [...this.exhibitorList, ...res.data.data]
+						} else {
+							this.exhibitorList = res.data.data
+							this.exhibitorListLastPage = res.data.last_page
+						}
+					} else {
+						this.showToast('系统繁忙,稍候再试')
+					}
+					this.exhibitorListLoading = false
+				})
+			},
+			getExhibitList() { // 展品 
+				this.exhibitListLoading = true
+				exhibitorsProductList(this.exhibitListParams).then(res => {
+					if (res.data.data) {
+						if (this.exhibitListParams.page > 1) {
+							this.exhibitList = [...this.exhibitList, ...res.data.data]
+						} else {
+							this.exhibitList = res.data.data
+							this.exhibitListLastPage = res.data.last_page
+						}
+					} else {
+						this.showToast('系统繁忙,稍候再试')
+					}
+					this.exhibitListLoading = false
+				})
+			},
+			getExhibitorsNewsList() { // 展商新闻
+				this.newsListLoading = true
+				exhibitorsNewsList(this.newsListParams).then(res => {
+					if (res.data.data) {
+						if (this.newsListParams.page > 1) {
+							this.newsList = [...this.newsList, ...res.data.data]
+						} else {
+							this.newsList = res.data.data
+							this.newsListLastPage = res.data.last_page
+						}
+					} else {
+						this.showToast('系统繁忙,稍候再试')
+					}
+					this.newsListLoading = false
+				})
+			},
+			getActivityList() { // 展台活动
+				this.activityListLoading = true
+				exhibitorsBoothActivityList(this.activityListParams).then(res => {
+					if (res.data.data) {
+						if (this.activityListParams.page > 1) {
+							this.activityList = [...this.activityList, ...res.data.data]
+						} else {
+							this.activityList = res.data.data
+							this.activityListLastPage = res.data.last_page
+						}
+					} else {
+						this.showToast('系统繁忙,稍候再试')
+					}
+					this.activityListLoading = false
+				})
+			},
+			getMettingList() { // 同期活动
+				this.mettingListLoading = true
+				mettingList(this.mettingListParams).then(res => {
+					if (res.data.data) {
+						if (this.mettingListParams.page > 1) {
+							this.mettingList = [...this.mettingList, ...res.data.data]
+						} else {
+							this.mettingList = res.data.data
+							this.mettingListLastPage = res.data.last_page
+						}
+						if (this.mettingListParams.page === 1 && this.mettingList.length === 0) {
+							this.tabs = this.tabs.filter(item => item.value !== 5);
+						}
+					} else {
+						this.showToast('系统繁忙,稍候再试')
+					}
+					this.mettingListLoading = false
+				})
+			},
+			onScrollToLower(e) {
+				if (this.tabActive === 1) {
+					if (this.exhibitorListLastPage === this.exhibitorListParams.page) return
+					if (this.exhibitorListLoading === true) return
+					this.exhibitorListLoading = true
+					this.exhibitorListParams.page = this.exhibitorListParams.page+1
+					this.getExhibitorsList()
+				} else if (this.tabActive === 2) {
+					if (this.exhibitListLastPage === this.exhibitListParams.page) return
+					if (this.exhibitListLoading === true) return
+					this.exhibitListLoading = true
+					this.exhibitListParams.page = this.exhibitListParams.page+1
+					this.getExhibitList()
+				} else if (this.tabActive === 3) {
+					if (this.newsListLastPage === this.newsListParams.page) return
+					if (this.newsListLoading === true) return
+					this.newsListLoading = true
+					this.newsListParams.page = this.newsListParams.page+1
+					this.getExhibitorsNewsList()
+				} else if (this.tabActive === 4) {
+					if (this.activityListLastPage === this.activityListParams.page) return
+					if (this.activityListLoading === true) return
+					this.activityListLoading = true
+					this.activityListParams.page = this.activityListParams.page+1
+					this.getActivityList()
+				} else if (this.tabActive === 5) {
+					if (this.mettingListLastPage === this.mettingListParams.page) return
+					if (this.mettingListLoading === true) return
+					this.mettingListLoading = true
+					this.mettingListParams.page = this.mettingListParams.page+1
+					this.getMettingList()
+				}
+			},
+			updateItemValue(e) {
+				if (this.tabActive === 1) {
+					this.exhibitorList.forEach((item) => {
+						if (item.id === e.id) {
+							item[e.key] = e.value
+						}
+					})
+				} else if (this.tabActive === 2) {
+					this.exhibitList.forEach((item) => {
+						if (item.id === e.id) {
+							item[e.key] = e.value
+						}
+					})
+				} else if (this.tabActive === 4) {
+					this.activityList.forEach((item) => {
+						if (item.id === e.id) {
+							item[e.key] = e.value
+						}
+					})
+				} else if (this.tabActive === 5) {
+					this.mettingList.forEach((item) => {
+						if (item.id === e.id) {
+							item[e.key] = e.value
+						}
+					})
+				}
 			}
 		}
 	}