<template>
	<view style="background: #FFFFFF;">
		<view style="text-align: center;">
			<image style="width: 160upx;height: 160upx;margin-top: 200upx;border-radius:20upx;" src="/static/logo.png"></image>
			<view style="font-size: 46upx;margin-top: 20upx;color: #333333;font-weight: 500;">上门服务APP</view>
			<view style="font-size: 28upx;margin-top: 8upx;color: #333333;font-weight: 500;">{{message}}</view>
			<button class="confirm-btn" @click="taobaoLogin">下载上门服务APP</button>
		</view>
		<view id="shareit" v-if="show_share" @tap="closeShare">
			<image class="arrow" src="../../static/img/jiant.png"></image>
			<view id="follow">点击右上角按钮，选择浏览器打开下载！</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				mobile: '',
				code: '',
				show_share: false,
				relationId: '',
				openShare: false,
				openShares: false,
				invitationCode: '',
				message:'',
				sending: false,
				sendTime: '获取验证码',
				count: 60
			};
		},
		onLoad(e) {
			// this.$Request.getT('/common/type/93').then(res => {
			// 	if (res.status == 0) {
			// 		if (res.data && res.data.value && res.data.value == '是') {
			// 			this.openShare = true;
			// 		} else {
			// 			this.openShare = false;
			// 		}

			// 	}

			// });
			// this.$Request.getT('/common/type/94').then(res => {
			// 	if (res.status == 0) {
			// 		if (res.data && res.data.value && res.data.value == '是') {
			// 			this.openShares = true;
			// 		} else {
			// 			this.openShares = false;
			// 		}

			// 	}
			// });
			
			this.$Request.getT('/app/common/type/116').then(res => {
				if (res.code === 0) {
					if (res.data && res.data.value) {
						this.message = res.data.value;
					}
				}
			});
		},
		methods: {
			closeShare() {
				this.show_share = false;
			},
			copy() {
				uni.setClipboardData({
					data: this.invitationCode,
					success: r => {
						this.$queue.showToast('邀请码复制成功');
					}
				});
			},
			taobaoLogin() {
				var u = navigator.userAgent;
				if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) {
					this.$Request.getT('/app/common/type/49').then(res => {
						if (res.code == 0) {
							if (res.data && res.data.value) {
                                if(this.openShare){
									let ua = navigator.userAgent.toLowerCase();
									if (ua.indexOf('micromessenger') === -1) {
										this.show_share = false;
										window.location.href = res.data.value;
									}else{
										this.show_share = true;
									}
								}else{
									window.location.href = res.data.value;
								}
							}
						}
					});
				} else {
					this.$Request.getT('/app/common/type/50').then(res => {
						if (res.code == 0) {
							if (res.data && res.data.value) {
								if(this.openShares){
									let ua = navigator.userAgent.toLowerCase();
									if (ua.indexOf('micromessenger') === -1) {
										this.show_share = false;
										window.location.href = res.data.value;
									}else{
										this.show_share = true;
									}
								}else{
									window.location.href = res.data.value;
								}
							}
						}
					});
				}
			}
		}
	};
</script>

<style lang="scss">
	#shareit {
		-webkit-user-select: none;
		position: fixed;
		/*width: 100%;*/
		height: 2000px;
		background: rgba(0, 0, 0, 0.85);
		text-align: center;
		top: 0;
		left: 0;
		z-index: 999;
	}

	#shareit img {
		max-width: 100%;
	}

	.arrow {
		width: 100px;
		height: 150px;
		position: absolute;
		right: 5%;
		top: 1%;
	}

	#follow {
		margin-right: 60px;
		margin-left: 30px;
		width: 90%;
		height: 50px;
		line-height: 50px;
		text-align: left;
		text-decoration: none;
		font-size: 18px;
		color: white;
		float: left;
		margin-top: 160px;
	}

	.footer {
		padding-left: 140upx;
		margin-top: 32upx;
		font-size: 24upx;
		color: #666666;
		text-align: center;
		display: flex;
	}

	page {
		background: #fff;
	}

	.send-msg {
		border-radius: 30px;
		color: black;
		background: white;
		height: 30px;
		font-size: 14px;
		line-height: 30px;
	}

	.container {
		top: 0;
		padding-top: 50px;
		position: relative;
		width: 100%;
		height: 100%;
		overflow: hidden;
		background: #fff;
	}

	.wrapper {
		position: relative;
		z-index: 90;
		background: #fff;
		padding-bottom: 20px;
	}

	.back-btn {
		position: absolute;
		left: 20px;
		z-index: 9999;
		padding-top: var(--status-bar-height);
		top: 20px;
		font-size: 20px;
		color: #303133;
	}

	.left-top-sign {
		font-size: 80px;
		color: #f8f8f8;
		position: relative;
	}

	.right-top-sign {
		position: absolute;
		top: 40px;
		right: -15px;
		z-index: 95;

		&:before,
		&:after {
			display: block;
			content: '';
			width: 20px;
			height: 40px;
			background: #FF2638;
		}

		&:before {
			transform: rotate(50deg);
			border-radius: 0 50px 0 0;
		}

		&:after {
			position: absolute;
			right: -198px;
			top: 0;
			transform: rotate(-50deg);
			border-radius: 50px 0 0 0;
			/* background: pink; */
		}
	}

	.left-bottom-sign {
		position: absolute;
		left: -270px;
		bottom: -320px;
		/*border: 100upx solid #d0d1fd;*/
		border-radius: 50%;
		padding: 90px;
	}

	.welcome {
		position: relative;
		left: 30px;
		top: -55px;
		font-size: 28px;
		color: #555;
		text-shadow: 1px 0px 1px rgba(0, 0, 0, 0.3);
	}

	.input-content {
		padding: 0 20px;
	}

	.input-item {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		justify-content: center;
		padding: 0 30px;
		background: #f8f6fc;
		height: 64px;
		border-radius: 4px;
		margin-bottom: 30px;

		&:last-child {
			margin-bottom: 0;
		}

		.tit {
			height: 30px;
			line-height: 28px;
			font-size: 26upx;
			color: #606266;
		}

		input {
			height: 40px;
			font-size: 30upx;
			color: #303133;
			width: 100%;
		}
	}

	.confirm-btn {
		width: 500upx;
		height: 100upx;
		line-height: 100upx;
		margin-top: 200upx;
		color: #FFFFFF;
		background: #005dff;
		border-radius: 50upx;
		font-size: 38upx;
		font-weight: 500;

		// &:after {
		// 	border-radius: 60px;
		// }
	}

	.confirm-btn1 {
		width: 300px;
		height: 42px;
		line-height: 42px;
		border-radius: 30px;
		margin-top: 40px;
		background: whitesmoke;
		color: grey;
		font-size: 32upx;

		&:after {
			border-radius: 60px;
		}
	}

	.forget-section {
		font-size: 26upx;
		color: #4399fc;
		text-align: center;
		margin-top: 40px;
	}

	.register-section {
		left: 0;
		margin-top: 30px;
		bottom: 30px;
		width: 100%;
		font-size: 26upx;
		color: #606266;
		text-align: center;

		text {
			color: #4399fc;
			margin-left: 10px;
		}
	}
</style>
