<template>
	<view class="start-container"> 
	<image :src="imgURL"></image>
	</view>
</template>

<script>
	import wxCode from '@/api/wxcode.js'
	export default {
		data() {
			return { 
				imgURL:''
			}
		},
		onLoad(e=null) {
			this.init(e)
		},
		created() {
			this.imgURL = `${this.baseImgURL}/start.png` 
		},
		methods: {
			Interceptor(id) {
				let taht = this
				console.log(`%c 检测到参数拦截器启动`, 'color:red;font-size:50px'); 
				wxCode.getQrCodeType({
					qrCode: id
				}).then(res => {
					if (res.code == 20000) {
						uni.redirectTo({
							url: '/AppletCode/pages/index/index?details=' + JSON.stringify({
								...res.data,
								qrCode: id
							}),
							fail(e) {
								console.log(e, '跳转失败')
							}
						})
					}
				})
			},
			init(e){
				if(e&&e.scene){
					this.Interceptor(e.scene)
				}else{
					setTimeout(()=>{
						uni.redirectTo({
							// url:'/pages/index/index'
								url:'/pages/login/index'
						})
						// uni.redirectTo({
						// 	url:'/pages/login/index'
						// })
						// uni.switchTab({ 
						// 	url:'/pages/home/index'
						// })
					},2000)
				} 
			}
		}
	}
</script>

<style scoped>
	@import 'index.css';

</style>
