| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 | <template>	<view class="common_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">		<cus-header title="全部活动" bgColor="transparent"></cus-header>		<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/54b75bc8-d926-449b-95a5-1126f700b481.png" class="top_bg_img" mode="widthFix"></image>		<div class="top-search" @tap="toSearch">			<cus-search></cus-search>		</div>		<div class="type adfacjb">			<div class="type-list">				<scroll-view class="scroll-view_H" scroll-x="true" scroll-with-animation="true" :scroll-left="scrollLeft">					<view class="scroll-view-item_H" :id="'svih_'+index" v-for="(item,index) in typeList" :key="index" @tap="changeType(item,index)">						<view class="cl_item" :class="{'active':typeIndex===index}">							<text>{{item.name}}</text>						</view>					</view>				</scroll-view>			</div>			<div class="type-all" :class="{'active':typeIndex===''}" @tap="handleAll">全部</div>		</div>		<div class="filter adfac" id="filter">			<div class="filter-pre adfac" @tap="showTime">				<text>{{time}}</text>				<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/1813f2d7-42e9-4c5d-9d05-924e30568f9e.png"></image>			</div>			<div class="filter-pre adfac" @tap="placeShow=true;timeShow=false;allShow=false">				<text>{{place}}</text>				<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/1813f2d7-42e9-4c5d-9d05-924e30568f9e.png"></image>			</div>			<!-- <div class="filter-pre adfac">				<text>{{status}}</text>				<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/1813f2d7-42e9-4c5d-9d05-924e30568f9e.png"></image>			</div> -->		</div>		<div class="list" id="list">			<up-list @scrolltolower="scrolltolower" style="height: 100%;">				<up-list-item v-for="(item, index) in list" :key="index">					<NonprofitActivety></NonprofitActivety>				</up-list-item>			</up-list>		</div>		<div class="window" :style="{'top':top+'px','height':'calc(100vh - '+top+'px)'}" v-if="timeShow">			<div class="window-time">				<div class="top adfac">					<div class="top-pre" :class="{'active':wtIndex===0}" @tap="changeWindowTime(0,'全部时间')">全部时间</div>					<div class="top-pre" :class="{'active':wtIndex===1}" @tap="changeWindowTime(1,'一周内')">一周内</div>					<div class="top-pre" :class="{'active':wtIndex===2}" @tap="changeWindowTime(2,'一月内')">一月内</div>					<div class="top-pre" :class="{'active':wtIndex===3}" @tap="changeWindowTime(3,'本周末')">本周末</div>				</div>				<div class="middle">					<ActivityCalendar ref="acRef"></ActivityCalendar>				</div>				<div class="bottom adfacjb">					<div class="reset" @tap="changeWindowTime(0,'全部时间')">重置</div>					<div class="confirm" @tap="timeConfirm">确定</div>				</div>			</div>		</div>		<div class="window" :style="{'top':top+'px','height':'calc(100vh - '+top+'px)'}" v-if="placeShow">			<div class="window-place">				<ActivityArea @confirm="areaConfirm"></ActivityArea>			</div>		</div>		<div class="window" :style="{'top':topAll+'px','height':'calc(100vh - '+topAll+'px)'}" v-if="allShow">			<div class="window-all">				<div class="pre" v-for="(t,i) in typeList2" :key="i" @tap="changeType2(t.name,i)">{{t.name}}</div>			</div>		</div>	</view></template><script setup name="">	import CusHeader from '@/components/CusHeader/index.vue'	import CusSearch from '@/components/CusSearch/index.vue'	import NonprofitActivety from '@/components/pages/nonprofitActivety/index.vue'	import ActivityCalendar from '@/components/pages/activityCalendar/index.vue'	import ActivityArea from '@/components/pages/activityArea/index.vue'	import { ref, onMounted, nextTick } from 'vue'		const typeIndex = ref('')	const typeList = ref([		{id:1,name:'儿童关爱'},		{id:2,name:'老人关爱'},		{id:3,name:'社区发展'},		{id:4,name:'社会服务'},		{id:5,name:'健康行动'},		{id:6,name:'减肥运动'}	])	const typeList2 = ref([])	const scrollLeft = ref(0)	const time = ref('全部时间')	const timeText = ref('')	const place = ref('全部地区')	const status = ref('活动状态')	const queryParams = ref({})	const list = ref([1,1,1,1])	const top = ref(0)	const topAll = ref(0)	const timeShow = ref(false)	const placeShow = ref(false)	const allShow = ref(false)	const wtIndex = ref(0)	const acRef = ref(null)		const toSearch = () => {		uni.navigateTo({			url:'/pagesHome/searchActivity',			events:{				confirmSearch: data => {					console.log(data,'data');				}			}		})	}		const changeType = (item,index) => {		typeIndex.value = index;		if(typeList.value.length>4){			if(index<3) scrollLeft.value = 0			else{				scrollLeft.value = (index-2)*154/2;			}		}		allShow.value = false;	}	const changeType2 = (item,index) => {		if(item==='全部'){			typeIndex.value = '';			scrollLeft.value = 0;		}else{			index--;			typeIndex.value = index;			if(typeList.value.length>4){				if(index<3) scrollLeft.value = 0				else{					scrollLeft.value = (index-2)*154/2;				}			}		}		allShow.value = false;	}		const handleAll = () => {		// typeIndex.value = '';		// scrollLeft.value = 0;		timeShow.value = false;		placeShow.value = false;				typeList2.value = [{id:'',name:'全部'}].concat(typeList.value);		allShow.value = true;	}		const changeWindowTime = (wtindex,text) => {		wtIndex.value = wtindex;		timeText.value = text;		acRef.value.setStartEndDay(wtindex);	}		const showTime = () => {		timeShow.value = true;		setTimeout(()=>{			acRef.value.setStartEndDay(wtIndex.value);		},100)	}	const timeConfirm = () => {		time.value = timeText.value;		timeShow.value = false;	}		const areaConfirm = (data) => {		place.value = data.city+'-'+data.area;		placeShow.value = false;	}		const scrolltolower = () => {		console.log(1);	}		const getTop = () => {		let query = uni.createSelectorQuery();		query.select('#list').boundingClientRect(rect=>{			if(rect){				top.value = (rect?.top+20)||0;//20是上间距			}		}).exec()		query.select('#filter').boundingClientRect(rect=>{			if(rect){				topAll.value = rect?.top||0;			}		}).exec()	}	onMounted(()=>{		nextTick(()=>{			getTop();		})	})</script><style scoped lang="scss">	.scroll-view_H {		white-space: nowrap;		width: 100%;	}		.scroll-view-item_H {		display: inline-block;		height: 50rpx;		margin-left: 42rpx;		&:first-child{			margin-left: 0;		}	}		.common_page{		.top-search{			position: relative;			margin-top: 20rpx;		}				.type{			margin-top: 40rpx;			width: 100%;			height: 50rpx;			position: relative;			&-list{				width: calc(100% - 72rpx);				padding-right: 40rpx;				box-sizing: border-box;				.cl_item{					width: 112rpx;					line-height: 50rpx;					font-family: PingFangSC, PingFang SC;					font-weight: 400;					font-size: 30rpx;					color: #676775;					&.active{						font-weight: bold;						font-size: 36rpx;						color: #252525;						line-height: 50rpx;					}				}			}			&-all{				width: 72rpx;				font-family: PingFangSC, PingFang SC;				font-weight: 400;				font-size: 28rpx;				color: #676775;				line-height: 40rpx;				position: relative;				&.active{					font-weight: bold;					font-size: 36rpx;					color: #252525;					line-height: 50rpx;					&::after{						content: '';						width: 40rpx;						height: 8rpx;						background: linear-gradient( 270deg, #B7F358 0%, #00AE57 100%);						border-radius: 4rpx;						position: absolute;						left: 50%;						margin-left: -20rpx;						bottom: -10rpx;					}				}			}		}			.filter{			margin-top: 33rpx;			position: relative;			&-pre{				width: 186rpx;				text{					font-family: PingFang-SC, PingFang-SC;					font-weight: bold;					font-size: 24rpx;					color: #252525;					line-height: 33rpx;				}				image{					width: 24rpx;					height: 24rpx;					margin-left: 6rpx;				}			}		}			.list{			flex: 1;			padding: 20rpx 0;			box-sizing: border-box;			overflow-y: auto;		}	}		.window{		width: 100%;		position: fixed;		left: 0;		right: 0;		background: rgba(0, 0, 0, .4);				&-time{			background: #FFFFFF;			border-radius: 0 0 24rpx 24rpx;			.top{				padding: 32rpx 30rpx;				&-pre{					padding: 10rpx 24rpx;					background: #F5F6F8;					border-radius: 27rpx;					font-family: PingFangSC, PingFang SC;					font-weight: 400;					font-size: 24rpx;					color: #252525;					line-height: 33rpx;					margin-left: 20rpx;					&:first-child{						margin-left: 0;					}					&.active{						background: #B7F358;						font-weight: bold;					}				}			}			.middle{				height: 594rpx;				background: #F7F7F7;			}			.bottom{				padding: 24rpx 24rpx 36rpx;				.reset{					width: 222rpx;					height: 80rpx;					border-radius: 45rpx;					border: 1rpx solid #252525;					font-family: PingFang-SC, PingFang-SC;					font-weight: bold;					font-size: 28rpx;					color: #252525;					line-height: 80rpx;					text-align: center;					letter-spacing: 2rpx;				}				.confirm{					width: calc(100% - 252rpx);					height: 80rpx;					background: #B7F358;					border-radius: 45rpx;					font-family: PingFang-SC, PingFang-SC;					font-weight: bold;					font-size: 28rpx;					color: #252525;					line-height: 80rpx;					text-align: center;				}			}		}			&-all{			padding: 26rpx 30rpx 103rpx;			background: #FFFFFF;			display: flex;			flex-wrap: wrap;			justify-content: space-between;			.pre{				width: calc(100% / 3 - 12rpx);				height: 59rpx;				background: #F7F7F7;				border-radius: 30rpx;				font-family: PingFangSC, PingFang SC;				font-weight: 400;				font-size: 24rpx;				color: #252525;				line-height: 59rpx;				text-align: center;				margin-top: 24rpx;			}		}	}</style>
 |