2024-05-31 09:18:45 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { useDark, useWindowSize, useThrottleFn } from '@vueuse/core'
|
2024-05-31 09:53:08 +08:00
|
|
|
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
2024-05-31 09:18:45 +08:00
|
|
|
import useAppStore from './stores/modules/app'
|
|
|
|
import useSettingStore from './stores/modules/setting'
|
|
|
|
import { ScreenEnum } from './enums/appEnums'
|
|
|
|
const appStore = useAppStore()
|
|
|
|
const settingStore = useSettingStore()
|
|
|
|
// const elConfig = {
|
|
|
|
// zIndex: 3000,
|
|
|
|
// locale: zhCn
|
|
|
|
// }
|
|
|
|
const isDark = useDark()
|
|
|
|
onMounted(async () => {
|
|
|
|
//设置主题色
|
|
|
|
settingStore.setTheme(isDark.value)
|
|
|
|
// 获取配置
|
|
|
|
const data: any = await appStore.getConfig()
|
|
|
|
// 设置网站logo
|
|
|
|
let favicon: HTMLLinkElement = document.querySelector('link[rel="icon"]')!
|
|
|
|
if (favicon) {
|
|
|
|
favicon.href = data.web_favicon
|
|
|
|
return
|
|
|
|
}
|
|
|
|
favicon = document.createElement('link')
|
|
|
|
favicon.rel = 'icon'
|
|
|
|
favicon.href = data.web_favicon
|
|
|
|
document.head.appendChild(favicon)
|
|
|
|
})
|
|
|
|
|
|
|
|
const { width } = useWindowSize()
|
|
|
|
watch(
|
|
|
|
width,
|
|
|
|
useThrottleFn((value) => {
|
|
|
|
if (value > ScreenEnum.SM) {
|
|
|
|
appStore.setMobile(false)
|
|
|
|
appStore.toggleCollapsed(false)
|
|
|
|
} else {
|
|
|
|
appStore.setMobile(true)
|
|
|
|
appStore.toggleCollapsed(true)
|
|
|
|
}
|
|
|
|
if (value < ScreenEnum.MD) {
|
|
|
|
appStore.toggleCollapsed(true)
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
{
|
|
|
|
immediate: true
|
|
|
|
}
|
|
|
|
)
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-05-31 09:53:08 +08:00
|
|
|
<el-config-provider :locale="zhCn">
|
2024-05-31 09:18:45 +08:00
|
|
|
<router-view />
|
|
|
|
</el-config-provider>
|
|
|
|
</template>
|
|
|
|
|
2024-06-05 18:08:37 +08:00
|
|
|
<style lang="scss">
|
|
|
|
/* .el-select__wrapper{
|
|
|
|
width: 280px;
|
|
|
|
} */
|
|
|
|
.el-select.w-\[280px\] {
|
|
|
|
width: 280px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-table th.el-table__cell>.cell {
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-table td.el-table__cell div {
|
|
|
|
text-align: center;
|
|
|
|
}
|
2024-06-04 18:17:33 +08:00
|
|
|
</style>
|