import Vue from 'vue'
import App from './App.vue'
import router from './router/config.js'
import './theme/index.less'
import Antd from 'ant-design-vue'
import Viser from 'viser-vue'
import '@/mock'
import store from './store'
import 'animate.css/source/animate.css'
import Plugins from '@/plugins'
import { initI18n } from '@/utils/i18n'
import 'moment/locale/zh-cn';
import '@/services'

Vue.use(router)
Vue.config.devtools = true

const i18n = initI18n('CN', 'US')
import "normalize.css"
import { setAuthorization } from "@/utils/request";
Vue.use(Antd, {
  locale: require('ant-design-vue/lib/locale-provider/zh_CN'),
})
Vue.config.productionTip = false
Vue.use(Viser)
Vue.use(Plugins)
//App.vue
import { message } from 'ant-design-vue';
window.$message = message  //window上挂载


//ts申明window $message属性




// bootstrap({ router, store, i18n, message: Vue.prototype.$message })
import CryptoJS from "crypto-js";


if (window.location.href.includes('token')) {

  const decryptedBytes = CryptoJS.AES.decrypt(window.location.href.split("=")[1],
    'token')
  const token = decryptedBytes.toString(CryptoJS.enc.Utf8);



  setAuthorization(token,)
}

// api.userService.getLoginUser().then((res) => {
//   // console.log(res)
//   if (res.data.code === 200) {
//     sessionStorage.setItem("user", res.data.data.id);
//     Cookies.set("user", res.data.data.id);
//   }
// })

new Vue({
  router,
  store,
  i18n,
  render: h => h(App),
}).$mount('#app')
