<template>
	<view class="page">
		<view class="header">
			<view class="left">
				<!-- <image class="img" mode="widthFix" src="../../static/login/close.png"></image> -->
			</view>
		</view>

		<view class="tbody">
			<image style="margin-top: 50rpx;height: 120rpx;" src="../../static/me/img_checkMark.png" mode="heightFix" />
			<text style="margin-top: 68rpx;color:#FFFFFF;font-size: 28rpx;">下载APP，遇见更好的TA！</text>


			<text class="btn_submit" @click="toDown">下载APP</text>



		</view>
		<view class="pop_mask" v-if="show_mask">
			<view class="body">
				<image class="clickT" src="http://c.yujianmate.com/images/v1/wx_mask.png" mode="widthFix" />
			</view>
		</view>
		<view class="blankHeight"></view>
		<!-- 提示框 -->
		<DialogBox ref="DialogBox"></DialogBox>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				title: '',
				show_mask: false,
				downurl: 'https://e.zhichao.art/app/web3.0.v3.apk',
			}
		},
		onLoad(params) {
			this.ycode = params.ycode || '999999';
			this.getDownurl();
		},
		onShow() {},
		methods: {
			onBack() {},
			toDown() {
				var browser = {
					versions: function() {
						var u = navigator.userAgent,
							app = navigator.appVersion;
						return { //移动终端浏览器版本信息
							trident: u.indexOf('Trident') > -1, //IE内核
							presto: u.indexOf('Presto') > -1, //opera内核
							webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
							gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
							mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
							ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
							android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
							iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
							iPad: u.indexOf('iPad') > -1, //是否iPad
							webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
						};
					}(),
					language: (navigator.browserLanguage || navigator.language).toLowerCase()
				};
				if (this.is_show_mask()) {
					this.show_mask = true;
				} else {
					if (browser.versions.mobile && browser.versions.ios) {
						location.href = "https://e.zhichao.art/web/";
					} else {
						location.href = this.downurl;
					}
				}
			},
			is_show_mask() {
				var ua = navigator.userAgent.toLowerCase();
				if (ua.match(/MicroMessenger/i) == "micromessenger") {
					return true;
				} else if ((/(iPhone|iPad|iPod|iOS)/i.test(ua) && /\sQQ/i.test(ua)) || (/(Android)/i.test(ua) &&
						/MQQBrowser/i.test(ua) && /\sQQ/i.test((ua).split('MQQBrowser')))) {
					return true;
				}
				return false;
			},
			getDownurl() {
				uni.request({
					url: this.$apiHost + '/Web/getdown', //仅为示例，并非真实接口地址。
					data: {
						skey: this.skey
					},
					header: {
						'content-type': 'application/json' //自定义请求头信息
					},
					success: (res) => {
						console.log("----", res.data)
						this.downurl = res.data.downurl;
					}
				});

			},
		}
	}
</script>

<style scoped lang="scss">
	@import 'down.scss';
</style>