App.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <script setup lang="ts">
  2. import { useStore } from "./stores/index";
  3. const store = useStore();
  4. const time = ref();
  5. onMounted(() => {
  6. // @ts-ignore
  7. store.dataAll = dataAll;
  8. // 移动端
  9. window.addEventListener(
  10. "resize",
  11. () => {
  12. //@ts-ignore
  13. clearTimeout(time.current);
  14. //@ts-ignore
  15. time.current = window.setTimeout(() => {
  16. // 根元素
  17. const dom: HTMLDivElement | null = document.querySelector("#app");
  18. if (dom && document.documentElement.clientWidth < 480) {
  19. dom.style.height = document.documentElement.clientHeight + "px";
  20. }
  21. }, 100);
  22. },
  23. true
  24. );
  25. // const baseAPIUrl = ref('')
  26. // // const baseAPIUrl = ref('http://192.168.20.61:8063')
  27. // // const baseAPIUrl = ref('https://sit-cnzhengquan.4dage.com')
  28. // // 统计访问量
  29. // if (localStorage.getItem('refreshTime')) {
  30. // var nowDate = Math.floor(Date.now() / 1000);
  31. // // @ts-ignore
  32. // var storedTimestamp = parseInt(localStorage.getItem('refreshTime'), 10);
  33. // console.log('时间差',Math.floor((nowDate - storedTimestamp)))
  34. // if (Math.floor((nowDate - storedTimestamp) / 60) > 60) {
  35. // // 发送请求并且更新本地缓存
  36. // axios.get(`${baseAPIUrl.value}/api/show/addVisit?id=10&type=visit`).then(() => {
  37. // // @ts-ignore
  38. // localStorage.setItem('refreshTime', nowDate);
  39. // })
  40. // }
  41. // } else {
  42. // axios.get(`${baseAPIUrl.value}/api/show/addVisit?id=10&type=visit`).then(() => {
  43. // // @ts-ignore
  44. // localStorage.setItem('refreshTime', Math.floor(Date.now() / 1000));
  45. // })
  46. // }
  47. })
  48. </script>
  49. <template>
  50. <router-view />
  51. </template>
  52. <style scoped>
  53. @font-face {
  54. font-family: 'REEJI-DuoguanGB-free-Flash';
  55. src: url('./assets/fonts/REEJI-DuoguanGB-free-Flash.ttf');
  56. }
  57. @font-face {
  58. font-family: 'SourceHanSansCN-Bold';
  59. src: url('./assets/fonts/SourceHanSansCN-Bold.otf');
  60. }
  61. @font-face {
  62. font-family: 'PangMenZhengDao-Regular';
  63. src: url('./assets/fonts/PangMenZhengDao-Regular.ttf');
  64. }
  65. @font-face {
  66. font-family: 'SourceHanSerifCN-Heavy';
  67. src: url('./assets/fonts/SourceHanSerifCN-Heavy.otf');
  68. }
  69. #app {
  70. width: 100%;
  71. height: 100%;
  72. }
  73. * {
  74. margin: 0;
  75. padding: 0;
  76. box-sizing: border-box;
  77. }
  78. </style>