<template>
    <div>
    </div>
</template>

<script>
import CryptoJS from "crypto-js";
export default {
    data() {
        return {
        }
    },    
    created() {
        //获取url参数
        let roterS = window.location.href.toString();
        let r1 = roterS.split('?');
        let actCode='';let type = '';
        let userCode = '';let un = '';
        let actCode1 ='';let userCode1 = '';let un1 = '';
        let actCode2 ='';let userCode2 = '';let un2 = '';
        if(r1.length!=1){
            let r2 = r1[1].split('&');
            type = r2[0].substring(5);
            //校验是否发送移动/PC,0移动1PC
            if(type=='0'){
                userCode = r2[1].substring(9).replace('%3D','=');
                actCode = r2[2].substring(8).replace('%3D','=');
                un = r2[3].substring(3).replace('%3D','=');
                userCode1 = (userCode.replace('%3D','=').replace('%20','+'));
                actCode1 = (actCode.replace('%3D','=').replace('%20','+'));
                un1 = (un.replace('%3D','=').replace('%20','+'));
                userCode2 = (userCode1.replace('%2F','/').replace('%20','+'));
                actCode2 = (actCode1.replace('%2F','/').replace('%20','+'));
                un2 = (un1.replace('%2F','/').replace('%20','+'));
                let key = CryptoJS.enc.Utf8.parse('absoietlj32fai12');
                let decrypt1 = CryptoJS.AES.decrypt(userCode2, key, {mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});//解密userCode
                let decrypt2 = CryptoJS.AES.decrypt(actCode2, key, {mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});//解密actCode
                let decrypt3 = CryptoJS.AES.decrypt(un2, key, {mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});//解密userName
                sessionStorage.setItem('usercode',JSON.stringify(CryptoJS.enc.Utf8.stringify(decrypt1).toString()));
                sessionStorage.setItem('actCode',JSON.stringify(CryptoJS.enc.Utf8.stringify(decrypt2).toString()));
                sessionStorage.setItem('un',JSON.stringify(CryptoJS.enc.Utf8.stringify(decrypt3).toString()));   
                // 即将跳转
                 this.$router.push('/detauils');
                
            }
        }
    },
  }
</script>