浏览代码

展商新闻

zhaosm 3 天之前
父节点
当前提交
da34b381e9
共有 6 个文件被更改,包括 88 次插入18 次删除
  1. 2 1
      api/exhibitor.js
  2. 6 3
      package.json
  3. 4 3
      pages/exhibitor/exhibit.vue
  4. 4 3
      pages/exhibitor/index.vue
  5. 4 3
      pages/news/components/news-item.vue
  6. 68 5
      pages/news/index.vue

+ 2 - 1
api/exhibitor.js

@@ -12,8 +12,9 @@ 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 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')

+ 6 - 3
package.json

@@ -17,7 +17,8 @@
 					"UNI_PLATFORM": "mp-weixin",
 					"NAME": "dev",
 					"TOKEN_KEY": "token",
-					"BASE_API": "https://mp-test-miniprogapi.matchexpo.cn"
+					"BASE_API": "https://mp-test-onlinecatelogue.matchexpo.cn",
+					"WEBSITE": "https://mp-website-test-munich.matchexpo.cn"
 				},
 				"define": {
 					"MP-CJN": true
@@ -29,7 +30,8 @@
 					"UNI_PLATFORM": "mp-weixin",
 					"NAME": "test",
 					"TOKEN_KEY": "token",
-					"BASE_API": "https://mp-test-miniprogapi.matchexpo.cn"
+					"BASE_API": "https://mp-test-miniprogapi.matchexpo.cn",
+					"WEBSITE": "https://mp-website-test-munich.matchexpo.cn"
 				},
 				"define": {
 					"MP-CJN": true
@@ -41,7 +43,8 @@
 					"UNI_PLATFORM": "mp-weixin",
 					"NAME": "prod",
 					"TOKEN_KEY": "token",
-					"BASE_API": "https://starify-api-dev.matchexpo.cn"
+					"BASE_API": "https://starify-api-dev.matchexpo.cn",
+					"WEBSITE": "https://www.productronicachina.com.cn"
 				},
 				"define": {
 					"MP-CJN": true

+ 4 - 3
pages/exhibitor/exhibit.vue

@@ -130,9 +130,6 @@
 				this.getList()
 			},
 			getList() {
-				if (this.exhibitListLoading === true) {
-					return
-				}
 				this.exhibitListLoading = true
 				exhibitorsProductList(this.exhibitParams).then(res => {
 					if (res.data.data) {
@@ -152,6 +149,10 @@
 				if (this.exhibitListLastPage === this.exhibitParams.page) {
 					return
 				}
+				if (this.exhibitListLoading === true) {
+					return
+				}
+				this.exhibitListLoading = true
 				this.exhibitParams.page = this.exhibitParams.page+1
 				this.getList()
 			},

+ 4 - 3
pages/exhibitor/index.vue

@@ -139,9 +139,6 @@
 				this.getExhibitorsList()
 			},
 			getExhibitorsList() {
-				if (this.exhibitorListLoading === true) {
-					return
-				}
 				this.exhibitorListLoading = true
 				exhibitorsList(this.exhibitorsParams).then(res => {
 					if (res.data.data) {
@@ -161,6 +158,10 @@
 				if (this.exhibitorListLastPage === this.exhibitorsParams.page) {
 					return
 				}
+				if (this.exhibitorListLoading === true) {
+					return
+				}
+				this.exhibitorListLoading = true
 				this.exhibitorsParams.page = this.exhibitorsParams.page+1
 				this.getExhibitorsList()
 			},

+ 4 - 3
pages/news/components/news-item.vue

@@ -1,9 +1,9 @@
 <template>
 	<view class="news-item" @click="onClickDetail(item)">
 		<view class="news-title">{{ item.title }}</view>
-		<view class="news-time">{{ formatDate(item.publish_time) }}</view>
+		<view class="news-time">{{ formatDate(item.publish_time || item.pub_date) }}</view>
 		<view class="news-summary">
-			<view class="text">{{ item.content }}</view>
+			<view class="text">{{ item.content || item.description }}</view>
 			<view class="to-detail"><view>了解详情</view> <view class="arrow iconfont icon-right-s"></view></view>
 		</view>
 	</view>
@@ -20,6 +20,7 @@
 		},
 		data() {
 			return {
+				websiteUrl: process.env.WEBSITE
 			}
 		},
 		created() {
@@ -36,7 +37,7 @@
 				if (this.type === 'exhibitor')  {
 					this.navigateTo(link('/' + item.urla))
 				} else {
-					this.navigateTo('https://www.productronicachina.com.cn/2025%E6%85%95%E5%B0%BC%E9%BB%91%E4%B8%8A%E6%B5%B7%E7%94%B5%E5%AD%90%E7%94%9F%E4%BA%A7%E8%AE%BE%E5%A4%87%E5%B1%953%E6%9C%88%E5%A5%8F%E5%93%8D%E6%96%B0%E7%AF%87%E7%AB%A0-%E6%8E%A2%E7%B4%A2%E7%94%B5%E5%AD%90%E5%88%B6%E9%80%A0%E7%9A%84%E6%97%A0%E9%99%90%E5%8F%AF%E8%83%BD')
+					this.navigateTo(this.websiteUrl + '/' + item.urla)
 				}
 			}
 		}

+ 68 - 5
pages/news/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="news-index">
 		<nav-bar title="新闻" @init="onInitNavbar"></nav-bar>
-		<u-scroll-view :tabbar-conflict="false">
+		<u-scroll-view :tabbar-conflict="false" @scroll-near-lower="onScrollToLower">
 			<view class="main-container">
 				<u-tabs :active.sync="tabActive" :tabs="tabs" tab-style="default" @change="tabChange"/>
 				<van-empty v-if="newsList.length === 0" description="暂无数据" />
@@ -20,6 +20,7 @@
 	import UTabs from '@/components/common/u-tabs'
 	import UScrollView from '@/components/common/u-scroll-view'
 	import NewsItem from '@/pages/news/components/news-item.vue'
+	import { exhibitorsNewsList, newsList } from '@/api/exhibitor'
 	
 	export default {
 		options: {
@@ -41,18 +42,80 @@
 					label: '展商新闻',
 					value: 'exhibitor'
 				}],
-				newsList: [{}, {}, {}, {}, {}, {}]
+				newsList: [],
+				newsParams: {
+					page: 1,
+					page_size: 10,
+					keyword: '',
+				},
+				newsListLoading: false,
+				newsListLastPage: 1,
 			}
 		},
 		onLoad(options) {
 			if (options.type) {
 				this.tabActive = options.type
 			}
+			this.getList()
+		},
+		created() {
 		},
-		created() {},
 		methods: {
-			tabChange() {
-				
+			getList() {
+				if (this.tabActive === 'exhibitor') {
+					this.getExhibitorsNewsList()
+				}
+				if (this.tabActive === 'exhibition') {
+					this.getNewsList()
+				}
+			},
+			getNewsList() {
+				this.newsListLoading = true
+				newsList(this.newsParams).then(res => {
+					if (res.data.data) {
+						if (this.newsParams.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
+				})
+			},
+			getExhibitorsNewsList() {
+				this.newsListLoading = true
+				exhibitorsNewsList(this.newsParams).then(res => {
+					if (res.data.data) {
+						if (this.newsParams.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
+				})
+			},
+			onScrollToLower(e) {
+				if (this.newsListLastPage === this.newsParams.page) {
+					return
+				}
+				if (this.newsListLoading === true) {
+					return
+				}
+				this.newsListLoading = true
+				this.newsParams.page = this.newsParams.page+1
+				this.getList()
+			},
+			tabChange(e) {
+				this.tabActive = e.detail.value
+				this.newsParams.page = 1
+				this.getList()
 			}
 		}
 	}