<template>
  <a-config-provider :locale="zh_CN">
    <div id="app">
      <head-nav class="head-nav" />
      <router-view></router-view>
      <footer-page class="footer" />
      <div id="components-back-top-demo-custom">
        <a-back-top>
          <div class="ant-back-top-inner"></div>
        </a-back-top>
      </div>
    </div>
  </a-config-provider>
</template>

<script>
import { mapState, mapActions, mapMutations } from 'vuex';
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN';
import HeadNav from './components/HeadNav/HeadNav.vue';
import FooterPage from './components/FooterPage/FooterPage.vue';

export default {
  name: 'App',
  components: { HeadNav, FooterPage },
  data() {
    return { zh_CN };
  },

  computed: mapState('user', ['anyringToken']),
  updated() {
    window.scroll(0, 0);
  },
  created() {
    console.log('process.env ', process.env);
    const userId = '1218763410024566784';
    const params = { userId };
    this.getUserId(params);
    if (sessionStorage.getItem('store')) {
      this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem('store'))));
    }
    window.addEventListener('beforeunload', () => {
      sessionStorage.setItem('store', JSON.stringify(this.$store.state));
    });
  },

  methods: { ...mapActions('user', ['getUserId']) },
};
</script>

<style>
html,
body,
#app {
  min-height: 100%;
}

#app {
  background: transparent;
}
body {
  background: #f5f5f5 !important;
  padding-top: 80px;
}
body::-webkit-scrollbar {
  width: 0;
}
.head-nav {
  height: 80px;
  width: 100%;
  top: 0;
  background: white;
  box-shadow: 0 0 10px #ccc;
  position: fixed !important;
  z-index: 100;
}
.friend {
  height: 64px;
}
.footer {
  width: 100%;
  background: #0d1f32;
  bottom: 0;
}
#components-back-top-demo-custom .ant-back-top {
  bottom: 100px;
  right: 70px;
}
#components-back-top-demo-custom .ant-back-top-inner {
  height: 60px;
  width: 60px;
  line-height: 60px;
  background: url('assets/t-top.png') center no-repeat;
  background-size: contain;
}

.BMap_cpyCtrl {
  display: none;
}

.anchorBL {
  display: none;
}
</style>
