zhaosm hace 3 días
padre
commit
1f54c52edb
Se han modificado 3 ficheros con 64 adiciones y 8 borrados
  1. 6 0
      api/exhibitor.js
  2. 31 6
      pages/activity/components/activity-item.vue
  3. 27 2
      pages/activity/index.vue

+ 6 - 0
api/exhibitor.js

@@ -14,12 +14,18 @@ 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 newsList = get('/api/news/exhibit-list') // 展会新闻
 
 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 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 exhibitorsCountryList = get('/api/exhibitors/country/list')
 export const productCategoryList = get('/api/product-category/list')
 export const applicationAreasList = get('/api/application-areas/list')

+ 31 - 6
pages/activity/components/activity-item.vue

@@ -1,18 +1,18 @@
 <template>
 	<view class="activity-item" hover-class="active" @click="onClickActivity(item)">
 		<view class="activity-title">
-			<view>TGV先进材料及封装产业化机遇高峰论坛</view>
-			<view v-if="!favoritesHidden" class="activity-favourites" :class="{ 'active': index === 1 }">
+			<view>{{ item.title }}</view>
+			<view v-if="!favoritesHidden" @click="onCollect(item)" class="activity-favourites" :class="{ 'active': index === 1 }">
 				<view v-if="item.favourited" 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>
 			</view>
 		</view>
-		<view class="activity-time">2024年03月20日 | E1馆二楼M16会议室</view>
-		<view class="activity-views">浏览:1080</view>
+		<view class="activity-time">{{ formatDate(item.pub_date) }} | {{ item.address }}</view>
+		<view class="activity-views">浏览:{{ item.view }}</view>
 		<view class="activity-desc">
 			<view>
-				本次论坛将探讨玻璃基芯片板级封装载板在Mini/Micro直显、MIP封装、2.5D/3D封装、射频芯片载板、光通信芯片载板以及其他芯片载板,尤其是半导体先进封装领域的应用。
+				{{ item.description }}
 			</view>
 			<view>
 				<van-button class="activity-detail-link" type="primary">
@@ -26,6 +26,7 @@
 </template>
 
 <script>
+	import { meetingCollect, meetingCancelCollect, meetingView } from '@/api/exhibitor'
 	
 	export default {
 		options: {
@@ -40,13 +41,37 @@
 		},
 		data() {
 			return {
+				websiteUrl: process.env.WEBSITE
 			}
 		},
 		created() {
 		},
 		methods: {
+			onCollect(item) { // 收藏
+				this.checkAuth('pages/activity/index')
+				if (item.is_collect === 1) {
+					meetingCancelCollect({ id: item.id }).then(res => {
+						if (res.code === 0) {
+							item.is_collect = 0
+						}
+					})
+				} else {
+					meetingCollect({ id: item.id }).then(res => {
+						if (res.code === 0) {
+							item.is_collect = 1
+						}
+					})
+				}
+			},
+			formatDate(dateString) {
+			  const date = new Date(dateString);
+			  const year = date.getFullYear();
+			  const month = date.getMonth() + 1; // 月份从 0 开始
+			  const day = date.getDate();
+			  return `${year}年${month}月${day}日`;
+			},
 			onClickActivity(item){
-				this.navigateTo('/pages/activity/detail')
+				this.navigateTo(this.websiteUrl + '/' + item.urla)
 			}
 		}
 	}

+ 27 - 2
pages/activity/index.vue

@@ -22,6 +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'
 	
 	export default {
 		options: {
@@ -35,11 +36,35 @@
 		data() {
 			return {
 				activityList: [{ favourited: true }, {}, {}],
+				activityParams: {
+					page: 1,
+					page_size: 10,
+					keyword: '',
+				},
+				activityListLoading: false,
+				activityListLastPage: 1,
 			}
 		},
-		created() {},
+		created() {
+			this.getList()
+		},
 		methods: {
-			
+			getList() {
+				this.activityListLoading = true
+				mettingList(this.activityParams).then(res => {
+					if (res.data.data) {
+						if (this.activityParams.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
+				})
+			},
 		}
 	}
 </script>