feat: 保持浏览器登录,并显示我的学时里的本月学时

This commit is contained in:
2026-10-27 04:52:39 +08:00
parent afda5a883f
commit 7bbb80ee9c
10 changed files with 318 additions and 35 deletions
+17 -10
View File
@@ -1,13 +1,13 @@
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from "vue";
import { NButton, NIcon, NLayout, NLayoutSider, NMenu, NTooltip } from "naive-ui";
import { NButton, NDropdown, NIcon, NLayout, NLayoutSider, NMenu, NTooltip } from "naive-ui";
import { LogOutOutline, MoonOutline, PersonOutline, SunnyOutline } from "@vicons/ionicons5";
import { isDark, toggleTheme } from "../shared/theme";
import { navOptions, type PageKey } from "./navigation";
import HomeView from "../features/home/HomeView.vue";
const props = defineProps<{ employeeId: string }>();
const emit = defineEmits<{ logout: [] }>();
const emit = defineEmits<{ logout: []; revoke: [] }>();
const page = ref<PageKey>("home");
const collapsed = ref(window.innerWidth < 800);
@@ -18,9 +18,19 @@ function onResize() {
onMounted(() => window.addEventListener("resize", onResize));
onUnmounted(() => window.removeEventListener("resize", onResize));
const logoutOptions = [
{ label: "退出当前系统", key: "logout" },
{ label: "注销当前账号", key: "revoke" },
];
function onMenu(key: string) {
if (key === "home") page.value = key;
}
function onLogout(key: string) {
if (key === "revoke") emit("revoke");
else emit("logout");
}
</script>
<template>
@@ -64,14 +74,11 @@ function onMenu(key: string) {
</template>
{{ isDark ? "切换到日间" : "切换到夜间" }}
</n-tooltip>
<n-tooltip>
<template #trigger>
<n-button class="logout-btn" quaternary circle size="small" aria-label="退出" @click="emit('logout')">
<template #icon><n-icon><LogOutOutline /></n-icon></template>
</n-button>
</template>
退出
</n-tooltip>
<n-dropdown trigger="hover" placement="top-end" :options="logoutOptions" @select="onLogout">
<n-button class="logout-btn" quaternary circle size="small" aria-label="退出">
<template #icon><n-icon><LogOutOutline /></n-icon></template>
</n-button>
</n-dropdown>
</div>
</div>
</n-layout-sider>