- 新增通知推送模块:支持 WebSocket 实时推送与轮询兜底,新增通知管理界面 - 新增离线登录功能:断网时凭本地 7 天授权票据自动登录或手动登录 - 优化 Electron 客户端 WebSocket 重连逻辑,避免死循环 - 调整工作流脚本,拆分重构合同相关分支逻辑 - 新增设备上报客户端版本字段,用于升级追踪与关旧依据
345 lines
15 KiB
HTML
345 lines
15 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: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
|
|
background: #f5f7fa; color: #232a3a; font-size: 14px;
|
|
}
|
|
::selection { background: #dbe6ff; color: #232a3a; }
|
|
|
|
/* ===== 顶栏 ===== */
|
|
.header {
|
|
background: #fff; border-bottom: 1px solid #e8ecf1;
|
|
padding: 12px 24px;
|
|
display: flex; align-items: center; justify-content: space-between; gap: 16px;
|
|
box-shadow: 0 2px 8px -6px rgba(35, 42, 58, .25);
|
|
}
|
|
.header .brand { display: flex; align-items: center; gap: 12px; }
|
|
.header .emblem {
|
|
width: 38px; height: 38px; border-radius: 8px;
|
|
display: grid; place-items: center;
|
|
background: linear-gradient(135deg, #2f5cf0 0%, #0f9f9b 140%);
|
|
color: #fff; font-size: 15px; font-weight: 800;
|
|
box-shadow: 0 6px 14px -6px rgba(47, 92, 240, .5);
|
|
}
|
|
.header h1 { font-size: 17px; font-weight: 700; line-height: 1.2; }
|
|
.header .sub { font-size: 12px; color: #8a93a6; margin-top: 1px; }
|
|
.header .actions { display: flex; gap: 8px; flex-wrap: wrap; }
|
|
|
|
/* ===== 统计条 ===== */
|
|
.stats {
|
|
display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
|
|
padding: 18px 24px 8px;
|
|
}
|
|
.stat {
|
|
background: #fff; border: 1px solid #e8ecf1; border-radius: 10px;
|
|
padding: 14px 18px; border-left: 4px solid #2f5cf0;
|
|
box-shadow: 0 2px 8px -6px rgba(35, 42, 58, .2);
|
|
}
|
|
.stat:nth-child(2) { border-left-color: #0f9f9b; }
|
|
.stat:nth-child(3) { border-left-color: #1d9d5c; }
|
|
.stat:nth-child(4) { border-left-color: #d97706; }
|
|
.stat .k { font-size: 12px; color: #8a93a6; }
|
|
.stat .v { font-size: 24px; font-weight: 700; margin-top: 3px; color: #232a3a; }
|
|
|
|
/* ===== 工具栏 ===== */
|
|
.toolbar {
|
|
display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
|
|
padding: 10px 24px 16px;
|
|
}
|
|
.toolbar input[type="text"] {
|
|
padding: 8px 12px; border: 1px solid #d9dee7; border-radius: 6px;
|
|
font-family: inherit; font-size: 14px; outline: none;
|
|
width: 280px; background: #fff; transition: border-color .15s, box-shadow .15s;
|
|
}
|
|
.toolbar input[type="text"]:focus { border-color: #2f5cf0; box-shadow: 0 0 0 3px rgba(47, 92, 240, .12); }
|
|
.toolbar .hint { color: #8a93a6; font-size: 12px; }
|
|
|
|
/* ===== 按钮 ===== */
|
|
.btn {
|
|
font-family: inherit; font-size: 14px;
|
|
border: 1px solid #d9dee7; border-radius: 6px;
|
|
background: #fff; color: #3b4358;
|
|
padding: 8px 16px; cursor: pointer;
|
|
transition: all .15s;
|
|
user-select: none;
|
|
}
|
|
.btn:hover { border-color: #2f5cf0; color: #2f5cf0; background: #f5f8ff; }
|
|
.btn:active { transform: translateY(1px); }
|
|
.btn-primary { background: #2f5cf0; border-color: #2f5cf0; color: #fff; }
|
|
.btn-primary:hover { background: #2246c0; border-color: #2246c0; color: #fff; }
|
|
.btn-success { background: #1d9d5c; border-color: #1d9d5c; color: #fff; }
|
|
.btn-success:hover { background: #178048; border-color: #178048; color: #fff; }
|
|
.btn:disabled { opacity: .5; cursor: not-allowed; }
|
|
.upload-btn input[type="file"] { display: none; }
|
|
.tag {
|
|
display: inline-block; padding: 4px 10px; border-radius: 4px;
|
|
font-size: 12px; font-weight: 600; background: #e8f0ff; color: #2f5cf0;
|
|
border: 1px solid #c9d9ff;
|
|
}
|
|
|
|
/* ===== 状态条 ===== */
|
|
.status-bar { display: none; padding: 10px 24px; font-size: 13px; }
|
|
.status-bar.ok { display: block; background: #e6f7ee; color: #1d9d5c; border-bottom: 1px solid #bfe8d2; }
|
|
.status-bar.err { display: block; background: #fdeeee; color: #d6453d; border-bottom: 1px solid #f5c6c2; }
|
|
|
|
.main { padding: 6px 24px 26px; }
|
|
|
|
/* ===== 加载中 ===== */
|
|
.loading { padding: 70px; text-align: center; font-size: 15px; color: #8a93a6; }
|
|
|
|
/* ===== 主卡片 ===== */
|
|
.card {
|
|
background: #fff; border: 1px solid #e8ecf1; border-radius: 10px;
|
|
box-shadow: 0 2px 8px -6px rgba(35, 42, 58, .2);
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* ===== 表格 ===== */
|
|
table { width: 100%; border-collapse: collapse; }
|
|
th {
|
|
background: #f7f9fc; color: #4a5468; text-align: left; cursor: pointer; user-select: none;
|
|
padding: 11px 14px; font-weight: 600; letter-spacing: .2px;
|
|
border-bottom: 1px solid #e8ecf1; font-size: 13px; white-space: nowrap;
|
|
}
|
|
th .arrow { color: #2f5cf0; margin-left: 3px; }
|
|
td { padding: 11px 14px; border-bottom: 1px solid #f0f2f6; font-weight: 400; vertical-align: middle; }
|
|
tr:last-child td { border-bottom: none; }
|
|
tbody tr:hover td { background: #f5f8ff; }
|
|
/* 文件名列:限宽 + 超长省略号 */
|
|
.fname-col { min-width: 220px; max-width: 420px; width: 34%; }
|
|
.fname-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow: hidden; }
|
|
.filename { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
.fname-meta { display: flex; gap: 8px; align-items: center; min-width: 0; }
|
|
.ext {
|
|
display: inline-block; padding: 1px 7px; flex-shrink: 0;
|
|
border: 1px solid #c9d9ff; border-radius: 4px;
|
|
background: #e8f0ff; font-size: 10px; font-weight: 700; color: #2f5cf0;
|
|
}
|
|
.sha {
|
|
font-family: ui-monospace, Consolas, "Courier New", monospace;
|
|
color: #9aa2b4; font-size: 11.5px; cursor: help; flex: 1; min-width: 0;
|
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
}
|
|
tbody tr:hover .sha { color: #4a5468; }
|
|
.empty { padding: 46px 20px; text-align: center; font-size: 14px; color: #9aa2b4; }
|
|
.empty .et { display: inline-block; padding: 10px 26px; }
|
|
a.dl, a.cp, a.rm { font-weight: 600; font-size: 13px; text-decoration: none; margin-right: 10px; }
|
|
a.dl { color: #2f5cf0; }
|
|
a.dl:hover { text-decoration: underline; }
|
|
a.cp { color: #1d9d5c; }
|
|
a.cp:hover { text-decoration: underline; }
|
|
a.rm { color: #d6453d; }
|
|
a.rm:hover { text-decoration: underline; }
|
|
.who { font-weight: 600; }
|
|
.who.center { color: #2f5cf0; }
|
|
|
|
.footer {
|
|
display: flex; justify-content: space-between; align-items: center;
|
|
padding: 11px 16px; border-top: 1px solid #f0f2f6;
|
|
font-size: 12px; color: #9aa2b4;
|
|
}
|
|
|
|
/* ===== 登录页 ===== */
|
|
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: #f5f7fa; }
|
|
.login-card {
|
|
width: 380px; background: #fff;
|
|
border: 1px solid #e8ecf1; border-radius: 12px;
|
|
box-shadow: 0 10px 34px -18px rgba(35, 42, 58, .35);
|
|
padding: 36px 34px 30px;
|
|
}
|
|
.login-card .emblem {
|
|
width: 48px; height: 48px; border-radius: 12px;
|
|
display: grid; place-items: center;
|
|
background: linear-gradient(135deg, #2f5cf0 0%, #0f9f9b 140%);
|
|
color: #fff; font-size: 18px; font-weight: 800;
|
|
box-shadow: 0 8px 18px -8px rgba(47, 92, 240, .55);
|
|
margin-bottom: 16px;
|
|
}
|
|
.login-card h2 { font-size: 20px; font-weight: 700; }
|
|
.login-card .login-sub { font-size: 12.5px; color: #8a93a6; margin: 4px 0 22px; }
|
|
.login-field { position: relative; margin-bottom: 14px; }
|
|
.login-field input {
|
|
width: 100%; padding: 10px 40px 10px 12px;
|
|
border: 1px solid #d9dee7; border-radius: 6px;
|
|
font-family: inherit; font-size: 14px; outline: none; background: #fff;
|
|
transition: border-color .15s, box-shadow .15s;
|
|
}
|
|
.login-field input:focus { border-color: #2f5cf0; box-shadow: 0 0 0 3px rgba(47, 92, 240, .12); }
|
|
.eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 15px; color: #8a93a6; user-select: none; }
|
|
.login-card .btn { width: 100%; padding: 10px; font-size: 15px; margin-top: 2px; }
|
|
.login-hint { margin-top: 14px; font-size: 12px; color: #9aa2b4; }
|
|
.login-msg {
|
|
margin-top: 12px; background: #fdeeee; color: #d6453d;
|
|
padding: 9px 12px; font-size: 13px;
|
|
border: 1px solid #f5c6c2; border-radius: 6px;
|
|
}
|
|
|
|
/* ===== 修改密码弹窗 ===== */
|
|
.mask {
|
|
position: fixed; inset: 0; background: rgba(20, 26, 40, .45);
|
|
display: flex; align-items: center; justify-content: center; z-index: 99; padding: 24px;
|
|
}
|
|
.modal {
|
|
width: 400px; background: #fff;
|
|
border: 1px solid #e8ecf1; border-radius: 12px;
|
|
box-shadow: 0 14px 40px -18px rgba(20, 26, 40, .45);
|
|
padding: 26px 28px 22px;
|
|
}
|
|
.modal h3 { font-size: 17px; font-weight: 700; }
|
|
.modal .msub { font-size: 12px; color: #8a93a6; margin: 3px 0 16px; }
|
|
.modal input {
|
|
width: 100%; padding: 9px 12px; border: 1px solid #d9dee7; border-radius: 6px;
|
|
font-family: inherit; font-size: 14px; outline: none; margin-bottom: 12px;
|
|
transition: border-color .15s, box-shadow .15s;
|
|
}
|
|
.modal input:focus { border-color: #2f5cf0; box-shadow: 0 0 0 3px rgba(47, 92, 240, .12); }
|
|
.modal .mrow { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
|
|
.modal .pwd-msg {
|
|
margin-bottom: 12px; background: #fdeeee; color: #d6453d;
|
|
padding: 9px 12px; font-size: 12.5px;
|
|
border: 1px solid #f5c6c2; border-radius: 6px;
|
|
}
|
|
|
|
@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; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="app">
|
|
<!-- 登录界面 -->
|
|
<div class="login-wrap" v-if="!loggedIn">
|
|
<div class="login-card">
|
|
<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">
|
|
<div class="brand">
|
|
<div class="emblem">37</div>
|
|
<div>
|
|
<h1>文件服务器管理</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"><div class="k">文件数</div><div class="v">{{ totalCount }}</div></div>
|
|
<div class="stat"><div class="k">总大小</div><div class="v">{{ totalSizeText }}</div></div>
|
|
<div class="stat"><div class="k">总下载</div><div class="v">{{ totalDownloads }}</div></div>
|
|
<div class="stat"><div class="k">最近上传</div><div class="v" style="font-size:16px;font-weight:600">{{ 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">加载中…</div>
|
|
<div class="card" v-else>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th style="width:42px">#</th>
|
|
<th class="fname-col" @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:150px">操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody v-if="sortedFiles.length">
|
|
<tr v-for="(f, i) in sortedFiles" :key="f.fid">
|
|
<td style="color:#c0c6d0;font-weight:600">{{ 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"><div class="et">📭 暂无文件{{ keyword ? '(与搜索条件匹配)' : '' }}</div></div>
|
|
</td></tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="footer">
|
|
<span>37DU 内网文件服务器</span>
|
|
<span>ADMIN v2.3</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 修改密码弹窗 -->
|
|
<div class="mask" v-if="showPwdModal">
|
|
<div class="modal">
|
|
<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>
|