2022-04-21 18:20:39 +08:00
|
|
|
<script lang="ts" setup>
|
2023-06-14 18:14:47 +08:00
|
|
|
import { storeToRefs } from "pinia"
|
2022-04-22 12:47:04 +08:00
|
|
|
import { useSettingsStore } from "@/store/modules/settings"
|
2023-06-30 18:03:19 +08:00
|
|
|
import { removeConfigLayout } from "@/utils/cache/local-storage"
|
|
|
|
import { Refresh } from "@element-plus/icons-vue"
|
2022-04-21 18:20:39 +08:00
|
|
|
|
|
|
|
const settingsStore = useSettingsStore()
|
2023-06-14 18:14:47 +08:00
|
|
|
|
|
|
|
/** 使用 storeToRefs 将提取的属性保持其响应性 */
|
|
|
|
const {
|
|
|
|
showTagsView,
|
|
|
|
showSidebarLogo,
|
|
|
|
fixedHeader,
|
|
|
|
showNotify,
|
|
|
|
showThemeSwitch,
|
|
|
|
showScreenfull,
|
2023-06-30 12:50:24 +08:00
|
|
|
cacheTagsView,
|
2023-06-14 18:14:47 +08:00
|
|
|
showGreyMode,
|
|
|
|
showColorWeakness
|
|
|
|
} = storeToRefs(settingsStore)
|
|
|
|
|
|
|
|
/** 定义 switch 设置项 */
|
|
|
|
const switchSettings = {
|
|
|
|
显示标签栏: showTagsView,
|
|
|
|
"显示侧边栏 Logo": showSidebarLogo,
|
|
|
|
"固定 Header": fixedHeader,
|
|
|
|
显示消息通知: showNotify,
|
|
|
|
显示切换主题按钮: showThemeSwitch,
|
|
|
|
显示全屏按钮: showScreenfull,
|
2023-06-30 12:50:24 +08:00
|
|
|
是否缓存标签栏: cacheTagsView,
|
2023-06-14 18:14:47 +08:00
|
|
|
显示灰色模式: showGreyMode,
|
|
|
|
显示色弱模式: showColorWeakness
|
|
|
|
}
|
2023-06-30 18:03:19 +08:00
|
|
|
|
|
|
|
/** 重置配置 */
|
|
|
|
const reset = () => {
|
|
|
|
removeConfigLayout()
|
|
|
|
location.reload()
|
|
|
|
}
|
2022-04-21 18:20:39 +08:00
|
|
|
</script>
|
|
|
|
|
2022-04-22 12:47:04 +08:00
|
|
|
<template>
|
2023-06-14 18:14:47 +08:00
|
|
|
<div class="setting-container">
|
|
|
|
<h4>系统布局配置</h4>
|
|
|
|
<div class="setting-item" v-for="(settingValue, settingName, index) in switchSettings" :key="index">
|
|
|
|
<span class="setting-name">{{ settingName }}</span>
|
|
|
|
<el-switch v-model="settingValue.value" />
|
2022-04-22 12:47:04 +08:00
|
|
|
</div>
|
2023-06-30 18:03:19 +08:00
|
|
|
<el-button type="danger" :icon="Refresh" @click="reset">重 置</el-button>
|
2022-04-22 12:47:04 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-04-21 18:20:39 +08:00
|
|
|
<style lang="scss" scoped>
|
2023-06-14 18:14:47 +08:00
|
|
|
@import "@/styles/mixins.scss";
|
|
|
|
|
|
|
|
.setting-container {
|
|
|
|
padding: 20px;
|
|
|
|
.setting-item {
|
2022-04-21 18:20:39 +08:00
|
|
|
font-size: 14px;
|
2023-06-14 18:14:47 +08:00
|
|
|
padding: 6px 0;
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
.setting-name {
|
|
|
|
@include ellipsis;
|
|
|
|
}
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
2023-06-30 18:03:19 +08:00
|
|
|
.el-button {
|
|
|
|
margin-top: 40px;
|
|
|
|
width: 100%;
|
|
|
|
}
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
</style>
|