uniapp小程序砸金蛋抽奖

砸之前是金蛋png图片,点击砸完之后切换砸金蛋动效gif图片;

当前代码封装为砸金蛋的组件;

vue代码: 





scss代码:


.page{
	width: 750rpx;
	height: 100vh;
	position: relative;
}

.bg{
	width: 750rpx;
	height: 100vh;
}

.content{
	width: 750rpx;
	min-height: 100vh;
	height: 1448rpx;
	position: absolute;
	top: 0;
	left: 0;
}


.logo{
	height: 60rpx;
	display: flex;
	justify-content: center;
	margin-top: 90rpx;
	
	image{
		height: 60rpx;
	}
}

.title{
	height: 194rpx;
	display: flex;
	justify-content: center;
	margin-top: 20rpx;
	
	image{
		height: 194rpx;
	}
}

.notification{
	margin-top: 170rpx;
	
	height: 40rpx;
	display: flex;
	justify-content: center;
	align-items: center;
	
	image{
		height: 32rpx;
		margin-right: 16rpx;
	}
	text{
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
	}
}


.box{
	width: 680rpx;
	height: 360rpx;
	margin: 0 auto;
	margin-top: 160rpx;
	
	.egg {
		width: 220rpx;
		height: 300rpx;
		margin-top: 80rpx;
	}
		
	.egg:first-of-type{
		margin-left: 20rpx;
	}
	
	.count{
		display: flex;
		justify-content: center;
		margin-top: 14rpx;
		position: relative;
		
		image{
			width: 424rpx;
			height: 108rpx;
		}
		
		.tip{
			position: absolute;
			top: 50%;
			transform: translateY(-50%);
			font-size: 28rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			text{
				color: #FF9611;
			}
		} 
	}
	
	.btns{
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 58rpx;
	}
	
	.btn{
		width: 292rpx;
		height: 116rpx;
		position: relative;
		image{
			width: 100%;
			height: 100%;
		}
		text{
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%,-50%);
			font-size: 36rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
		}
	}
	
}

.win{
	width: 750rpx;
	height: 100vh;
	background: rgba(0, 0, 0, 0.8);
	position: fixed;
	top: 0;
	left: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.win_box{
	width: 662rpx;
	height: 60%;
	padding: 40rpx;
	box-sizing: border-box;
	border-radius: 24rpx;
}

.win_box_bg{
	background: #FFCE2B;
}

.bg3{
	background: #C3E5FE;
}

.iconcolseIcon{
	font-size: 58rpx;
	margin-top: 98rpx;
}

.win_box1{
	width: 630rpx;
	height: 922rpx;
	position: relative;
}

.win_bg{
	width: 630rpx;
	height: 922rpx;
}

.win_content{
	width: 630rpx;
	height: 922rpx;
	position: absolute;
	left: 0;
	top: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.win_tips{
	font-size: 48rpx;
	font-family: SourceHanSansSC-Medium, SourceHanSansSC;
	font-weight: bold;
	margin-top: 290rpx;
}

.win_title{
	font-size: 48rpx;
	font-family: SourceHanSansSC-Medium, SourceHanSansSC;
	font-weight: bold;
	color: #FE6631;
	margin: 170rpx 0;
}

.win_btn{
	width: 280rpx;
	height: 80rpx;
	line-height: 80rpx;
	text-align: center;
	background: #FFE047;
	border-radius: 46rpx;
	font-size: 32rpx;
	font-family: SourceHanSansSC-Medium, SourceHanSansSC;
	font-weight: bold;
	color: #13112C;
}

.win_tit{
	font-size: 48rpx;
	font-family: SourceHanSansSC-Medium, SourceHanSansSC;
	font-weight: bold;
	margin-bottom: 32rpx;
}

.win_box2{
	width: 662rpx;
	height: 900rpx;
	background: #FFFFFF;
	border-radius: 24rpx;
	display: flex;
	flex-direction: column;
}

.items{
	width: 662rpx;
	height: 108rpx;
	background: #C3E5FE;
	border-radius: 24rpx 24rpx 0rpx 0rpx;
	display: flex;
	align-items: center;
	flex-shrink:0
}

.left,.right{
	width: 50%;
	text-align: center;
	font-family: SourceHanSansSC-Medium, SourceHanSansSC;
	font-weight: bold;
}

.i_title{
	font-size: 36rpx;
}

.list{
	height: 792rpx;
	padding-bottom: 20rpx;
	overflow: hidden;
}

.item{
	width: 662rpx;
	height: 88rpx;
	display: flex;
	align-items: center;
	justify-content: space-around;
}

.item:nth-child(2n){
	background-color: #F4F4F4;
}

.r_btn{
	width: 160rpx;
	height: 60rpx;
	line-height: 60rpx;
	text-align: center;
	background: #FFC659;
	border-radius: 46rpx;
	font-family: SourceHanSansSC-Medium, SourceHanSansSC;
	font-weight: bold;
	font-size: 32rpx;
	margin:0 auto;
}

效果:

uniapp小程序砸金蛋抽奖_第1张图片

你可能感兴趣的:(uni-app,小程序)