<!--
 * @Author: jixiang
 * @Date: 2021-07-07 15:48:52
 * @Description: 首页
 * @FilePath: /book_pc/src/views/home/index.vue
 * One World One Drefeel(56580223@qq.com)
-->
<template>
</template>
<script setup lang="ts">
  //   import { StateType } from '@/@type';
  import { useStore } from 'vuex';
  import { onMounted } from 'vue'
  import { useRoute, useRouter } from 'vue-router';
  import CryptoJS from 'crypto-js'
  import { getToken } from '@/utils/cookie'

  //登录
  const store = useStore();

  // store.dispatch('user/loginInfo', {
  //   userName: 'admin',
  //   password: 'e10adc3949ba59abbe56e057f20f883e',
  // });

  const route = useRoute()

  const router = useRouter()
  

  // onMounted(() => {

  //   //秘钥，秘钥必须为：8/16/32位
  //   var aseKey =  import.meta.env.VITE_APP_AES_KEY_BOOK_STORE
  //   let a = router.options.history.base
  //   // 参数 token userId
  //   var encrypt = route.query.from?route.query.from:a.slice(a.indexOf("=")+1)
  //   // 如果有新的token传过来，则使用新的token，不直接跳转
  //   if(getToken() && !encrypt ){
  //     //router.push('/packageManage')
  //     return
  //   }
  //   // var encrypt = route.query.from
  //   if(!encrypt || encrypt=='/#'){
  //    // window.location.href = import.meta.env.VITE_APP_BOOK_STORE_URL as string;
  //   }


  //   // BASE64解密
  //   let decData = CryptoJS.enc.Base64.parse(encrypt).toString(CryptoJS.enc.Utf8);

  //   // AES解密
  //   var decrypt = CryptoJS.AES.decrypt(decData, CryptoJS.enc.Utf8.parse(aseKey), {
  //     mode: CryptoJS.mode.ECB,
  //     padding: CryptoJS.pad.Pkcs7
  //   }).toString(CryptoJS.enc.Utf8);

  //   var userInfo = JSON.parse(decrypt)

  //   // store.dispatch('user/getToken', {
  //   //   token: userInfo.token,
  //   //   userId: userInfo.userId
  //   // });
    

  // })

</script>
<style lang="less" scoped></style>
