App.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <script setup lang="ts">
  2. import { onLaunch } from '@dcloudio/uni-app'
  3. import { useAuthStore } from './store/auth'
  4. import { configTheme } from './components/theme/ThemeDefine';
  5. import { LogUtils } from '@imengyu/imengyu-utils';
  6. import { useCommonCategoryGlobalLoader } from './pages/article/data/CommonCategoryGlobalLoader';
  7. import { useAppConfiguration } from './api/system/useAppConfiguration';
  8. const TAG = 'App';
  9. const authStore = useAuthStore();
  10. const { loadCommonCategory } = useCommonCategoryGlobalLoader();
  11. const { loadAppConfiguration } = useAppConfiguration();
  12. function loadFontFace() {
  13. uni.loadFontFace({
  14. global: true,
  15. family: "SongtiSCBlack",
  16. source: 'url("https://mncdn.wenlvti.net/assets/fonts/STSongti-SC-Black.woff")',
  17. });
  18. uni.loadFontFace({
  19. global: true,
  20. family: "HUNdin1451",
  21. source: 'url("https://mncdn.wenlvti.net/app_static/minnan/fonts/HUN-din1451.woff")',
  22. });
  23. }
  24. onLaunch(async () => {
  25. LogUtils.printLog(TAG, 'info', 'App Launch');
  26. //加载配置
  27. await loadAppConfiguration();
  28. //加载字体
  29. loadFontFace();
  30. //加载登录状态
  31. await authStore.loadLoginState();
  32. //加载系统分类
  33. await loadCommonCategory();
  34. })
  35. configTheme(false, (theme, darkTheme) => {
  36. theme.colorConfigs.default.primary = '#d9492e';
  37. theme.colorConfigs.pressed.primary = '#882d1d';
  38. theme.colorConfigs.background.primary = '#ffcfc6';
  39. theme.colorConfigs.background.warning = '#f5ebe0';
  40. theme.colorConfigs.background.page = '#f6f2e7';
  41. return [theme, darkTheme];
  42. });
  43. </script>
  44. <style lang="scss">
  45. @use "@/common/scss/fonts.scss" as *;
  46. @use "@/common/scss/common.scss" as *;
  47. @use "@/common/scss/global/base.scss" as *;
  48. @use "@/components/index.scss" as *;
  49. page {
  50. background-color: #f6f2e7;
  51. overflow-x: hidden;
  52. }
  53. </style>