Files
MyTool/frontend/src/App.vue
mangmang 81977a157e Improve music processing robustness and workflow UX
Unify safe file-move behavior and richer progress semantics across backend tasks, while upgrading traditional-to-simplified conversion and refining the frontend multi-step panels for clearer execution feedback.
2026-03-08 04:26:18 +08:00

303 lines
7.1 KiB
Vue

<template>
<el-container class="app-root">
<el-aside width="220px" class="app-aside">
<div class="app-logo">
<span class="app-logo-title">MangTool</span>
<span class="app-logo-sub">音乐工具箱</span>
</div>
<el-menu
:default-active="activeKey"
class="app-menu"
@select="handleSelect"
>
<el-menu-item
v-for="tab in tabs"
:key="tab.key"
:index="tab.key"
>
{{ tab.menuLabel }}
</el-menu-item>
</el-menu>
</el-aside>
<el-container>
<el-header class="app-header">
<div class="app-header-title">
<h1>{{ currentTitle }}</h1>
<p>{{ currentSubtitle }}</p>
</div>
<div class="app-header-meta">
<span class="app-header-index">{{ currentTab.badge }}</span>
<span class="app-header-helper">执行面板</span>
</div>
</el-header>
<el-main class="app-main">
<component :is="currentComponent" />
</el-main>
</el-container>
</el-container>
</template>
<script setup lang="ts">
import { computed, defineAsyncComponent, ref } from 'vue';
import type { Component } from 'vue';
const AggregateTab = defineAsyncComponent(() => import('./components/AggregateTab.vue'));
const ConvertTab = defineAsyncComponent(() => import('./components/ConvertTab.vue'));
const DedupTab = defineAsyncComponent(() => import('./components/DedupTab.vue'));
const TraditionalFilterTab = defineAsyncComponent(() => import('./components/TraditionalFilterTab.vue'));
const RenameTab = defineAsyncComponent(() => import('./components/RenameTab.vue'));
const MergeTab = defineAsyncComponent(() => import('./components/MergeTab.vue'));
const SettingsTab = defineAsyncComponent(() => import('./components/SettingsTab.vue'));
type TabKey =
| 'aggregate'
| 'convert'
| 'dedup'
| 'zhconvert'
| 'organize'
| 'merge'
| 'settings';
interface TabDefinition {
key: TabKey;
menuLabel: string;
badge: string;
title: string;
subtitle: string;
component: Component;
}
const tabs: TabDefinition[] = [
{
key: 'aggregate',
menuLabel: '01 音频文件汇聚',
badge: 'STEP 01',
title: '01 · 音频文件汇聚',
subtitle: '将分散音频扁平化汇聚,为后续处理统一入口。',
component: AggregateTab
},
{
key: 'convert',
menuLabel: '02 音频格式智能处理',
badge: 'STEP 02',
title: '02 · 音频格式智能处理',
subtitle: '智能识别无损/有损格式并统一转码为 FLAC。',
component: ConvertTab
},
{
key: 'dedup',
menuLabel: '03 音乐去重',
badge: 'STEP 03',
title: '03 · 音乐去重',
subtitle: '基于 MD5 与元数据的双重策略进行音乐去重。',
component: DedupTab
},
{
key: 'zhconvert',
menuLabel: '04 元数据繁简转换',
badge: 'STEP 04',
title: '04 · 音乐元数据繁体转简体',
subtitle: '批量检测并转换标签中的繁体中文。',
component: TraditionalFilterTab
},
{
key: 'organize',
menuLabel: '05 音乐整理',
badge: 'STEP 05',
title: '05 · 音乐整理',
subtitle: '按 Navidrome 规范重命名与整理目录结构。',
component: RenameTab
},
{
key: 'merge',
menuLabel: '06 整理入库',
badge: 'STEP 06',
title: '06 · 整理入库',
subtitle: '将整理好的 staging 目录智能合并入主库。',
component: MergeTab
},
{
key: 'settings',
menuLabel: '全局设置',
badge: 'CONFIG',
title: '全局配置与路径设置',
subtitle: '配置全局工作目录与各阶段标准子目录。',
component: SettingsTab
}
];
const tabMap = tabs.reduce((acc, tab) => {
acc[tab.key] = tab;
return acc;
}, {} as Record<TabKey, TabDefinition>);
const activeKey = ref<TabKey>('aggregate');
const currentTab = computed(() => tabMap[activeKey.value] || tabs[0]);
const currentComponent = computed(() => currentTab.value.component);
const currentTitle = computed(() => currentTab.value.title);
const currentSubtitle = computed(() => currentTab.value.subtitle);
function handleSelect(key: string) {
activeKey.value = key as TabKey;
}
</script>
<style scoped>
.app-root {
min-height: 100vh;
padding: 18px;
background:
radial-gradient(circle at 12% 12%, rgba(15, 118, 110, 0.13), transparent 45%),
radial-gradient(circle at 78% 4%, rgba(14, 116, 144, 0.16), transparent 40%),
linear-gradient(145deg, #f8fbff 0%, #f3f7fd 42%, #eef5fa 100%);
}
.app-aside {
margin-right: 14px;
border: 1px solid rgba(148, 163, 184, 0.28);
border-radius: 20px;
padding: 18px 12px;
background: rgba(255, 255, 255, 0.78);
backdrop-filter: blur(12px);
box-shadow:
0 20px 45px -30px rgba(15, 23, 42, 0.45),
inset 0 1px 0 rgba(255, 255, 255, 0.6);
display: flex;
flex-direction: column;
}
.app-logo {
padding: 2px 14px 16px;
border-bottom: 1px solid rgba(148, 163, 184, 0.26);
margin-bottom: 14px;
}
.app-logo-title {
display: block;
font-size: 24px;
font-weight: 700;
letter-spacing: 0.4px;
color: #0f172a;
}
.app-logo-sub {
display: block;
margin-top: 4px;
font-size: 13px;
letter-spacing: 1.3px;
text-transform: uppercase;
color: #475569;
}
.app-menu {
flex: 1;
border-right: none;
}
.app-menu :deep(.el-menu-item) {
height: 44px;
line-height: 44px;
border-radius: 11px;
margin: 2px 6px;
color: #334155;
transition: all 0.2s ease;
}
.app-menu :deep(.el-menu-item:hover) {
color: #0f172a;
background: rgba(15, 118, 110, 0.08);
}
.app-menu :deep(.el-menu-item.is-active) {
color: #0f766e;
font-weight: 600;
background: linear-gradient(95deg, rgba(15, 118, 110, 0.14), rgba(14, 116, 144, 0.07));
}
.app-header {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 88px;
padding: 0 26px;
border: 1px solid rgba(148, 163, 184, 0.22);
border-radius: 18px;
background: rgba(255, 255, 255, 0.88);
backdrop-filter: blur(10px);
box-shadow: 0 16px 35px -30px rgba(15, 23, 42, 0.45);
}
.app-header-title h1 {
margin: 0;
font-size: 22px;
font-weight: 700;
color: #0f172a;
}
.app-header-title p {
margin: 6px 0 0;
font-size: 14px;
color: #475569;
}
.app-header-meta {
display: flex;
align-items: center;
gap: 10px;
}
.app-header-index {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 30px;
padding: 0 12px;
border-radius: 999px;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.8px;
color: #0b5f59;
background: rgba(15, 118, 110, 0.12);
}
.app-header-helper {
font-size: 13px;
color: #64748b;
}
.app-main {
margin-top: 14px;
border-radius: 18px;
padding: 20px;
background: rgba(255, 255, 255, 0.66);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
@media (max-width: 992px) {
.app-root {
padding: 12px;
}
.app-aside {
width: 100% !important;
margin-right: 0;
margin-bottom: 12px;
}
.app-header {
padding: 16px;
min-height: auto;
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
.app-main {
margin-top: 10px;
padding: 14px;
}
}
</style>