2023-03-04 09:16:33 +08:00
|
|
|
<template>
|
2023-05-04 09:25:35 +08:00
|
|
|
<el-config-provider :locale="i18nLocale" v-if="isRouterAlive" :button="config" :size="assemblySize">
|
2023-03-04 09:16:33 +08:00
|
|
|
<router-view></router-view>
|
|
|
|
|
</el-config-provider>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2023-09-22 11:50:33 +08:00
|
|
|
import { ref, reactive, computed, nextTick, provide, onMounted } from "vue";
|
2023-03-04 09:16:33 +08:00
|
|
|
import { GlobalStore } from "@/stores";
|
2023-09-11 14:41:08 +08:00
|
|
|
// import { useTheme } from "@/hooks/useTheme";
|
2023-03-04 09:16:33 +08:00
|
|
|
import { getBrowserLang } from "@/utils/util";
|
|
|
|
|
import { ElConfigProvider } from "element-plus";
|
|
|
|
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
|
|
|
|
import en from "element-plus/es/locale/lang/en";
|
2023-09-22 11:50:33 +08:00
|
|
|
import { getSystemConfig } from "@/api/modules/jxjview";
|
2023-03-04 09:16:33 +08:00
|
|
|
|
2023-09-11 14:41:08 +08:00
|
|
|
// // 初始化主题配置
|
|
|
|
|
// const { initTheme } = useTheme();
|
|
|
|
|
// initTheme();
|
2023-03-04 09:16:33 +08:00
|
|
|
|
2023-05-04 09:25:35 +08:00
|
|
|
const isRouterAlive = ref(true);
|
|
|
|
|
const reload = () => {
|
|
|
|
|
isRouterAlive.value = false;
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
isRouterAlive.value = true;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
provide("reload", reload);
|
|
|
|
|
|
2023-03-04 09:16:33 +08:00
|
|
|
const globalStore = GlobalStore();
|
|
|
|
|
// 配置element按钮文字中间是否有空格
|
|
|
|
|
const config = reactive({
|
|
|
|
|
autoInsertSpace: false
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// element 语言配置
|
|
|
|
|
const i18nLocale = computed(() => {
|
|
|
|
|
if (globalStore.language && globalStore.language == "zh") return zhCn;
|
|
|
|
|
if (globalStore.language == "en") return en;
|
|
|
|
|
return getBrowserLang() == "zh" ? zhCn : en;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 配置全局组件大小
|
|
|
|
|
const assemblySize = computed(() => globalStore.assemblySize);
|
2023-09-22 11:50:33 +08:00
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
const res = await getSystemConfig({ configKey: "system_login_background" });
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.result && res.result.length > 0) {
|
|
|
|
|
globalStore.systemConfigBg = res.result[0].configValue;
|
|
|
|
|
}
|
|
|
|
|
const res2 = await getSystemConfig({ configKey: "system_logo" });
|
|
|
|
|
console.log(res2);
|
|
|
|
|
if (res2.result && res2.result.length > 0) {
|
|
|
|
|
globalStore.systemConfigLogo = res2.result[0].configValue;
|
|
|
|
|
}
|
|
|
|
|
const res3 = await getSystemConfig({ configKey: "system_name" });
|
|
|
|
|
console.log(res3);
|
|
|
|
|
if (res3.result && res3.result.length > 0) {
|
|
|
|
|
globalStore.systemConfigName = res3.result[0].configValue;
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-03-04 09:16:33 +08:00
|
|
|
</script>
|
2023-03-20 15:49:41 +08:00
|
|
|
<style lang="scss">
|
2023-04-07 17:06:54 +08:00
|
|
|
// 地图的搜索层级功能 去掉或者加上scope就会导致地图搜索失效
|
2023-03-20 15:49:41 +08:00
|
|
|
.amap-sug-result {
|
|
|
|
|
z-index: 2999 !important;
|
|
|
|
|
.auto-item {
|
|
|
|
|
padding-left: 8px;
|
|
|
|
|
padding-right: 8px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|