feat: 增加设置页和托盘,登录后关闭窗口留在托盘
This commit is contained in:
+18
-11
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { NButton, NIcon, NLayout, NLayoutSider, NMenu, NTooltip, useDialog } from "naive-ui";
|
||||
import { LogOutOutline, MoonOutline, PersonOutline, SunnyOutline } from "@vicons/ionicons5";
|
||||
import { LogOutOutline, MoonOutline, PersonOutline, SettingsOutline, SunnyOutline } from "@vicons/ionicons5";
|
||||
import { logout, type UserInfo } from "../features/auth/api";
|
||||
import { loadActiveDownloadCount } from "../features/download/api";
|
||||
import { ApiError } from "../shared/http";
|
||||
@@ -9,6 +9,7 @@ import { isDark, toggleTheme } from "../shared/theme";
|
||||
import { navOptions, type PageKey } from "./navigation";
|
||||
import GridDownloadView from "../features/download/GridDownloadView.vue";
|
||||
import DownloadManagerView from "../features/download/DownloadManagerView.vue";
|
||||
import SettingsView from "../features/settings/SettingsView.vue";
|
||||
|
||||
const props = defineProps<{ user: UserInfo }>();
|
||||
const emit = defineEmits<{ logout: [] }>();
|
||||
@@ -87,15 +88,6 @@ async function signOut() {
|
||||
@expand="collapsed = false"
|
||||
>
|
||||
<div class="sider-body">
|
||||
<div class="sider-title" :class="{ compact: collapsed }">
|
||||
<span class="brand-mark sider-mark" aria-hidden="true">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M4 16.5 12 4l8 12.5" stroke="currentColor" stroke-width="1.8" />
|
||||
<path d="M7.2 16.5h9.6M9.2 13.2h5.6" stroke="currentColor" stroke-width="1.8" />
|
||||
</svg>
|
||||
</span>
|
||||
<span v-if="!collapsed">NqiTools</span>
|
||||
</div>
|
||||
<n-menu
|
||||
v-model:expanded-keys="expanded"
|
||||
:collapsed="collapsed"
|
||||
@@ -105,6 +97,20 @@ async function signOut() {
|
||||
:options="navOptions"
|
||||
@update:value="onMenu"
|
||||
/>
|
||||
<div class="sider-settings" :class="{ compact: collapsed }">
|
||||
<n-tooltip v-if="collapsed">
|
||||
<template #trigger>
|
||||
<n-button quaternary :type="page === 'settings' ? 'primary' : 'default'" aria-label="设置" @click="page = 'settings'">
|
||||
<template #icon><n-icon><SettingsOutline /></n-icon></template>
|
||||
</n-button>
|
||||
</template>
|
||||
设置
|
||||
</n-tooltip>
|
||||
<n-button v-else quaternary :type="page === 'settings' ? 'primary' : 'default'" @click="page = 'settings'">
|
||||
<template #icon><n-icon><SettingsOutline /></n-icon></template>
|
||||
设置
|
||||
</n-button>
|
||||
</div>
|
||||
<div class="sider-user" :class="{ compact: collapsed }">
|
||||
<n-icon :size="18"><PersonOutline /></n-icon>
|
||||
<div v-if="!collapsed" class="who">
|
||||
@@ -132,7 +138,8 @@ async function signOut() {
|
||||
</n-layout-sider>
|
||||
<n-layout class="content">
|
||||
<GridDownloadView v-if="page === 'grid'" :city-name="props.user.cityName" @started="onStarted" />
|
||||
<DownloadManagerView v-else :focus-id="focusId" />
|
||||
<DownloadManagerView v-else-if="page === 'tasks'" :focus-id="focusId" />
|
||||
<SettingsView v-else />
|
||||
</n-layout>
|
||||
</n-layout>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user