浏览代码

代码封装

luxf 1 周之前
父节点
当前提交
e46b5e0c7b

+ 1 - 7
components/common/u-swiper/index.vue

@@ -132,14 +132,8 @@
 					if (item.url.indexOf('.mp4') !== -1) {
 						this.videoUrl = item.url
 						this.showOverlay = true
-					} else if (item.url.indexOf('http') === -1) {
-						uni.navigateTo({
-							url: item.url
-						})
 					} else {
-						uni.navigateTo({
-							url: '/pages/index/webview?url=' + item.url
-						})
+						this.navigateTo(item.url)
 					}
 				}
 			}

+ 1 - 0
components/layout/nav-bar.vue

@@ -141,6 +141,7 @@
 		}
 		.btn-back{
 			padding: 0 6rpx;
+			cursor: pointer;
 		}
 	}
 </style>

+ 3 - 3
main.js

@@ -35,12 +35,12 @@ Vue.prototype.redirectTo = function(pagePath) {
 	}
 }
 Vue.prototype.navigateTo = function(pagePath) {
-	if (pagePath.indexOf('https') === -1) {
+	if (pagePath.indexOf('http') === 0) {
+		this.webviewTo(pagePath)
+	} else {
 		uni.navigateTo({
 			url: pagePath
 		})
-	} else {
-		this.webviewTo(pagePath)
 	}
 }
 Vue.prototype.webviewTo = function(url) {

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

@@ -46,9 +46,7 @@
 		},
 		methods: {
 			onClickActivity(item){
-				uni.navigateTo({
-					url: '/pages/activity/detail'
-				})
+				this.navigateTo('/pages/activity/detail')
 			}
 		}
 	}

+ 1 - 3
pages/activity/detail.vue

@@ -158,9 +158,7 @@
 		},
 		methods: {
 			onClickGuestLink() {
-				uni.navigateTo({
-					url: '/pages/activity/guest'
-				})
+				this.navigateTo('/pages/activity/guest')
 			}
 		}
 	}

+ 1 - 3
pages/exhibitor/components/exhibit-item.vue

@@ -76,9 +76,7 @@
 				})
 			},
 			onClickExhibit(item) {
-				uni.navigateTo({
-					url: '/pages/exhibitor/exhibit-detail'
-				})
+				this.navigateTo('/pages/exhibitor/exhibit-detail')
 			}
 		}
 	}

+ 14 - 2
pages/exhibitor/components/exhibit-recommend.vue

@@ -1,8 +1,8 @@
 <template>
 	<view class="exhibit-recommend">
 		<view class="exhibit-list">
-			<template v-for="(item, index) in [1, 2, 3, 4]">
-				<view class="exhibit-item" hover-class="active" :key="index" @click="onClickExhibit(item)">
+			<template v-for="(item, index) in [1, 2, 3, 4, 5, 6, 7, 8]">
+				<view v-if="index < limit" class="exhibit-item" hover-class="active" :key="index" @click="onClickExhibit(item)">
 					<view class="exhibit-image">
 						<image src="https://oss.starify.cn/prod/starify/up/0001000075/20241113/67343f1c494de.png?x-oss-process=image/resize,w_400" mode="aspectFit"/>
 					</view>
@@ -22,8 +22,20 @@
 		},
 		components: {
 		},
+		props: {
+			limit: Number
+		},
+		watch: {
+			limit(val) {
+				console.log("limit")
+				if (val === 8) {
+					this.$emit('show-all')
+				}
+			}
+		},
 		data() {
 			return {
+				
 			}
 		},
 		created() {

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

@@ -73,9 +73,7 @@
 				})
 			},
 			onClickExhibitor() {
-				uni.navigateTo({
-					url: '/pages/exhibitor/detail'
-				})
+				this.navigateTo('/pages/exhibitor/detail')
 			}
 		}
 	}

+ 4 - 2
pages/exhibitor/detail.vue

@@ -77,8 +77,8 @@
 					</view>
 				</view>
 				<u-panel title="展品资料">
-					<exhibit-recommend />
-					<view class="click-more"><van-button type="primary" @click="navigateTo('/pages/exhibitor/exhibit')">点击展开更多展品</van-button></view>
+					<exhibit-recommend :limit="exhibitRecommendLimit" @show-all="showExhibitMore = false"/>
+					<view v-if="showExhibitMore" class="click-more"><van-button type="primary" @click="exhibitRecommendLimit = 8">点击展开更多展品</van-button></view>
 				</u-panel>
 				<u-panel title="展商新闻">
 					<news-recommend recommend-type="detail" />
@@ -119,8 +119,10 @@
 		},
 		data() {
 			return {
+				showExhibitMore: true,
 				showShare: false,
 				shareInfo: null,
+				exhibitRecommendLimit: 4,
 				exhibitor: {
 					favourited: true,
 					liked: false,

+ 1 - 3
pages/news/components/news-recommend.vue

@@ -46,9 +46,7 @@
 				
 			},
 			onClickDetail(item) {
-				uni.navigateTo({
-					url: '/pages/index/webview?url=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('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')
 			}
 		}
 	}

+ 2 - 14
pages/user/index.vue

@@ -103,22 +103,10 @@
 		}, 
 		methods: {
 			onClickSetting() {
-				if (!this.isLoginState) {
-					uni.navigateTo({
-						url: '/pages/user/login'
-					})
-				} else {
-					uni.navigateTo({
-						url: '/pages/user/setting'
-					})
-				}
+				this.navigateTo('/pages/user/setting')
 			},
 			onClickUserInfo(){
-				if (!this.isLoginState) {
-					uni.navigateTo({
-						url: '/pages/user/login'
-					})
-				}
+				this.navigateTo('/pages/user/info')
 			}
 		}
 	}