<template>
    <div></div>
</template>
<script>
import { mapGetters, mapState, mapActions } from 'vuex'
import { getWxQrCodeQuery } from '@/api/common'
export default {
	data() {
		return {
		}
	},
	computed: {
		// ...mapGetters({ userInfo: 'getSelfInfo' })
	},
	onLoad(options) {
		uni.showLoading({
			title: '加载中...'
		})
		uni.switchTab({
			url: '/pages/home/index'
		})
		return false
		if (!options.scene) {
			this.compatible()
			return false
		}
		this._getWxQrCodeQuery(options.scene)
	},
	methods: {
		_getWxQrCodeQuery(scene) {
			getWxQrCodeQuery({ scene: scene }).then(res => {
				uni.hideLoading()
				if (res.data.url.indexOf('https://') > -1) {
					const returnUrl = encodeURIComponent(res.data.url)
					uni.navigateTo({
						url: `/pages/page/webview/index?returnUrl=${returnUrl}`
					})
				} else {
					uni.redirectTo({
						url: res.data.url
					})
				}
			}).catch((e) => {
				this.compatible()
			})
		},
		// 兼容，如果小程序码或者接口返回有误时进入登录页
		compatible() {
			uni.hideLoading()
			uni.redirectTo({
				url: `/pages/page/login/index`
			})
		}
	}
}

</script>
