<script>
	export default {
		data() {
			return {
				
			}
		},
		onLaunch: function() {
			
		},
		onShow: function(options) {
			this.autoUpdate();
			
			//通过 URL Scheme 唤醒小程序，传递的参数 query
			if (options.scene === 1065 && options.query) {
				const shareTQId = options.query.shareTQId;
				const shareUserId = options.query.shareUserId;
				if(shareTQId&&shareUserId) {
					uni.reLaunch({
						url: `/pages/home?shareTQId=${shareTQId}&shareUserId=${shareUserId}&from=urlScheme`
					});
				}
			}
		},
		onHide: function() {
			if(uni.getStorageSync('channelType')) uni.removeStorageSync('channelType')
			if(uni.getStorageSync('shareTQId')) uni.removeStorageSync('shareTQId')
			if(uni.getStorageSync('shareUserId')) uni.removeStorageSync('shareUserId')
		},
		methods: {
			autoUpdate() {
				if (wx.canIUse('getUpdateManager')) {
					const updateManager = wx.getUpdateManager();
					updateManager.onCheckForUpdate(res => {
						if (res.hasUpdate) {
							updateManager.onUpdateReady(() => {
								wx.showModal({
									title: '更新提示',
									content: '发现新版本，是否更新？',
									success: function(res) {
										if (res.confirm) {
											updateManager.applyUpdate();
										}
									}
								})
							});
							updateManager.onUpdateFailed(function() {
								wx.showModal({
									title: '最新版提示',
									content: '新版本已上线，请您删除当前小程序，重新搜索打开',
									showCancel: false
								})
							});
						}
					})
				} else {
					wx.showModal({
						title: '提示',
						content: '当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。',
						showCancel: false
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";

	* {
		box-sizing: border-box;
	}

	uni-page-body,
	html,
	body {
		height: 100%;
		width: 750rpx;
		background: #F6F6F6;
	}

	.u-button--primary {
		background-color: #5776E6;
	}

	.uni-input-placeholder {
		text-align: right;
	}

	.ml5 {
		margin-left: 10rpx;
	}

	.contain {
		height: 100%;
		padding-bottom: 120rpx;
		padding-top: 24rpx;
		overflow-y: auto;

		.main {
			padding: 0 32rpx;
			background-color: #fff;
		}

		.tijiao {
			position: fixed;
			width: 100%;
			bottom: 0;
			left: 0;
			background-color: #fff;
			padding: 16rpx 32rpx;
			box-sizing: border-box;
			box-shadow: 0 -6px 12px 0 rgba(153, 153, 153, 0.10);
		}

		.u-cell__value {
			color: #333 !important;
		}

	}
	
	.tabPage{
		background: #F7F7F7;
		padding: 0 24rpx 194rpx;
		box-sizing: border-box;
	}
	
	.adf{
	  display: flex;
	}
	.adfac{
	  display: flex;
	  align-items: center;
	}
	.adffc{
	  display: flex;
	  flex-direction: column;
	}
	.adfacjc{
	  display: flex;
	  align-items: center;
	  justify-content: center;
	}
	.adfacjb{
	  display: flex;
	  align-items: center;
	  justify-content: space-between;
	}
	.adffcac{
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	}
	.adffcacjc{
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	  justify-content: center;
	}
	.adffcacjb{
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	  justify-content: space-between;
	}
	.zt_btn{
		width: 100%;
		height: 88rpx;
		background: linear-gradient( 90deg, #33A7A7 0%, #64BBBB 100%);;
		border-radius: 44rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: bold;
		font-size: 32rpx;
		color: #FFFFFF;
		line-height: 88rpx;
		text-align: center;
		letter-spacing: 2rpx;
	}
	.qx_btn{
		width: 100%;
		height: 88rpx;
		border-radius: 44rpx;
		background: rgba(25, 156, 156, 0.06);
		font-family: PingFang-SC, PingFang-SC;
		font-weight: bold;
		font-size: 32rpx;
		color: #009191;
		line-height: 88rpx;
		text-align: center;
		letter-spacing: 2rpx;
	}
</style>