refactor: 完成项目目录重构与代码迁移

本次提交完成了整体项目的目录梳理与代码迁移:
1.  将根级controlplane、webhost等目录的代码迁移至desktop/对应子目录,统一桌面端架构
2.  移动并整理了插件目录结构,将插件统一放入根级plugins/
3.  调整了前端项目的路径与配置,统一前后端开发构建流程
4.  清理了废弃的旧版app/目录与冗余的构建中间文件
5.  更新了.gitignore与README.md,适配新的项目结构
This commit is contained in:
2026-09-14 17:46:09 +08:00
parent cb04790d28
commit 1e533dd1b3
131 changed files with 4071 additions and 38034 deletions
@@ -0,0 +1,112 @@
<template>
<div class="page">
<div class="page-head cp-rise">
<div>
<h3>概览 <span class="badge">Dashboard</span></h3>
<p>中心机 · 插件分发与账号权限 · 当前账号 <b class="who">{{ store.current }}</b></p>
</div>
<n-button :loading="overviewBusy" @click="refresh">
<template #icon><n-icon><Refresh /></n-icon></template>刷新
</n-button>
</div>
<div class="stat-grid" v-if="ov">
<div class="stat-card" v-for="(s, i) in stats" :key="s.label" :style="{ animationDelay: i * 60 + 'ms' }">
<div class="stat-ic" :style="{ background: s.bg, color: s.color }">
<n-icon :size="20"><component :is="s.icon" /></n-icon>
</div>
<div class="stat-meta">
<div class="stat-num" :class="{ sm: s.small }">{{ s.value }}</div>
<div class="stat-label">{{ s.label }}</div>
</div>
<span class="stat-glow" :style="{ background: s.color }"></span>
</div>
</div>
<n-skeleton v-else-if="overviewBusy" text :repeat="3" style="margin-top: 20px" />
<div class="tip-card cp-rise">
<div class="tip-ic"><n-icon :size="18"><InfoFilled /></n-icon></div>
<div class="tip-body">
<b>使用说明</b>
<p>「插件管理」上传与发布插件包(每插件保留最近 3 个版本);「账号管理」建号与账号维护;「权限授权」按账号勾选可用的插件与平台。部署机(webhost)仅在启动与手动刷新时拉取插件,授权变更后需在部署机刷新生效。</p>
</div>
</div>
</div>
</template>
<script setup>
import { computed, onMounted } from 'vue'
import { Refresh, InfoFilled } from '@element-plus/icons-vue'
import { store, overview, overviewBusy, loadOverview } from '../store'
import { message } from '../naive'
const ov = computed(() => overview.value)
const stats = computed(() => {
const plugins = ov.value?.plugins || []
return [
{ label: '插件', value: plugins.length, icon: 'Box', color: '#3b6cff', bg: 'linear-gradient(135deg,#eef2ff,#dbe6ff)' },
{ label: '版本总数', value: plugins.reduce((n, p) => n + (p.versions?.length || 0), 0), icon: 'Collection', color: '#7c5cff', bg: 'linear-gradient(135deg,#f2edff,#e6dcff)' },
{ label: '账号', value: (ov.value?.accounts || []).length, icon: 'User', color: '#12a4d8', bg: 'linear-gradient(135deg,#e7f6fb,#d3effa)' },
{ label: '管理员', value: (ov.value?.admins || []).length, icon: 'UserFilled', color: '#22b07a', bg: 'linear-gradient(135deg,#e6f7f0,#d2f1e4)' },
{ label: '最近上传', value: latest(), icon: 'UploadFilled', color: '#d99a1b', bg: 'linear-gradient(135deg,#fbf3e2,#f6e8c8)', small: true },
]
})
function latest() {
const all = (ov.value?.plugins || []).flatMap(p => p.versions || []).map(v => v.uploaded_at).filter(Boolean)
if (!all.length) return '—'
// ISO 时间转友好格式:2026-09-10T12:51:33 → 2026-09-10 12:51
return all.sort().at(-1).replace('T', ' ').slice(0, 16)
}
async function refresh() {
try { await loadOverview(true) } catch (e) { message.error('读取失败:' + (e.message || e)) }
}
onMounted(refresh)
</script>
<style scoped>
.stat-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
gap: 16px;
}
.stat-card {
position: relative; overflow: hidden;
display: flex; align-items: center; gap: 14px;
background: var(--cp-surface);
border: 1px solid var(--cp-border);
border-radius: 18px;
padding: 18px;
box-shadow: var(--cp-card-shadow);
transition: transform .22s ease, box-shadow .22s ease;
animation: cp-rise .5s cubic-bezier(.22, .61, .36, 1) both;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--cp-card-shadow-hover); }
.stat-ic {
width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
display: grid; place-items: center;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
}
.stat-meta { min-width: 0; }
.stat-num { font-size: 26px; font-weight: 800; letter-spacing: .3px; line-height: 1.15; color: var(--cp-ink); font-variant-numeric: tabular-nums; }
.stat-num.sm { font-size: 13px; font-weight: 600; word-break: break-all; line-height: 1.4; }
.stat-label { font-size: 12px; color: var(--cp-ink-3); margin-top: 3px; }
.stat-glow { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 0 6px 6px 0; opacity: .9; }
.tip-card {
margin-top: 18px;
display: flex; gap: 14px;
background: linear-gradient(135deg, rgba(59, 108, 255, .06), rgba(34, 199, 232, .05)), rgba(255, 255, 255, .7);
border: 1px solid rgba(59, 108, 255, .16);
border-radius: 16px;
padding: 18px 20px;
}
.tip-ic {
width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
display: grid; place-items: center;
background: linear-gradient(135deg, #3b6cff, #22c7e8);
color: #fff;
box-shadow: 0 6px 14px -6px rgba(59, 108, 255, .55);
}
.tip-body b { display: block; font-size: 14px; color: var(--cp-ink); margin-bottom: 4px; }
.tip-body p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--cp-ink-2); }
</style>