Files
37duAutomation/desktop/fileserver/frontend/index.html
T
puddy d3236e2c63 feat(fileserver): 新增内网文件服务器服务与管理页面
新增 FastAPI 文件服务器核心模块(配置、鉴权、存储、心跳上报),新增 HTTP 路由接口(健康检查、文件上传/下载/删除、管理登录/密码修改/统计),新增 Vue3 管理页面源码;新增 MySQL 元数据存储支持,新增 PyMySQL 依赖;新增 .gitignore 忽略 IDE 与备份文件;新增文件服务器工具脚本;删除旧的 build/ 脚本与 exe 构建产物,优化 Electron 平台登录逻辑为纯接口模式,新增平台账号环境变量注入,优化试用期异常检查逻辑,拆分服务岗转正流程为独立脚本。
2026-10-12 09:45:04 +08:00

425 lines
20 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>37du 文件服务器管理</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: "Comic Sans MS", "Comic Neue", "Segoe Print", "Marker Felt", "Bradley Hand", cursive;
background-color: #fffdf3;
background-image:
repeating-linear-gradient(transparent 0 31px, rgba(120, 150, 210, .15) 31px 32px),
url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.035'/></svg>");
color: #2b2b2b; font-size: 15px; min-height: 100vh;
}
::selection { background: #ffe066; color: #2b2b2b; }
/* ===== 手绘通用 ===== */
.hand { border: 2.5px solid #2b2b2b; border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; }
.squiggle {
display: inline-block; height: 7px; margin-top: 3px;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='7'><path d='M0 3 Q 10 0, 20 3 T 40 3 T 60 3 T 80 3 T 100 3 T 120 3 T 140 3' stroke='%23e8590c' stroke-width='2.6' fill='none' stroke-linecap='round'/></svg>");
background-repeat: no-repeat; background-size: 100% 100%;
}
.pin { position: absolute; font-size: 20px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.tape {
position: absolute; width: 92px; height: 26px; z-index: 2;
background: rgba(255, 224, 130, .62);
border-left: 2px dashed rgba(0,0,0,.18);
border-right: 2px dashed rgba(0,0,0,.18);
box-shadow: 0 2px 4px rgba(0,0,0,.12);
}
/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
position: relative; width: 410px; background: #fffef8;
border: 2.5px solid #2b2b2b;
border-radius: 15px 255px 15px 255px / 255px 15px 255px 15px;
box-shadow: 5px 7px 0 rgba(0,0,0,.12);
padding: 44px 38px 36px; transform: rotate(-.6deg);
}
.login-card .tape { top: -14px; left: 50%; margin-left: -46px; transform: rotate(-3deg); }
.login-card .pin { top: -12px; right: 22px; transform: rotate(12deg); }
.login-card .emblem {
width: 58px; height: 58px; border-radius: 50%;
background: #fff; border: 3px solid #2b2b2b;
display: flex; align-items: center; justify-content: center;
font-weight: 800; font-size: 24px; color: #e8590c;
transform: rotate(-7deg); box-shadow: 2px 3px 0 rgba(0,0,0,.14);
margin-bottom: 16px;
}
.login-card h2 { font-size: 27px; font-weight: 800; letter-spacing: .5px; }
.login-card .login-sub { font-size: 13px; color: #868e96; font-weight: 700; margin: 4px 0 20px; }
.login-field { position: relative; margin-bottom: 13px; }
.login-field input {
width: 100%; padding: 11px 44px 11px 14px;
border: 2.5px solid #2b2b2b;
border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
font-family: inherit; font-size: 15px; font-weight: 600; outline: none;
background: #fff;
}
.login-field input:focus { background: #fff9db; }
.eye { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 17px; user-select: none; }
.login-card .btn { width: 100%; padding: 12px; font-size: 16px; margin-top: 4px; }
.login-hint { margin-top: 14px; font-size: 12.5px; color: #868e96; font-weight: 700; }
.login-msg {
margin-top: 12px; background: #ffe3e3; color: #c92a2a;
padding: 10px 12px; font-weight: 700; font-size: 13px;
border: 2.5px dashed #c92a2a; border-radius: 15px 255px 15px 255px / 255px 15px 255px 15px;
}
/* ===== 顶栏(便签条)===== */
.header {
position: relative; background: #ffe066;
border-bottom: 3px solid #2b2b2b;
padding: 16px 30px;
display: flex; align-items: center; justify-content: space-between; gap: 16px;
transform: rotate(-.35deg); margin: 0 -4px;
}
.header .pin.l { top: 6px; left: 14px; transform: rotate(-14deg); }
.header .pin.r { top: 6px; right: 200px; transform: rotate(10deg); }
.header .brand { display: flex; align-items: center; gap: 14px; }
.header .emblem {
width: 48px; height: 48px; border-radius: 50%;
background: #fff; border: 3px solid #2b2b2b;
display: flex; align-items: center; justify-content: center;
font-weight: 800; font-size: 21px; color: #e8590c;
transform: rotate(-6deg); box-shadow: 2px 3px 0 rgba(0,0,0,.14);
}
.header h1 { font-size: 23px; font-weight: 800; line-height: 1.1; }
.header h1 .squiggle { width: 150px; }
.header .sub { font-size: 12.5px; color: #5c5c5c; font-weight: 700; margin-top: 2px; }
.header .actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* ===== 统计条 ===== */
.stats {
display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
padding: 22px 30px 18px;
}
.stat {
position: relative; background: #fffef8; padding: 12px 16px 13px;
border: 2.5px solid #2b2b2b;
border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
box-shadow: 3px 5px 0 rgba(0,0,0,.1);
transition: transform .18s ease, box-shadow .18s ease;
}
.stat:nth-child(odd) { transform: rotate(-1.2deg); }
.stat:nth-child(even) { transform: rotate(1deg); }
.stat:hover { transform: rotate(0) translateY(-3px); box-shadow: 5px 8px 0 rgba(0,0,0,.14); }
.stat .tape { top: -11px; left: 50%; margin-left: -46px; transform: rotate(-2deg); width: 74px; height: 22px; }
.stat .k { font-size: 12.5px; font-weight: 700; color: #868e96; letter-spacing: .5px; }
.stat .v { font-size: 23px; font-weight: 800; margin-top: 3px; color: #2b2b2b; }
.stat:nth-child(1) .v { color: #e8590c; }
.stat:nth-child(2) .v { color: #1971c2; }
.stat:nth-child(3) .v { color: #2f9e44; }
.stat:nth-child(4) .v { color: #9c36b5; }
/* ===== 工具栏 ===== */
.toolbar {
display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
padding: 8px 30px 18px;
}
.toolbar input[type="text"] {
padding: 9px 14px; border: 2.5px solid #2b2b2b;
border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
font-family: inherit; font-size: 14px; font-weight: 600; outline: none;
width: 280px; background: #fff;
}
.toolbar input[type="text"]:focus { background: #fff9db; }
.toolbar .hint { color: #868e96; font-size: 12.5px; font-weight: 700; }
/* ===== 按钮(标记笔)===== */
.btn {
font-family: inherit; font-weight: 700; font-size: 14.5px;
border: 2.5px solid #2b2b2b;
border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
background: #fff; color: #2b2b2b;
padding: 9px 18px; cursor: pointer;
box-shadow: 2px 3px 0 rgba(0,0,0,.14);
transition: transform .12s ease, background .12s ease;
user-select: none;
}
.btn:hover { transform: rotate(-1.6deg) scale(1.04); }
.btn:active { transform: rotate(0) translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.14); }
.btn-primary { background: #ffe066; }
.btn-primary:hover { background: #ffd43b; }
.btn-success { background: #b2f2bb; }
.btn-success:hover { background: #8ce99a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.upload-btn input[type="file"] { display: none; }
.tag {
display: inline-block; padding: 6px 12px;
border: 2.5px solid #2b2b2b;
border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
font-size: 13px; font-weight: 700; background: #ffd8a8; color: #2b2b2b;
transform: rotate(-1deg); box-shadow: 2px 3px 0 rgba(0,0,0,.1);
}
/* ===== 状态条(标记笔高亮)===== */
.status-bar { display: none; padding: 11px 30px; font-weight: 700; font-size: 14px; }
.status-bar.ok { display: block; background: #fff3bf; color: #2b2b2b; border-bottom: 2.5px dashed #f59f00; }
.status-bar.err { display: block; background: #ffe3e3; color: #c92a2a; border-bottom: 2.5px dashed #e03131; }
.main { padding: 8px 30px 30px; }
/* ===== 主卡片(纸页 + 折角)===== */
.card {
position: relative; background: #fffef8;
border: 2.5px solid #2b2b2b;
border-radius: 15px 255px 15px 255px / 255px 15px 255px 15px;
box-shadow: 5px 7px 0 rgba(0,0,0,.1);
transform: rotate(.2deg);
}
.card > .tape { top: -13px; left: 50%; margin-left: -46px; transform: rotate(-3deg); }
.card::after {
content: ""; position: absolute; top: 0; right: 0;
width: 0; height: 0;
border-style: solid;
border-width: 0 0 30px 30px;
border-color: transparent transparent #ffe066 transparent;
filter: drop-shadow(-2px 2px 1px rgba(0,0,0,.08));
}
/* ===== 加载中(翻本子)===== */
.loading {
padding: 70px; text-align: center; font-weight: 800; font-size: 18px; color: #495057;
}
.loading .pen { display: inline-block; animation: pen 1.1s ease-in-out infinite; }
@keyframes pen {
0%, 100% { transform: rotate(-8deg) translateY(0); }
50% { transform: rotate(10deg) translateY(-6px); }
}
/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; }
th {
background: #fff3bf; color: #2b2b2b; text-align: left; cursor: pointer; user-select: none;
padding: 11px 14px; font-weight: 800; letter-spacing: .3px;
border-bottom: 3px solid #2b2b2b; font-size: 14px; white-space: nowrap;
}
th .arrow { color: #e8590c; margin-left: 3px; }
td { padding: 11px 14px; border-bottom: 2px dashed #ced4da; font-weight: 600; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #ffecb3; }
.fname-cell { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.filename { font-weight: 800; word-break: break-all; }
.fname-meta { display: flex; gap: 8px; align-items: center; }
.ext {
display: inline-block; padding: 1px 8px;
border: 2px solid #2b2b2b; border-radius: 50%;
background: #d0ebff; font-size: 10px; font-weight: 800; color: #1971c2;
transform: rotate(-4deg);
}
.sha { font-family: "Courier New", Consolas, monospace; color: #868e96; font-size: 11.5px; cursor: help; font-weight: 700; }
tbody tr:hover .sha { color: #2b2b2b; }
.empty { padding: 46px 20px; text-align: center; font-weight: 700; font-size: 15px; color: #2b2b2b; }
.empty svg { margin-bottom: 14px; }
.empty .et { display: inline-block; border: 2.5px dashed #adb5bd;
border-radius: 15px 255px 15px 255px / 255px 15px 255px 15px;
padding: 10px 26px; background: #fffdf3; }
a.dl, a.cp, a.rm { text-decoration: none; font-weight: 800; font-size: 13.5px; padding: 0 3px; margin-right: 6px; }
a.dl { color: #1971c2; background: linear-gradient(transparent 62%, #a5d8ff 62%); }
a.dl:hover { background: #a5d8ff; }
a.cp { color: #2f9e44; background: linear-gradient(transparent 62%, #b2f2bb 62%); }
a.cp:hover { background: #b2f2bb; }
a.rm { color: #e03131; background: linear-gradient(transparent 62%, #ffc9c9 62%); }
a.rm:hover { background: #ffc9c9; }
.who { font-weight: 800; }
.who.center { color: #1971c2; }
.footer {
display: flex; justify-content: space-between; align-items: center;
padding: 12px 18px; border-top: 2.5px dashed #adb5bd;
font-weight: 700; font-size: 12.5px; color: #495057;
}
.footer .dot { color: #e8590c; }
/* ===== 修改密码弹窗(便签)===== */
.mask {
position: fixed; inset: 0; background: rgba(43,43,43,.45);
display: flex; align-items: center; justify-content: center; z-index: 99; padding: 24px;
}
.modal {
position: relative; width: 410px; background: #fffef8;
border: 2.5px solid #2b2b2b;
border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
box-shadow: 6px 8px 0 rgba(0,0,0,.16); padding: 36px 34px 30px;
transform: rotate(.5deg);
}
.modal .tape { top: -13px; left: 50%; margin-left: -46px; transform: rotate(2deg); }
.modal h3 { font-size: 21px; font-weight: 800; }
.modal .msub { font-size: 12.5px; color: #868e96; font-weight: 700; margin: 3px 0 16px; }
.modal input {
width: 100%; padding: 10px 14px; border: 2.5px solid #2b2b2b;
border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
font-family: inherit; font-size: 14px; font-weight: 600; outline: none;
margin-bottom: 12px; background: #fff;
}
.modal input:focus { background: #fff9db; }
.modal .mrow { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal .pwd-msg {
margin-bottom: 12px; background: #ffe3e3; color: #c92a2a;
padding: 9px 12px; font-weight: 700; font-size: 12.5px;
border: 2.5px dashed #c92a2a;
border-radius: 15px 255px 15px 255px / 255px 15px 255px 15px;
}
@media (max-width: 1000px) {
.stats { grid-template-columns: repeat(2, 1fr); }
th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { display: none; }
.header .pin.r { display: none; }
}
</style>
</head>
<body>
<div id="app">
<!-- 登录界面 -->
<div class="login-wrap" v-if="!loggedIn">
<div class="login-card">
<span class="tape"></span>
<span class="pin">📌</span>
<div class="emblem">37</div>
<h2>文件服务器管理</h2>
<div class="login-sub">37DU 内网文件服务器 · 管理台</div>
<div class="login-field">
<input type="text" v-model="username" placeholder="账号" @keyup.enter="login">
</div>
<div class="login-field">
<input :type="showPwd ? 'text' : 'password'" v-model="password" placeholder="密码" @keyup.enter="login">
<span class="eye" @click="showPwd = !showPwd">{{ showPwd ? '🙈' : '👁' }}</span>
</div>
<button class="btn btn-primary" @click="login" :disabled="loggingIn">{{ loggingIn ? "登录中…" : "登 录" }}</button>
<div class="login-hint">初始账号 puddy / 123456,登录后请尽快修改密码</div>
<div class="login-msg" v-if="loginMsg">{{ loginMsg }}</div>
</div>
</div>
<!-- 主界面 -->
<template v-else>
<div class="header">
<span class="pin l">📌</span>
<span class="pin r">📌</span>
<div class="brand">
<div class="emblem">37</div>
<div>
<h1>文件服务器管理 <span class="squiggle"></span></h1>
<div class="sub">{{ baseUrl }} · 登录用户:{{ tokenUser }}</div>
</div>
</div>
<div class="actions">
<button class="btn" @click="openPwdModal">改密码</button>
<button class="btn" @click="logout">退出</button>
<button class="btn btn-primary" @click="load">↻ 刷新</button>
</div>
</div>
<div class="stats">
<div class="stat"><span class="tape"></span><div class="k">文件数</div><div class="v">{{ totalCount }}</div></div>
<div class="stat"><span class="tape"></span><div class="k">总大小</div><div class="v">{{ totalSizeText }}</div></div>
<div class="stat"><span class="tape"></span><div class="k">总下载</div><div class="v">{{ totalDownloads }}</div></div>
<div class="stat"><span class="tape"></span><div class="k">最近上传</div><div class="v" style="font-size:15px;line-height:1.4">{{ lastUploadText }}</div></div>
</div>
<div class="toolbar">
<input type="text" v-model="keyword" placeholder="搜索文件名…">
<label class="btn btn-success upload-btn">
⬆ 上传文件
<input type="file" multiple @change="onFilesPicked">
</label>
<span v-if="uploading" class="tag">上传 {{ uploadIdx }}/{{ uploadTotal }} {{ uploadPercent }}%</span>
<span class="hint" style="flex:1"></span>
<span class="hint">点击表头排序 · 元数据存 MySQL</span>
</div>
<div class="status-bar" :class="statusClass">{{ statusMsg }}</div>
<div class="main">
<div class="loading" v-if="loading"><span class="pen">✏️</span> 翻本子中…</div>
<div class="card" v-else>
<span class="tape"></span>
<table>
<thead>
<tr>
<th style="width:42px">#</th>
<th @click="sortBy('filename')">文件名<span class="arrow" v-if="sortKey==='filename'">{{ sortDir===1?'▲':'▼' }}</span></th>
<th style="width:90px" @click="sortBy('size')">大小<span class="arrow" v-if="sortKey==='size'">{{ sortDir===1?'▲':'▼' }}</span></th>
<th style="width:160px" @click="sortBy('created')">上传时间<span class="arrow" v-if="sortKey==='created'">{{ sortDir===1?'▲':'▼' }}</span></th>
<th style="width:90px">上传人</th>
<th style="width:70px" @click="sortBy('downloads')">下载<span class="arrow" v-if="sortKey==='downloads'">{{ sortDir===1?'▲':'▼' }}</span></th>
<th style="width:190px">操作</th>
</tr>
</thead>
<tbody v-if="sortedFiles.length">
<tr v-for="(f, i) in sortedFiles" :key="f.fid">
<td style="color:#adb5bd;font-weight:800">{{ i + 1 }}</td>
<td>
<div class="fname-cell">
<span class="filename">{{ f.filename }}</span>
<span class="fname-meta">
<span class="ext">{{ extOf(f.filename) }}</span>
<span class="sha" :title="f.sha256">{{ shortSha(f.sha256) }}</span>
</span>
</div>
</td>
<td>{{ fmtSize(f.size) }}</td>
<td>{{ fmtTime(f.created) }}</td>
<td><span class="who" :class="f.uploader==='center'?'center':''">{{ whoLabel(f.uploader) }}</span></td>
<td>{{ f.downloads || 0 }}</td>
<td>
<a class="dl" :href="downloadUrl(f)" target="_blank" rel="noopener">下载</a>
<a class="cp" href="javascript:;" @click="copyLink(f)">复制</a>
<a class="rm" href="javascript:;" @click="remove(f)">删除</a>
</td>
</tr>
</tbody>
<tbody v-else>
<tr><td colspan="7">
<div class="empty">
<svg width="150" height="120" viewBox="0 0 150 120" fill="none" stroke="#2b2b2b" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
<path d="M20 36 Q22 31 27 31 L56 31 L67 41 L129 41"/>
<path d="M15 41 L135 41 Q139 42 139 46 L139 96 Q139 101 134 101 L16 101 Q11 101 11 96 L11 46 Q11 42 15 41 Z"/>
<path d="M18 51 L132 51" stroke="#ffd43b" stroke-width="5" opacity=".65"/>
<path d="M96 22 L110 13"/>
<path d="M112 28 L128 20"/>
<path d="M86 14 L92 4"/>
<path d="M102 8 l13 8 -6 10 -13 -8 z" transform="rotate(-12 108 17)"/>
<path d="M82 4 l10 6 -5 8 -10 -6 z" transform="rotate(-30 87 11)"/>
</svg>
<div class="et">📭 暂无文件{{ keyword ? '(与搜索条件匹配)' : '' }}</div>
</div>
</td></tr>
</tbody>
</table>
<div class="footer">
<span>37DU <span class="dot">✏️</span> 内网文件服务器</span>
<span>DOODLE ADMIN v2.2</span>
</div>
</div>
</div>
<!-- 修改密码弹窗 -->
<div class="mask" v-if="showPwdModal">
<div class="modal">
<span class="tape"></span>
<h3>修改密码</h3>
<div class="msub">修改后需重新登录</div>
<div class="pwd-msg" v-if="pwdMsg">{{ pwdMsg }}</div>
<input type="password" v-model="oldPwd" placeholder="旧密码">
<input type="password" v-model="newPwd" placeholder="新密码(至少 6 位)">
<input type="password" v-model="newPwd2" placeholder="确认新密码">
<div class="mrow">
<button class="btn" @click="closePwdModal">取消</button>
<button class="btn btn-primary" @click="changePwd" :disabled="savingPwd">{{ savingPwd ? "保存中…" : "保存" }}</button>
</div>
</div>
</div>
</template>
</div>
<script src="/vue.global.prod.js"></script>
<script src="/app.js"></script>
</body>
</html>