| 
									
										
										
										
											2025-09-12 17:23:03 +08:00
										 |  |  | <template> | 
					
						
							|  |  |  | 	<view class="tabbar-list"> | 
					
						
							|  |  |  | 		<view class="tabbar-item" :class="currentBg==1?'tabbar-item-active':''" @click="chanRoute(1)"> | 
					
						
							|  |  |  | 			<image :src="currentBg==1?`/static/tabbar/1-active.png`:`/static/tabbar/1.png`" alt="消息" | 
					
						
							|  |  |  | 				:class="currentBg==1?'item-image-active':'item-image'" /> | 
					
						
							| 
									
										
										
										
											2025-09-15 11:34:07 +08:00
										 |  |  | 			<div class="item-text"><span>消息</span></div> | 
					
						
							| 
									
										
										
										
											2025-09-12 17:23:03 +08:00
										 |  |  | 		</view> | 
					
						
							|  |  |  | 		<view class="tabbar-item" :class="currentBg==2?'tabbar-item-active':''" @click="chanRoute(2)"> | 
					
						
							|  |  |  | 			<image :src="currentBg==2?`/static/tabbar/2-active.png`:`/static/tabbar/2.png`" alt="项目" | 
					
						
							|  |  |  | 				:class="currentBg==2?'item-image-active':'item-image'" /> | 
					
						
							|  |  |  | 			<div class="item-text"><span>项目</span></div> | 
					
						
							|  |  |  | 		</view> | 
					
						
							|  |  |  | 		<view class="tabbar-item" :class="currentBg==3?'tabbar-item-active':''" @click="chanRoute(3)"> | 
					
						
							|  |  |  | 			<image :src="currentBg==3?`/static/tabbar/3-active.png`:`/static/tabbar/3.png`" alt="主页" | 
					
						
							|  |  |  | 				:class="currentBg==3?'item-image-active':'item-image'" /> | 
					
						
							|  |  |  | 			<div class="item-text"><span>主页</span></div> | 
					
						
							|  |  |  | 		</view> | 
					
						
							|  |  |  | 		<view class="tabbar-item" :class="currentBg==4?'tabbar-item-active':''" @click="chanRoute(4)"> | 
					
						
							|  |  |  | 			<image :src="currentBg==4?`/static/tabbar/4-active.png`:`/static/tabbar/4.png`" alt="金融" | 
					
						
							|  |  |  | 				:class="currentBg==4?'item-image-active':'item-image'" /> | 
					
						
							|  |  |  | 			<div class="item-text"><span>金融</span></div> | 
					
						
							|  |  |  | 		</view> | 
					
						
							|  |  |  | 		<view class="tabbar-item" :class="currentBg==5?'tabbar-item-active':''" @click="chanRoute(5)"> | 
					
						
							|  |  |  | 			<image :src="currentBg==5?`/static/tabbar/5-active.png`:`/static/tabbar/5.png`" alt="我的" | 
					
						
							|  |  |  | 				:class="currentBg==5?'item-image-active':'item-image'" /> | 
					
						
							|  |  |  | 			<div class="item-text"><span>我的</span></div> | 
					
						
							|  |  |  | 		</view> | 
					
						
							|  |  |  | 	</view> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts" setup> | 
					
						
							| 
									
										
										
										
											2025-09-15 11:34:07 +08:00
										 |  |  | 	import { ref, reactive, onMounted } from 'vue'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-12 17:23:03 +08:00
										 |  |  | 	// 图片列表
 | 
					
						
							| 
									
										
										
										
											2025-09-15 11:34:07 +08:00
										 |  |  | 	const currentBg = ref(3); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	onMounted(() => { | 
					
						
							|  |  |  | 		uni.hideTabBar() | 
					
						
							|  |  |  | 		const pages = getCurrentPages() | 
					
						
							|  |  |  | 		if (pages.length) { | 
					
						
							|  |  |  | 			const currentPage = pages[pages.length - 1]; | 
					
						
							|  |  |  | 			const route = currentPage.route; | 
					
						
							|  |  |  | 			switch (route) { | 
					
						
							|  |  |  | 				case 'pages/message/message': | 
					
						
							|  |  |  | 					currentBg.value = 1; | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				case 'pages/program/program': | 
					
						
							|  |  |  | 					currentBg.value = 2; | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				case 'pages/home/index': | 
					
						
							|  |  |  | 					currentBg.value = 3; | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				case 'pages/finance/finance': | 
					
						
							|  |  |  | 					currentBg.value = 4; | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				case 'pages/my/my': | 
					
						
							|  |  |  | 					currentBg.value = 5; | 
					
						
							|  |  |  | 					break; | 
					
						
							|  |  |  | 				default: | 
					
						
							|  |  |  | 					currentBg.value = 3; // 默认主页
 | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}) | 
					
						
							| 
									
										
										
										
											2025-09-12 17:23:03 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	const chanRoute = (val : number) => { | 
					
						
							| 
									
										
										
										
											2025-09-15 11:34:07 +08:00
										 |  |  | 		if (val == currentBg.value) { | 
					
						
							|  |  |  | 			return | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (val == 1) { | 
					
						
							|  |  |  | 			uni.switchTab({ | 
					
						
							|  |  |  | 				url: '/pages/message/message' | 
					
						
							|  |  |  | 			}) | 
					
						
							|  |  |  | 		} else if (val == 2) { | 
					
						
							|  |  |  | 			uni.switchTab({ | 
					
						
							|  |  |  | 				url: '/pages/program/program' | 
					
						
							|  |  |  | 			}) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		else if (val == 3) { | 
					
						
							|  |  |  | 			uni.switchTab({ | 
					
						
							|  |  |  | 				url: '/pages/home/index' | 
					
						
							|  |  |  | 			}) | 
					
						
							|  |  |  | 		} else if (val == 4) { | 
					
						
							|  |  |  | 			uni.switchTab({ | 
					
						
							|  |  |  | 				url: '/pages/finance/finance' | 
					
						
							|  |  |  | 			}) | 
					
						
							|  |  |  | 		} else if (val == 5) { | 
					
						
							|  |  |  | 			uni.switchTab({ | 
					
						
							|  |  |  | 				url: '/pages/my/my' | 
					
						
							|  |  |  | 			}) | 
					
						
							| 
									
										
										
										
											2025-09-12 17:23:03 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style lang="scss" scoped> | 
					
						
							|  |  |  | 	.tabbar-list { | 
					
						
							|  |  |  | 		position: fixed; | 
					
						
							|  |  |  | 		bottom: 0; | 
					
						
							|  |  |  | 		left: 0; | 
					
						
							|  |  |  | 		right: 0; | 
					
						
							|  |  |  | 		background-size: cover; | 
					
						
							|  |  |  | 		background-position: center; | 
					
						
							|  |  |  | 		background-repeat: no-repeat; | 
					
						
							|  |  |  | 		display: flex; | 
					
						
							|  |  |  | 		justify-content: space-around; | 
					
						
							|  |  |  | 		align-items: center; | 
					
						
							|  |  |  | 		z-index: 1000; | 
					
						
							|  |  |  | 		padding-bottom: env(safe-area-inset-bottom); | 
					
						
							|  |  |  | 		height: 140rpx; | 
					
						
							|  |  |  | 		background-size: 100% 100%; | 
					
						
							|  |  |  | 		padding: 10rpx 0; | 
					
						
							|  |  |  | 		background-color: #4873ff; | 
					
						
							| 
									
										
										
										
											2025-09-16 17:57:04 +08:00
										 |  |  | 		border-top-left-radius: 20rpx; | 
					
						
							|  |  |  | 		border-top-right-radius: 20rpx; | 
					
						
							| 
									
										
										
										
											2025-09-12 17:23:03 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.tabbar-item { | 
					
						
							|  |  |  | 			display: flex; | 
					
						
							|  |  |  | 			width: 20%; | 
					
						
							|  |  |  | 			height: 100%; | 
					
						
							|  |  |  | 			position: relative; | 
					
						
							|  |  |  | 			flex-direction: column; | 
					
						
							|  |  |  | 			align-items: center; | 
					
						
							|  |  |  | 			justify-content: space-between; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			.item-image { | 
					
						
							|  |  |  | 				width: 100rpx; | 
					
						
							|  |  |  | 				height: 100rpx; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			.item-image-active { | 
					
						
							|  |  |  | 				width: 120rpx; | 
					
						
							|  |  |  | 				height: 130rpx; | 
					
						
							|  |  |  | 				border-radius: 50%; | 
					
						
							|  |  |  | 				padding: 10rpx; | 
					
						
							|  |  |  | 				background-color: #4873ff; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			.item-text { | 
					
						
							|  |  |  | 				text-wrap: nowrap; | 
					
						
							|  |  |  | 				font-size: 25rpx; | 
					
						
							|  |  |  | 				font-weight: 700; | 
					
						
							|  |  |  | 				color: white; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		.tabbar-item-active { | 
					
						
							|  |  |  | 			height: 150rpx; | 
					
						
							|  |  |  | 			transform: translateY(-50rpx); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | </style> |