([]);
+
+async function loadFeedback() {
+ try {
+ const b = await api('/admin/feedback');
+ feedback.value = b.data ?? [];
+ } catch (e: any) {
+ setMsg(`留言加载失败:${e.message}`);
+ }
+}
+
+async function fbSetStatus(f: any, status: string) {
+ try {
+ const b = await api('/admin/feedback', { method: 'POST', body: JSON.stringify({ id: f.id, status }) });
+ setMsg(b.code === 200 ? '已更新留言状态' : (b.message || '状态更新失败'));
+ if (b.code === 200) f.status = status;
+ } catch (e: any) {
+ setMsg(`状态更新失败:${e.message}`);
+ }
+}
+
+function fbOnStatus(f: any, e: Event) {
+ fbSetStatus(f, (e.target as HTMLSelectElement).value);
+}
+
+async function fbDelete(f: any) {
+ if (!window.confirm('确定删除这条留言?删除后无法恢复。')) return;
+ try {
+ const b = await api('/admin/feedback', { method: 'POST', body: JSON.stringify({ id: f.id, action: 'delete' }) });
+ setMsg(b.code === 200 ? '已删除' : (b.message || '删除失败'));
+ if (b.code === 200) feedback.value = feedback.value.filter(x => x.id !== f.id);
+ } catch (e: any) {
+ setMsg(`删除失败:${e.message}`);
+ }
+}
+
+function fbTime(ts: any) {
+ try {
+ const d = new Date(Number(ts) * 1000);
+ const p = (n: number) => String(n).padStart(2, '0');
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
+ } catch {
+ return String(ts ?? '');
+ }
+}
+
+const fbNewCount = computed(() => feedback.value.filter(f => f.status === 'new').length);
+
function recoAdd() {
reco.value.unshift({ path: '', icon: '🧰', name: '', desc: '', enabled: true });
}
@@ -389,9 +442,9 @@ function recoMove(i: number, d: -1 | 1) {
reco.value.splice(j, 0, it);
}
-const tab = ref<'overview' | 'files' | 'usage' | 'storage' | 'reco'>('overview');
+const tab = ref<'overview' | 'files' | 'usage' | 'storage' | 'reco' | 'feedback'>('overview');
-function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
+function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco' | 'feedback') {
tab.value = id;
if (id === 'overview') {
loadOverview();
@@ -405,6 +458,9 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
if (id === 'storage') {
loadStorage();
}
+ if (id === 'feedback') {
+ loadFeedback();
+ }
}
@@ -436,6 +492,10 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
📈 使用统计
💾 存储设置
🏠 首页推荐
+
+ 💬 留言反馈
+ {{ fbNewCount }}
+
退出
@@ -642,6 +702,55 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
+
+
+
+
+
+ 共 {{ feedback.length }} 条 · 未处理 {{ fbNewCount }} 条(同一 IP 一小时内限提交 1 次 + 图形验证码)
+
+
+
+
+
@@ -751,6 +860,33 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
gap: 7px;
}
+// ---- 留言反馈列表 ----
+.adm-fb-time {
+ white-space: nowrap;
+ font-variant-numeric: tabular-nums;
+}
+
+.adm-fb-content {
+ max-width: 460px;
+ white-space: pre-wrap;
+ word-break: break-word;
+ line-height: 1.6;
+}
+
+.adm-fb-contact,
+.adm-fb-ip {
+ white-space: nowrap;
+}
+
+.adm-fb-ip {
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
+ font-size: 12px;
+}
+
+.adm-fb-ops {
+ white-space: nowrap;
+}
+
.adm-reco-row {
display: flex;
align-items: center;
@@ -972,6 +1108,25 @@ function switchTab(id: 'overview' | 'files' | 'usage' | 'storage' | 'reco') {
}
}
+/* 留言反馈表:窄视口容器内横向滚动,表头保持横排不被挤成竖列 */
+.adm-fb-scroll {
+ overflow-x: auto;
+ -webkit-overflow-scrolling: touch;
+
+ .adm-table {
+ min-width: 820px;
+
+ th {
+ white-space: nowrap;
+ }
+
+ td {
+ word-break: break-word;
+ max-width: 360px;
+ }
+ }
+}
+
.adm-badge {
font-size: 11px;
padding: 1px 8px;