Files
orion-visor/orion-ops-ui/src/components/global-setting/index.vue

114 lines
2.2 KiB
Vue
Raw Normal View History

2023-07-24 10:05:07 +08:00
<template>
<div v-if="!appStore.navbar" class="fixed-settings" @click="setVisible">
<a-button type="primary">
<template #icon>
<icon-settings />
</template>
</a-button>
</div>
2023-09-25 22:05:48 +08:00
<a-drawer title="偏好设置"
:width="300"
unmount-on-close
:visible="visible"
ok-text="保存"
cancel-text="关闭"
@ok="saveConfig"
@cancel="cancel">
<Block :options="contentOpts" title="内容区域" />
<Block :options="othersOpts" title="其他设置" />
2023-07-24 10:05:07 +08:00
</a-drawer>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import { useAppStore } from '@/store';
import Block from './block.vue';
const emit = defineEmits(['cancel']);
const appStore = useAppStore();
const visible = computed(() => appStore.globalSettings);
2023-07-27 18:48:15 +08:00
/**
* 内容配置
*/
2023-07-24 10:05:07 +08:00
const contentOpts = computed(() => [
2023-07-27 18:48:15 +08:00
{
2023-09-25 22:05:48 +08:00
name: '导航栏',
2023-07-27 18:48:15 +08:00
key: 'navbar',
defaultVal: appStore.navbar
},
2023-07-24 10:05:07 +08:00
{
2023-09-25 22:05:48 +08:00
name: '菜单栏',
2023-07-24 10:05:07 +08:00
key: 'menu',
defaultVal: appStore.menu,
},
{
2023-09-25 22:05:48 +08:00
name: '顶部菜单栏',
2023-07-24 10:05:07 +08:00
key: 'topMenu',
defaultVal: appStore.topMenu,
},
{
2023-09-25 22:05:48 +08:00
name: '底部',
2023-07-27 18:48:15 +08:00
key: 'footer',
2023-09-25 22:05:48 +08:00
defaultVal: appStore.footer
2023-07-27 18:48:15 +08:00
},
{
2023-09-25 22:05:48 +08:00
name: '多页签',
2023-07-27 18:48:15 +08:00
key: 'tabBar',
defaultVal: appStore.tabBar
2023-07-24 10:05:07 +08:00
},
{
2023-09-25 22:05:48 +08:00
name: '菜单宽度 (px)',
2023-07-24 10:05:07 +08:00
key: 'menuWidth',
defaultVal: appStore.menuWidth,
type: 'number',
},
]);
2023-07-27 18:48:15 +08:00
/**
* 其他配置
*/
2023-07-24 10:05:07 +08:00
const othersOpts = computed(() => [
{
2023-09-25 22:05:48 +08:00
name: '色弱模式',
2023-07-24 10:05:07 +08:00
key: 'colorWeak',
defaultVal: appStore.colorWeak,
},
]);
2023-07-27 18:48:15 +08:00
/**
* 取消配置
*/
2023-07-24 10:05:07 +08:00
const cancel = () => {
appStore.updateSettings({ globalSettings: false });
emit('cancel');
};
2023-07-27 18:48:15 +08:00
/**
* 复制配置
*/
2023-09-25 22:05:48 +08:00
const saveConfig = async () => {
2023-07-24 10:05:07 +08:00
};
2023-07-27 18:48:15 +08:00
/**
* 显示菜单
*/
2023-07-24 10:05:07 +08:00
const setVisible = () => {
appStore.updateSettings({ globalSettings: true });
};
</script>
<style scoped lang="less">
.fixed-settings {
position: fixed;
top: 280px;
right: 0;
svg {
font-size: 18px;
vertical-align: -4px;
}
}
</style>