<template>
	<view class="content">
		<view class="point">
			<image class="point-img" src="https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/06/06/280935db4a8ee4c0b17ddcb37f489b0f.png" mode="widthFix"></image>
			<view class="point-text">
				<view class="point-name">
					认证成功
				</view>
				<view class="point-tips">
					<text>恭喜您已完成认证</text>
					<text>专享更多安全保障,可进行选择咨询类型</text>
				</view>
				<view class="point-btn">
					<view class="btn" @click="sheetClick">
						立即咨询
					</view>
				</view>
			</view>
		</view>
		
		<view class="tipsBack" v-if="generalShow"></view>
		<view class="tipsCont" v-if="generalShow">
			<view class="tipsWhite">
				<image class="tipsCont-img" src="https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/06/06/6b1485847b45273618f8d922ceee889c.png" mode="widthFix"></image>
				<view class="tipsWhite-top">
					<view class="tipsWhite-name">
						请您先关注抖火法律咨询公众号
					</view>
					<view class="tipsWhite-text">
						关注后，可立即下单
					</view>
				</view>
				<view class="tipsWhite-btn">
					<view class="tipsWhite-btn-go" @click="generalShow = false">
						稍后关注
					</view>
					<view class="tipsWhite-btn-go" @click="judgeGeneral">
						马上关注
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { judgeReal } from '@/apis/interfaces/user'
	import { authFollow } from '@/apis/interfaces/index'
	export default {
		data() {
			return {
				generalShow: false // 公众号
			}
		},
		onLoad() {
	
		},
		methods: {
			// 判断是否认证
			sheetClick() {
				judgeReal().then(res => {
					if(!res.has_subscribe) {
						// 弹出公众号
						this.generalShow = true
					} else {
						// 跳到首页
						this.$Router.replace({name: 'Index'})
					}
				}).catch( err => {
					uni.showToast({
						title: err.message,
						icon: "none"
					})
				})
			},
			
			// 状态
			judgeGeneral(){
				// 获取微信授权信息
				authFollow({
				    url: 'https://web.douhuofalv.com/webview/webCode',
					// url: 'https://web.douhuotest.douhuofalv.com/webview/webCode'
				}).then(res => {
				    window.location.href = res
				}).catch(err => {
				    uni.showToast({
				        title: err.message,
				        icon: "none"
				    })
				})
				
				// 关闭公众号
				this.generalShow = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.point {
		text-align: center;
		padding: 40% 0;
		.point-img {
			width: 50%;
			margin: 0 auto 10rpx;
		}
		.point-text {
			.point-name {
				font-size: $title-size + 14;
			}
			.point-tips{
				margin: $margin + 20 0 $margin*3;
				line-height: 52rpx;
				text {
					display: block;
					color: #999999;
				}
			}
		}
		.point-btn {
			text-align: center;
			.btn {
				background-image: linear-gradient(to right, #da2b56, #FBAF3B);
				display: inline-block;
				color: #ffffff;
				border-radius: $radius-m;
				padding: 0 $padding;
				line-height: 90rpx;
				width: 70%;
			}
		}
	}
	
	// 关注
	.tipsBack {
		position: fixed;
		width: 100vw;
		height: 100vh;
		left: 0;
		top: 0;
		z-index: 9;
		background-color: rgba(0, 0, 0, .8);
	}
	.tipsCont {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-box-pack: center;
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		z-index: 10;
		padding: 0 10%;
		box-sizing: border-box;
	}
	
	.tipsWhite {
		background-color: #ffffff;
		border-radius: 20rpx;
		overflow: hidden;
	}
	
	.tipsWhite-top {
		padding: $padding;
		box-sizing: border-box;
		text-align: center;
	}
	
	.tipsCont-img {
		width: 100%;
	}
	
	.tipsWhite-name {
		text-align: center;
		color: #111111;
		font-size: 34rpx;
		font-weight: 600;
		margin-bottom: 15rpx;
	}
	
	.tipsWhite-text {
		font-size: 30rpx;
		color: #666666;
		line-height: 48rpx;
	}
	
	.tipsWhite-btn {
		display: flex;
		padding: $padding 10rpx;
		box-sizing: border-box;
		.tipsWhite-btn-go {
			flex: 2;
			color: #fff;
			margin: 0 15rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			border: 2rpx solid #F6F6F6;
			background-color: #007df5;
			border-radius: $radius-m;
			&:first-child {
				color: #333333;
				background-color: #ffffff;
				border: 2rpx solid #cccccc;
			}
		}
	}
</style>