<!--扫描二维码页面-->
<template>
    <view id="saoCode">
        <web-view :src="baseUrl+'admin/#/codeHtml?code='+code+'&type='+type"></web-view>
    </view>
</template>

<script>
	import { config } from '@/api/request/config.js'
    export default {
		
        name: "saoCode",
        data() {
            return {
				baseUrl:config.base_url,
                code:"",
                type:"",
            }
        },

        onLoad(option) {
            let self = this;
            if(option.q){
                let text = decodeURIComponent(option.q)
                let list = text.split("?")[1].split("&");
                for(let i=0;i<list.length;i++){
                    let newList = list[i].split("=");
                    if(newList[0] == 'code'){
                        self.code = newList[1];
                    }else if(newList[0] == 'type'){
                        self.type = newList[1];
                    }
                }
                if(!uni.getStorageSync('token')){
                    uni.setStorageSync('saoCode',this.code);
                    uni.setStorageSync('saoType',this.type);
                    uni.redirectTo({
                        url: '/pages/login',
                    });
                }
            }else{
                this.code = uni.getStorageSync('saoCode');
                this.type = uni.getStorageSync('saoType');
                uni.removeStorageSync('saoCode');
                uni.removeStorageSync('saoType');
            }
        },
        mounted(){

        },

        methods:{

        },
    }
</script>

<style lang="stylus" scoped>
    #saoCode{
        overflow scroll
    }
</style>