<template>
	<view class="pop">
		<view class="pop_con">
			<view class="title">用户隐私保护提示</view>
			<view class="desc">
				<view class="desc_con">感谢您使用本程序，您使用本程序前应当阅井同意</view>
				<view class="file" @click="openPrivacyContract">《大卫博士争霸赛小程序隐私保护指引》</view>
				<view class="desc_con">
					当您点击同意并开始时用产品服务时，即表示你已理解并同息该条款内容，该条款将对您产生法律约束力。如您拒绝，将无法进入程序。</view>
			</view>
			<view class="btn_box">
				<navigator open-type="exit" target="miniProgram" class="exit_btn" id="disagree-btn">不同意退出</navigator>
				<button id="agree-btn" @agreeprivacyauthorization="handleAgreePrivacyAuthorization"
					open-type="agreePrivacyAuthorization">同意并继续</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {};
		},
		methods: {
			openPrivacyContract() {
				wx.openPrivacyContract({
					success: res => {
						console.log('openPrivacyContract success')
					},
					fail: res => {
						console.error('openPrivacyContract fail', res)
					}
				})
			},
			handleAgreePrivacyAuthorization() {
				this.$nextTick(function() {
					this.$emit('confirm');
				})

			},
			handleDisagree() {
				// this.$store.commit('HIDESHOWPRIVACY')
				uni.navigateBackMiniProgram()
				uni.exit({
					success: () => {
						console.log("exit success")
					},
					fail: (e) => {
						console.log("exit fail")
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pop {
		width: 100vw;
		height: 100vh;
		position: fixed;
		background-color: rgba(0, 0, 0, 0.1);
		z-index: 999;
		overflow: hidden;

		.pop_con {
			width: 100%;
			height: 40vh;
			background: #fff;
			border-top-left-radius: 26rpx;
			border-top-top-radius: 26rpx;
			position: fixed;
			left: 0;
			bottom: 0;
			padding: 0 30rpx;
			box-sizing: border-box;

			.title {
				font-size: 36rpx;
				font-weight: bold;
				margin: 24rpx 0;
			}

			.desc {
				font-size: 30rpx;
				color: 999;

				.file {
					color: #FB231F;
					margin: 24rpx 0;
					font-size: 32rpx;
				}
			}




			.btn_box {
				margin-top: 40rpx;
				display: flex;
				justify-content: space-around;
				align-items: center;

				.exit_btn {
					display: flex;
					justify-content: center;
					align-items: center;
					width: 300rpx;
					height: 88rpx;
					background: #E9E9E9;
					border-radius: 44rpx;
					font-size: 32rpx;
					color: #333;
				}

				button {
					display: flex;
					justify-content: center;
					align-items: center;
					width: 300rpx;
					height: 88rpx;
					background: #FB231F;
					border-radius: 44rpx;
					font-size: 32rpx;
					color: #fff;
					background: linear-gradient(93deg, #F30000 0%, #FE4815 100%);
				}

			}

		}

	}
</style>