App.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <router-view />
  3. <loading-view />
  4. <Toaster position="top-center" richColors />
  5. <bind-parent-popup ref="bindParentPopupRef" />
  6. <!-- 音乐播放器 -->
  7. <music-player />
  8. <!-- 语言选择栏弹出容器 -->
  9. <div id="language-popover-teleport"></div>
  10. </template>
  11. <script setup lang="ts">
  12. import loadingView from "./components/loadingView.vue";
  13. import "vue-sonner/style.css";
  14. import { Toaster } from "vue-sonner";
  15. import { onMounted, ref, computed, watch } from "vue";
  16. import BindParentPopup from "@/components/BindParentDialog/index.vue";
  17. import MusicPlayer from "@/components/MusicPlayer/index.vue";
  18. import { useGlobalStore } from "./store/modules/globalStore";
  19. import { useThemeStore } from "./store/modules/themeStore";
  20. const bindParentPopupRef = ref(null);
  21. const globalStore = useGlobalStore();
  22. const themeStore = useThemeStore();
  23. // 初始化主题
  24. themeStore.initTheme();
  25. const showBindModal = computed(() => globalStore.showBindModal);
  26. watch(
  27. () => showBindModal.value,
  28. newVal => {
  29. if (newVal) {
  30. bindParentPopupRef.value?.open();
  31. }
  32. }
  33. );
  34. onMounted(() => {
  35. // 检查登录状态
  36. const token = localStorage.getItem("token");
  37. if (token) {
  38. globalStore.setIsLoggedIn(true);
  39. }
  40. });
  41. </script>
  42. <style lang="scss">
  43. .van-sticky--fixed {
  44. background: var(--bg-sticky, #161617);
  45. }
  46. @media screen and (min-width: 1000px) {
  47. .van-popup {
  48. max-width: 468px !important;
  49. }
  50. }
  51. html,
  52. body {
  53. overscroll-behavior-y: none;
  54. height: 100%;
  55. background: var(--bg-primary, #161617);
  56. overflow: hidden;
  57. }
  58. #app {
  59. width: 100%;
  60. max-width: 500px;
  61. margin: 0 auto;
  62. height: 100%;
  63. overflow-x: hidden;
  64. overflow-y: auto;
  65. -webkit-overflow-scrolling: touch;
  66. overscroll-behavior: contain;
  67. color: var(--text-primary, #ffffff);
  68. }
  69. body {
  70. font-size: 14px;
  71. line-height: 22px;
  72. color: var(--text-primary, #fff);
  73. font-family: PingFangSC, "PingFang SC", sans-serif;
  74. font-family: "Chakra Petch" !important;
  75. --van-popover-light-background: none;
  76. --van-popover-radius: none;
  77. --van-padding-md: 16px;
  78. padding-bottom: env(safe-area-inset-bottom);
  79. }
  80. .w-100 {
  81. width: 100%;
  82. }
  83. .flex {
  84. display: flex;
  85. justify-content: space-between;
  86. align-items: center;
  87. }
  88. .flex-start {
  89. justify-content: flex-start;
  90. }
  91. .flex-center {
  92. justify-content: center;
  93. }
  94. .flex-end {
  95. justify-content: flex-end;
  96. }
  97. .flex-col {
  98. flex-direction: column;
  99. }
  100. .flex-1 {
  101. flex: 1;
  102. }
  103. .no-shrink {
  104. flex-shrink: 0;
  105. }
  106. .gray {
  107. color: var(--text-secondary, #8b8b8b);
  108. }
  109. .theme-color {
  110. color: var(--color-accent, #000);
  111. }
  112. .font-14 {
  113. font-size: 14px;
  114. }
  115. .text-left {
  116. text-align: left;
  117. }
  118. .text-center {
  119. text-align: center;
  120. }
  121. .text-right {
  122. text-align: right;
  123. }
  124. .color-theme {
  125. color: var(--color-accent, #000);
  126. }
  127. .din {
  128. font-family: "DIN", sans-serif;
  129. }
  130. .pointer {
  131. cursor: pointer;
  132. }
  133. #language-popover-teleport {
  134. --van-popover-light-background: var(--bg-popover, #161617);
  135. --van-popover-horizontal-action-height: 44px;
  136. --van-popover-radius: 4px;
  137. }
  138. </style>