<template>
	<view class="containersView">
		<div style="width: 100%;height: 85%;position: absolute;background: url('../../static/images/appeq_bg.png') no-repeat center bottom / cover;"></div>

		<view style="text-align: center;position: relative;height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
			<image style="width: 124rpx;height: 124rpx;margin-top: -920rpx;border-radius:20upx;" src="../../static/images/appLogo.png"></image>
			<view style="font-size: 40rpx;margin-top: 22rpx;color: #FFFFFF;font-weight: bold;">斯耀短剧APP{{isWeixin}}</view>
			<view style="font-size: 28rpx;margin-top: 16rpx;color: #FFFFFF;font-weight: bold;">海量电子榨菜  免费又过瘾</view>
			<button class="confirm-btn" @click="taobaoLogin">{{confirmBtn}}</button>
			
		</view>
		<view id="shareit" v-if="show_share" @tap="closeShare">
			<image class="arrow" src="https://renwu.xiansqx.com/img/20210813/9aa484db4c60458f86deb2a8ab6fe400.png">
			</image>
			<view id="follow">点击右上角按钮，选择浏览器打开下载！</view>
		</view>
		<!-- #ifdef H5 -->
		<div v-if="isWeixin" style="width: 100%;height: 100%;position: absolute;top: 0;background: url('../../static/images/open_guide.png') no-repeat center bottom / cover;"></div>
		<!-- #endif -->
	</view>
</template>
<script>
	export default {
		data() {
			return {
				mobile: '',
				code: '',
				message: '',
				show_share: false,
				openShare: false,
				openShares: false,
				relationId: '',
				sending: false,
				confirmBtn: '斯耀短剧APP',
				isWeixin: false,
			};
		},
		onLoad(e) {
			let u = navigator.userAgent;
			if ( u.indexOf('iPhone') > -1) {
				// #ifdef H5
				this.confirmBtn = "跳转网页版首页"
				// #endif
			}
			
			if ( u.toLowerCase().indexOf('micromessenger') !== -1) {
				this.isWeixin = true
			}
		
		},
		methods: {
			closeShare() {
				this.show_share = false;
			},
			taobaoLogin() {
				
				var u = navigator.userAgent;
				if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) {
					this.$Request.get('/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;
										// #ifndef H5
										plus.runtime.openURL(res.data.value, function(res) {

										});
										// #endif
										// #ifdef H5
										window.location.href = res.data.value;
										// #endif
									} else {
										this.show_share = true;
									}
									
								} else {
									// #ifndef H5
									plus.runtime.openURL(res.data.value, function(res) {

									});
									// #endif
									// #ifdef H5
									uni.setClipboardData({
										data: res.data.value,
										success: r => {
											// this.$queue.showToast('邀请码复制成功');
										}
									});
									window.location.href = res.data.value;
									// #endif
								}
							}
						}
					});
				} else {
					
					this.$Request.get('/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;
										// #ifndef H5
										plus.runtime.openURL(res.data.value, function(res) {

										});
										// #endif
										// #ifdef H5
										window.location.href = res.data.value;
										// uni.switchTab({
										// 	url: 'pages/index/index'
										// })
										// #endif
									} else {
										this.show_share = true;
									}
								} else {
									// #ifndef H5
									plus.runtime.openURL(res.data.value, function(res) {

									});
									// #endif
									// #ifdef H5
									uni.setClipboardData({
										data: res.data.value,
										success: r => {
											// this.$queue.showToast('邀请码复制成功');
										}
									});
									
									uni.switchTab({
										url: '/pages/index/index2'
									})
									// window.location.href = res.data.value;
									// #endif
								}
							}
						}
					});
				}
			}
		}
	};
</script>

<style lang="scss" scoped>
	uni-page-body{
		width: 100%;
		height: 100%;
	}
	.containersView {
		width: 100%;
		height: 100%;
	}
	#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;
	}


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

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

		&: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;
	}

	.confirm-btn {
		width: 416rpx;
		height: 90rpx;
		line-height: 90rpx;
		background: #FD5775;
		color: #fff;
		font-size: 32rpx;
		font-weight: bold;
		font-size: 32rpx;
		color: #FFFFFF;
		position: absolute;
		left: 0;
		right: 0;
		bottom: 70rpx;
	}
</style>