<script setup lang="ts">
import { useStore } from "./stores/index";
const store = useStore();

const time = ref();


onBeforeMount(() => {
  // @ts-ignore
  store.dataAll = dataAll;
  // 移动端
  window.addEventListener(
    "resize",
    () => {
      //@ts-ignore
      clearTimeout(time.current);
      //@ts-ignore
      time.current = window.setTimeout(() => {
        // 根元素
        const dom: HTMLDivElement | null = document.querySelector("#app");
        if (dom && document.documentElement.clientWidth < 480) {
          dom.style.height = document.documentElement.clientHeight + "px";
        }
      }, 100);
    },
    true
  );

  // const baseAPIUrl = ref('')
  // // const baseAPIUrl = ref('http://192.168.20.61:8063')
  // // const baseAPIUrl = ref('https://sit-cnzhengquan.4dage.com')

  // // 统计访问量
  // if (localStorage.getItem('refreshTime')) {
  //   var nowDate = Math.floor(Date.now() / 1000);
  //   // @ts-ignore
  //   var storedTimestamp = parseInt(localStorage.getItem('refreshTime'), 10);
  //   console.log('时间差',Math.floor((nowDate - storedTimestamp)))
  //   if (Math.floor((nowDate - storedTimestamp) / 60) > 60) {
  //     // 发送请求并且更新本地缓存

  //     axios.get(`${baseAPIUrl.value}/api/show/addVisit?id=10&type=visit`).then(() => {
  //       // @ts-ignore
  //       localStorage.setItem('refreshTime', nowDate);
  //     })
  //   }
  // } else {
  //   axios.get(`${baseAPIUrl.value}/api/show/addVisit?id=10&type=visit`).then(() => {
  //     // @ts-ignore
  //     localStorage.setItem('refreshTime', Math.floor(Date.now() / 1000));
  //   })

  // }
})
</script>

<template>
  <router-view />
</template>

<style scoped>
@font-face {
  font-family: 'SourceHanSansCN-Bold';
  src: url('./assets/fonts/SourceHanSansCN-Bold.ttf');
}

@font-face {
  font-family: 'SourceHanSansCN-Regular';
  src: url('./assets/fonts/SourceHanSansCN-Regular.otf');
}

@font-face {
  font-family: 'SourceHanSansCN-Medium';
  src: url('./assets/fonts/SourceHanSansCN-Medium.otf');
}



#app {
  width: 100%;
  height: 100%;
  max-width: 500px;
  /* height: ; */
  background: #F7F3E8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
</style>
