Prechádzať zdrojové kódy

fix: 首页和全部活动搜索框改为输入后点搜索才跳转/过滤

Developer 1 týždeň pred
rodič
commit
8ada5ca504
2 zmenil súbory, kde vykonal 12 pridanie a 18 odobranie
  1. 5 4
      pages/home.vue
  2. 7 14
      pagesHome/allActivity.vue

+ 5 - 4
pages/home.vue

@@ -9,8 +9,8 @@
 		</up-navbar>
 		<image src="https://oss.familydaf.cn/sxsnfile/20251218/ee40161fef4647f0b736d118e554dc2f.png" class="top_bg_img" mode="widthFix"></image>
 		<view class="c-box adffc">
-				<view class="c-box-search" @click="toSearch">
-				<cus-search></cus-search>
+				<view class="c-box-search">
+				<cus-search @handleSearch="toSearch"></cus-search>
 			</view>
 			<view class="c-box-lunbo">
 				<up-swiper
@@ -129,8 +129,9 @@
 		userId:''
 	})
 	
-	const toSearch = () => {
-		uni.navigateTo({ url: '/pagesHome/searchActivity?from=home' })
+	const toSearch = (keyword) => {
+		if (!keyword) return
+		uni.navigateTo({ url: '/pagesHome/allActivity?keyword=' + encodeURIComponent(keyword) })
 	}
 
 	const bannerClick = e => {

+ 7 - 14
pagesHome/allActivity.vue

@@ -2,8 +2,8 @@
 	<view class="common_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
 		<cus-header title="全部活动" bgColor="transparent"></cus-header>
 		<image src="https://oss.familydaf.cn/sxsnfile/20251218/c41452a8b9ae40629c6505b0c4fdcf64.png" class="top_bg_img" mode="widthFix"></image>
-		<view class="top-search" @click="toSearch">
-			<cus-search ref="searchRef"></cus-search>
+		<view class="top-search">
+			<cus-search ref="searchRef" @handleSearch="doSearch"></cus-search>
 		</view>
 		<view class="type adfacjb">
 			<view class="type-list">
@@ -145,18 +145,11 @@
 		}
 	})
 	
-	const toSearch = () => {
-		uni.navigateTo({
-			url:'/pagesHome/searchActivity',
-			events:{
-				confirmSearch: data => {
-					initList();
-					proxy.$refs.searchRef.keyword = data;
-					queryParams.value.activityName = data;
-					getActivityList()
-				}
-			}
-		})
+	const doSearch = (keyword) => {
+		if (!keyword) return
+		initList()
+		queryParams.value.activityName = keyword
+		getActivityList()
 	}
 	const initList = () => {
 		queryParams.value.page = 1;