<template>
    <view>
        <web-view :src="url"></web-view>
    </view>
</template>

<script>
    import { wechatCode } from '@/apis/interfaces/authUrl'
    export default {
    	data() {
    		return {}
        },
        onLoad(options) {
            // 获取微信code
            wechatCode({
                code		: options.code,
				share_user	: this.$store.getters.getShareUser,
				invite		: this.$store.getters.getInvite,
				lock_id		: this.$store.getters.getLockId
            }).then(res => {
				this.$store.commit('setToken', res.token_type + ' ' + res.token)
				this.$store.commit('setPassInfo', res.pass_info)
				
				this.$store.commit('setShareUser', '')
				this.$store.commit('setInvite', '')
				this.$store.commit('setLockId', '')
				
				if(res.pass_info) {
					uni.redirectTo({
					    url: '/pages/index/index'
					})
					return
				}
				uni.redirectTo({
				    url: '/pages/index/perfect'
				})
            }).catch(err => {
            	uni.showToast({
            		title: err.message,
            		icon: "none"
            	})
            })
        }
    }
</script>

<style>
</style>
