2020-12-08 18:20:35 +08:00
|
|
|
<template>
|
2021-01-17 21:14:26 +08:00
|
|
|
<router-view v-show="getThemeConfig.lockScreenTime !== 0" />
|
2021-01-12 22:48:55 +08:00
|
|
|
<LockScreen v-if="getThemeConfig.isLockScreen" />
|
2021-01-17 21:14:26 +08:00
|
|
|
<Setings ref="setingsRef" v-show="getThemeConfig.lockScreenTime !== 0" />
|
2020-12-08 18:20:35 +08:00
|
|
|
</template>
|
2020-12-31 11:47:52 +08:00
|
|
|
|
|
|
|
<script lang="ts">
|
2021-01-17 21:14:26 +08:00
|
|
|
import {
|
|
|
|
computed,
|
|
|
|
ref,
|
|
|
|
getCurrentInstance,
|
|
|
|
onBeforeMount,
|
|
|
|
onMounted,
|
|
|
|
onUnmounted,
|
|
|
|
nextTick,
|
|
|
|
} from "vue";
|
2021-01-11 23:55:10 +08:00
|
|
|
import { useStore } from "/@/store/index.ts";
|
2021-01-17 21:14:26 +08:00
|
|
|
import { getLocal } from "/@/utils/storage.ts";
|
2021-02-14 00:47:25 +08:00
|
|
|
import setIntroduction from "/@/utils/setIconfont.ts";
|
2021-01-11 23:55:10 +08:00
|
|
|
import LockScreen from "/@/views/layout/lockScreen/index.vue";
|
2021-01-17 21:14:26 +08:00
|
|
|
import Setings from "/@/views/layout/navBars/breadcrumb/setings.vue";
|
2020-12-31 11:47:52 +08:00
|
|
|
export default {
|
|
|
|
name: "app",
|
2021-01-17 21:14:26 +08:00
|
|
|
components: { LockScreen, Setings },
|
2020-12-31 11:47:52 +08:00
|
|
|
setup() {
|
2021-01-17 21:14:26 +08:00
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
const setingsRef = ref();
|
2021-01-11 23:55:10 +08:00
|
|
|
const store = useStore();
|
2021-01-12 22:48:55 +08:00
|
|
|
// 获取布局配置信息
|
|
|
|
const getThemeConfig = computed(() => {
|
|
|
|
return store.state.themeConfig;
|
|
|
|
});
|
2021-01-17 21:14:26 +08:00
|
|
|
// 布局配置弹窗打开
|
|
|
|
const openSetingsDrawer = () => {
|
|
|
|
setingsRef.value.openDrawer();
|
|
|
|
};
|
|
|
|
// 设置初始化,防止刷新时恢复默认
|
2020-12-31 11:47:52 +08:00
|
|
|
onBeforeMount(() => {
|
2021-01-17 21:14:26 +08:00
|
|
|
// 设置批量第三方 icon 图标
|
2021-02-14 00:47:25 +08:00
|
|
|
setIntroduction.cssCdn();
|
|
|
|
// 设置批量第三方 js
|
|
|
|
setIntroduction.jsCdn();
|
2021-01-17 21:14:26 +08:00
|
|
|
});
|
2021-02-28 22:19:28 +08:00
|
|
|
// 页面加载时
|
2021-01-17 21:14:26 +08:00
|
|
|
onMounted(() => {
|
|
|
|
nextTick(() => {
|
|
|
|
// 监听布局配置弹窗点击打开
|
|
|
|
proxy.mittBus.on("openSetingsDrawer", () => {
|
|
|
|
openSetingsDrawer();
|
|
|
|
});
|
|
|
|
// 获取缓存中的布局配置
|
|
|
|
if (getLocal("themeConfig")) {
|
|
|
|
store.dispatch("setThemeConfig", getLocal("themeConfig"));
|
|
|
|
document.documentElement.style.cssText = getLocal("themeConfigStyle");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// 页面销毁时,关闭监听布局配置
|
|
|
|
onUnmounted(() => {
|
|
|
|
proxy.mittBus.off("openSetingsDrawer", () => {});
|
2020-12-31 11:47:52 +08:00
|
|
|
});
|
2021-01-12 22:48:55 +08:00
|
|
|
return {
|
2021-01-17 21:14:26 +08:00
|
|
|
setingsRef,
|
2021-01-12 22:48:55 +08:00
|
|
|
getThemeConfig,
|
|
|
|
};
|
2020-12-31 11:47:52 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|