App.vue 2.8 KB

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