123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <template>
- <a-config-provider :locale="locale">
- <div class="public_local_loading" :class="{ 'hidden-loading': !systemStore.getLocalLoading }">
- <div class="public_local_loading_bg">
- <a-spin class="public_local_loading_logo" dot />
- </div>
- </div>
- <router-view v-if="isRouterActive" />
- </a-config-provider>
- </template>
- <script setup>
- import { ref, onMounted, nextTick, provide } from "vue"
- import { useDarkThemeHook, useLang } from '@/hooks'
- import { useSystemStore } from '@/store/modules/systemStore'
- import { dictionaryList } from "@/api/path/dict"
- const isRouterActive = ref(true)
- // 全局语言
- const { locale } = useLang()
- const systemStore = useSystemStore()
- // 暗黑主题
- useDarkThemeHook()
- provide('reloadRoutePage', () => {
- isRouterActive.value = false
- nextTick(() => {
- isRouterActive.value = true
- })
- })
- onMounted(async () => {
- const getLoadingNode = document.getElementById('Loading')
- const { body } = document
- if (getLoadingNode) {
- body.removeChild(getLoadingNode)
- }
- if (systemStore?.token) {
- const { code, data } = await dictionaryList({
- size: 99999,
- current: 1,
- })
- if (code == 200) {
- window.localStorage.setItem('dictList', JSON.stringify(data.records))
- }
- }
- })
- </script>
- <style lang="less">
- body {
- overflow: hidden;
- }
- // 加载loading css
- .public_local_loading {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 2000;
- display: flex;
- justify-content: center;
- align-items: center;
- .public_local_loading_bg {
- width: 12rem;
- height: 12rem;
- position: sticky;
- left: 50%;
- top: 50%;
- transform: translate3d(-50%, -50%, 0);
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .public_local_loading_logo {
- font-size: 2rem;
- user-select: none;
- }
- }
- .hidden-loading.public_local_loading {
- opacity: 0;
- z-index: -10 !important;
- cursor: auto !important;
- }
- @keyframes r-loading {
- 0% {
- transform: rotate(0deg);
- }
- 100% {
- transform: rotate(360deg);
- }
- }
- </style>
|