<template>
	<view class="custom-warn" :class="showWarn && delayHide ? 'bg-in' : 'bg-out'">
		
		<view class="custom-warn-dialog" :class="showWarn && delayHide ? 'dialog-in' : 'dialog-out'">
			<text class="close cuIcon-close" @tap="close"></text>
			<image class="top" src="../static/card/warn.png" mode=""></image>
			<view class="mid">
				<view class="title">违规处罚通知</view>
				<view class="text">用户&nbsp;<text style="color: #fa6342;">{{ nameList[Math.floor(Math.random() * 10)] }}</text>&nbsp;因私自盗用他人图片上传，严重影响争霸赛比赛秩序。现决定取消其参赛资格，且押金不予退还。</view>
			</view>
			<button hover-class="hover" class="bot" @tap="close">我知道了</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				delayHide: true,  //开始 淡出 动画
				nameList: [
					'安稳随心',
					'夕颜若雪',
					'念之森蓝',
					'莫离ジ莫弃',
					'青墨断笺',
					'簡簡單單',
					'阡南陌北',
					'始終如1',
					'浅夏初雨',
					'一鹿有晗'
				]
			}
		},
		computed: {
			showWarn () {  //手机验证弹框显示状态
				return this.$store.state.showWarn
			}
		},
		methods: {
			close () {  //关闭手机验证弹窗
				this.delayHide = false
				setTimeout(e => {
					this.$store.commit('HIDEWARN')
					this.delayHide = true
				}, 100)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.custom-warn {
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		background: rgba(0, 0, 0, .3);
		z-index: 2;
		.custom-warn-dialog {
			position: fixed;
			width: 576rpx;
			height: 706rpx;
			left: 50%;
			top: 50%;
			margin-left: -288rpx;
			margin-top: -353rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			overflow: hidden;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			.close {
				position: absolute;
				z-index: 2;
				top: 30rpx;
				right: 30rpx;
				font-size: 50rpx;
				color: rgba(255, 255, 255, .7);
			}
			.top {
				width: 100%;
				height: 340rpx;
			}
			.mid {
				box-sizing: border-box;
				padding: 0 60rpx;
				.title {
					font-size: 40rpx;
					margin-bottom: 30rpx;
					text-align: center;
				}
				.text {
					font-size: 26rpx;
					line-height: 42rpx;
				}
			}
			.bot {
				width: 100%;
				height: 96rpx;
				line-height: 96rpx;
				text-align: center;
				font-size: 32rpx;
				font-family: "Source Han Sans CN";
				font-weight: 400;
				color: rgba(250,99,66,1);
				border-radius: 0;
				&.hover {
					background:rgba(250, 99, 66, 1);
					color: #FFFFFF;
				}
			}
		}	
	}
	@keyframes dialog-in {
		0% {
			transform: scale(0, 0);
		}
		100% {
			transform: scale(1, 1);
		}
	}
	@keyframes dialog-out {
		0% {
			transform: scale(1, 1);
		}
		100% {
			transform: scale(0, 0);
		}
	}
	@keyframes bg-in {
		0% {
			background: rgba(0, 0, 0, 0)
		}
		100% {
			background: rgba(0, 0, 0, .4)
		}
	}
	@keyframes bg-out {
		0% {
			background: rgba(0, 0, 0, .4)
		}
		100% {
			background: rgba(0, 0, 0, 0)
		}
	}
	.bg-in {
		animation: bg-in .2s;
		animation-fill-mode: forwards;
	}
	.bg-out {
		animation: bg-out .1s;
		animation-fill-mode: forwards;
	}
	.dialog-in {
		animation: dialog-in .2s;
		animation-fill-mode: forwards;
	}
	.dialog-out {
		animation: dialog-out .1s;
		animation-fill-mode: forwards;
	}
</style>
