feat: 任务可调并发、可批量操作,导航栏可收缩
This commit is contained in:
+41
-22
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { NButton, NIcon, NLayoutSider, NMenu, useDialog } from "naive-ui";
|
||||
import { NButton, NIcon, NLayout, NLayoutSider, NMenu, useDialog } from "naive-ui";
|
||||
import { LogOutOutline, MoonOutline, PersonOutline, SunnyOutline } from "@vicons/ionicons5";
|
||||
import { logout, type UserInfo } from "../features/auth/api";
|
||||
import { loadActiveDownloadCount } from "../features/download/api";
|
||||
@@ -17,6 +17,7 @@ const dialog = useDialog();
|
||||
const page = ref<PageKey>("grid");
|
||||
const expanded = ref<string[]>([]);
|
||||
const focusId = ref("");
|
||||
const collapsed = ref(false);
|
||||
|
||||
function onMenu(key: string) {
|
||||
if (key === "grid" || key === "tasks") page.value = key;
|
||||
@@ -72,29 +73,47 @@ async function signOut() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="shell">
|
||||
<aside class="sider">
|
||||
<div class="sider-title">NqiTools</div>
|
||||
<n-layout-sider :native-scrollbar="false" :width="220" style="background: transparent; flex: 1; min-height: 0">
|
||||
<n-menu v-model:expanded-keys="expanded" :value="page" :options="navOptions" @update:value="onMenu" />
|
||||
</n-layout-sider>
|
||||
<div class="sider-user">
|
||||
<n-icon :size="18"><PersonOutline /></n-icon>
|
||||
<div class="who">
|
||||
<strong>{{ props.user.userName || props.user.loginId }}</strong>
|
||||
<span>{{ props.user.cityName || "已登录" }}</span>
|
||||
<n-layout has-sider class="shell">
|
||||
<n-layout-sider
|
||||
bordered
|
||||
collapse-mode="width"
|
||||
:collapsed-width="64"
|
||||
:width="220"
|
||||
:collapsed="collapsed"
|
||||
show-trigger
|
||||
:native-scrollbar="false"
|
||||
@collapse="collapsed = true"
|
||||
@expand="collapsed = false"
|
||||
>
|
||||
<div class="sider-body">
|
||||
<div class="sider-title">{{ collapsed ? "N" : "NqiTools" }}</div>
|
||||
<n-menu
|
||||
v-model:expanded-keys="expanded"
|
||||
:collapsed="collapsed"
|
||||
:collapsed-width="64"
|
||||
:collapsed-icon-size="22"
|
||||
:value="page"
|
||||
:options="navOptions"
|
||||
@update:value="onMenu"
|
||||
/>
|
||||
<div class="sider-user" :class="{ compact: collapsed }">
|
||||
<n-icon :size="18"><PersonOutline /></n-icon>
|
||||
<div v-if="!collapsed" class="who">
|
||||
<strong>{{ props.user.userName || props.user.loginId }}</strong>
|
||||
<span>{{ props.user.cityName || "已登录" }}</span>
|
||||
</div>
|
||||
<n-button quaternary circle size="small" :aria-label="isDark ? '切换到日间' : '切换到夜间'" @click="toggleTheme">
|
||||
<template #icon><n-icon><MoonOutline v-if="!isDark" /><SunnyOutline v-else /></n-icon></template>
|
||||
</n-button>
|
||||
<n-button quaternary circle size="small" aria-label="退出" @click="signOut">
|
||||
<template #icon><n-icon><LogOutOutline /></n-icon></template>
|
||||
</n-button>
|
||||
</div>
|
||||
<n-button quaternary circle size="small" :aria-label="isDark ? '切换到日间' : '切换到夜间'" @click="toggleTheme">
|
||||
<template #icon><n-icon><MoonOutline v-if="!isDark" /><SunnyOutline v-else /></n-icon></template>
|
||||
</n-button>
|
||||
<n-button quaternary circle size="small" aria-label="退出" @click="signOut">
|
||||
<template #icon><n-icon><LogOutOutline /></n-icon></template>
|
||||
</n-button>
|
||||
</div>
|
||||
</aside>
|
||||
<main class="content">
|
||||
</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" />
|
||||
</main>
|
||||
</div>
|
||||
</n-layout>
|
||||
</n-layout>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user