feat: SettingsDrawer
This commit is contained in:
19
src/components/global/settings-drawer.vue
Normal file
19
src/components/global/settings-drawer.vue
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { NDivider, NDrawer, NDrawerContent, NFlex } from 'naive-ui';
|
||||||
|
import ThemeSwitch from './theme-switch.vue';
|
||||||
|
|
||||||
|
const show = defineModel<boolean>('show');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NDrawer v-model:show="show" :width="330">
|
||||||
|
<NDrawerContent closable title="系统设置" :native-scrollbar="false">
|
||||||
|
<NFlex vertical justify="center">
|
||||||
|
<NDivider>主题</NDivider>
|
||||||
|
<ThemeSwitch />
|
||||||
|
</NFlex>
|
||||||
|
</NDrawerContent>
|
||||||
|
</NDrawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
@@ -3,13 +3,16 @@ import { useThemeStore } from '@/stores/theme';
|
|||||||
import { MoonOutline, SunnyOutline } from '@vicons/ionicons5';
|
import { MoonOutline, SunnyOutline } from '@vicons/ionicons5';
|
||||||
import { NIcon, NSwitch } from 'naive-ui';
|
import { NIcon, NSwitch } from 'naive-ui';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
import type { ComponentInstance } from 'vue';
|
||||||
|
|
||||||
const themeStore = useThemeStore();
|
const themeStore = useThemeStore();
|
||||||
const { darkThemeEnabled } = storeToRefs(themeStore);
|
const { darkThemeEnabled } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
defineExpose({} as ComponentInstance<typeof NSwitch>);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NSwitch v-model:value="darkThemeEnabled" size="small">
|
<NSwitch v-model:value="darkThemeEnabled">
|
||||||
<template #unchecked-icon>
|
<template #unchecked-icon>
|
||||||
<NIcon :component="SunnyOutline" />
|
<NIcon :component="SunnyOutline" />
|
||||||
</template>
|
</template>
|
||||||
@@ -19,4 +22,4 @@ const { darkThemeEnabled } = storeToRefs(themeStore);
|
|||||||
</NSwitch>
|
</NSwitch>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ function renderIcon(icon: Component): () => VNode {
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmDeviceAlarmLogResultVO } from '@/apis/models';
|
import type { NdmDeviceAlarmLogResultVO } from '@/apis/models';
|
||||||
import ThemeSwitch from '@/components/global/theme-switch.vue';
|
import SettingsDrawer from '@/components/global/settings-drawer.vue';
|
||||||
import { useStationListQuery } from '@/composables/query';
|
import { useStationListQuery } from '@/composables/query';
|
||||||
import { useCurrentAlarmsStore } from '@/stores/current-alarms';
|
import { useCurrentAlarmsStore } from '@/stores/current-alarms';
|
||||||
import { useUserStore } from '@/stores/user';
|
import { useUserStore } from '@/stores/user';
|
||||||
import { Client as StompClient } from '@stomp/stompjs';
|
import { Client as StompClient } from '@stomp/stompjs';
|
||||||
import { AlertFilled, /* AreaChartOutlined, */ FileTextFilled, HomeFilled, LogoutOutlined, VideoCameraFilled } from '@vicons/antd';
|
import { AlertFilled, /* AreaChartOutlined, */ FileTextFilled, HomeFilled, LogoutOutlined, SettingOutlined, VideoCameraFilled } from '@vicons/antd';
|
||||||
import { ChevronDown, Debug } from '@vicons/carbon';
|
import { ChevronDown, Debug } from '@vicons/carbon';
|
||||||
import type { AxiosError } from 'axios';
|
import type { AxiosError } from 'axios';
|
||||||
import { destr } from 'destr';
|
import { destr } from 'destr';
|
||||||
@@ -146,6 +146,11 @@ const toAlarmPage = () => {
|
|||||||
router.push('/alarm');
|
router.push('/alarm');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const settingsDrawerShow = ref(false);
|
||||||
|
const openSettingsDrawer = () => {
|
||||||
|
settingsDrawerShow.value = true;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -158,10 +163,10 @@ const toAlarmPage = () => {
|
|||||||
<NLayoutHeader bordered class="app-layout-header">
|
<NLayoutHeader bordered class="app-layout-header">
|
||||||
<NFlex justify="space-between" align="center" :size="8" style="width: 100%; height: 100%">
|
<NFlex justify="space-between" align="center" :size="8" style="width: 100%; height: 100%">
|
||||||
<span style="font-size: 16px; font-weight: 500; margin-left: 16px; cursor: pointer" @click="toDashboardPage">网络设备管理平台</span>
|
<span style="font-size: 16px; font-weight: 500; margin-left: 16px; cursor: pointer" @click="toDashboardPage">网络设备管理平台</span>
|
||||||
<NFlex align="center" :size="8">
|
<NFlex align="center" :size="0" style="height: 100%">
|
||||||
<ThemeSwitch />
|
<!-- <ThemeSwitch /> -->
|
||||||
<NDropdown trigger="hover" show-arrow :options="dropdownOptions" @select="selectDropdownOption">
|
<NDropdown trigger="hover" show-arrow :options="dropdownOptions" @select="selectDropdownOption">
|
||||||
<NButton secondary icon-placement="right" style="margin-right: 8px">
|
<NButton :focusable="false" quaternary icon-placement="right" style="height: 100%">
|
||||||
<template #default>
|
<template #default>
|
||||||
<span>{{ userInfo?.nickName ?? '' }}</span>
|
<span>{{ userInfo?.nickName ?? '' }}</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -170,6 +175,13 @@ const toAlarmPage = () => {
|
|||||||
</template>
|
</template>
|
||||||
</NButton>
|
</NButton>
|
||||||
</NDropdown>
|
</NDropdown>
|
||||||
|
<NButton :focusable="false" quaternary @click="openSettingsDrawer" style="height: 100%">
|
||||||
|
<template #icon>
|
||||||
|
<NIcon>
|
||||||
|
<SettingOutlined />
|
||||||
|
</NIcon>
|
||||||
|
</template>
|
||||||
|
</NButton>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
</NLayoutHeader>
|
</NLayoutHeader>
|
||||||
@@ -192,6 +204,7 @@ const toAlarmPage = () => {
|
|||||||
</NLayout>
|
</NLayout>
|
||||||
</NLayout>
|
</NLayout>
|
||||||
</NScrollbar>
|
</NScrollbar>
|
||||||
|
<SettingsDrawer v-model:show="settingsDrawerShow" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user