Botton.vue 2.7 KB
<template>
	<view class="">
		<view class="btnBottom">
			<view class="btn" :class="{onbtn:flag==1}" @click="choosebtn">
				<image class="img1" src="~@../../static/ic-tabbar-home-s.png" mode="" v-if="flag==1">
				</image>
				<image class="img1" src="~@../../static/ic-tabbar-home-n.png" mode="" v-else></image>
				<text>首页</text>
			</view>
			<view class="newbtn" @click="chooseAdd">
				<view class="add">
					<image src="~@../../static/ic-release.png" mode=""></image>
				</view>
			</view>
			<view class="btn" :class="{onbtn:flag==2}" @click="choosemy">
				<image class="img1" src="~@../../static/ic-tabbar-my-s.png" mode="" v-if="flag==2">
				</image>
				<image class="img1" src="~@../../static/ic-tabbar-my-n.png" mode="" v-else></image>
				<text>我的</text>
			</view>
		</view>
		<u-modal :show="showLogin" :showCancelButton="true" @confirm="goLogin" @cancel="showLogin=false" content='你还未登录,是否前去登录'></u-modal>
	</view>
</template>

<script>
	export default {
		name: "Botton",
		props: ["flag"],
		data() {
			return {
				showLogin:false
			};
		},
		created() {
		},
		methods: {
			choosebtn() {
				uni.redirectTo({
					url: "/pages/index/index"
				})
			},
			choosemy() {
				uni.redirectTo({
					url: "/pages/mine/mine"
				})
			},
			chooseAdd(){
				let token = uni.getStorageSync('token')
				console.log(token);
				if(!token) return this.showLogin = true
				uni.navigateTo({
					url: "/pages/index/send"
				})
			},
			goLogin(){
				uni.navigateTo({
					url:'/pages/login/login'
				})
			}
		}
	}
</script>

<style lang="scss">
	.btnBottom {
		position: fixed;
		bottom: 0;
		width: 100%;
		padding: 12rpx 82rpx;
		background-color: #ffffff;
		display: flex;
		align-items: flex-end;
		box-sizing: border-box;
		justify-content: space-between;

		.btn {
			display: flex;
			flex-direction: column;
			align-items: center;
			color: rgba(0, 0, 0, 0.4);
			font-size: 20rpx;
			font-weight: 400;
			font-family: "PingFang SC";

			.img1 {
				width: 48rpx;
				height: 48rpx;
			}
		}

		.onbtn {

			color: rgba(0, 0, 0, 0.9);
			font-size: 20rpx;
			font-weight: 600;
		}

		.newbtn {
			width: 132rpx;
			height: 132rpx;
			border-radius: 66rpx;
			position: absolute;
			top: 0;
			left: 50%;
			transform: translate(-50%, -30%);
			background-color: #ffffff;

			.add {
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translate(-50%, -50%);
				width: 112rpx;
				height: 112rpx;
				border-radius: 56rpx;
				opacity: 1;

				image {
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
					width: 56rpx;
					height: 56rpx;
				}

				background: rgba(254, 208, 0, 1);
			}
		}
	}
</style>