From 526278589b2bf7ec8269d3d85e3fa8eae9681e3e Mon Sep 17 00:00:00 2001 From: lt Date: Fri, 8 May 2026 23:35:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20-=20=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=88=86=E6=9E=90=E3=80=81=E7=B4=A0=E6=9D=90=E5=BA=93=E3=80=81?= =?UTF-8?q?=E5=88=9B=E4=BD=9C=E4=BB=BB=E5=8A=A1=E3=80=81=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 metrics.html: 数据分析页面 (Dashboard, 趋势图, 平台对比, 选题推荐) - 新增 assets.html: 素材库页面 (上传/管理/预览/标签) - 新增 tasks.html: 创作任务页面 (任务列表/进度/详情) - 新增 platforms.html: 平台配置页面 (知乎/微信/小红书格式规则) - 更新导航组件: 添加新页面入口, 适配 H5 底部导航 - 修复 calendar.html: 使用本地 Vue/ElementPlus 资源 - 修复 assets.py: db.func.count -> sqlalchemy.func.count - 新增 test_api_unit.py: 后端 API 单元测试 - 新增 test_frontend.sh: 前端页面完整性测试 PC/H5 双端适配, 所有页面统一使用 navbar + navigation 组件 --- platform/backend/app/api/assets.py | 3 +- platform/frontend/assets.html | 261 +++++++++++++++++++ platform/frontend/calendar.html | 296 ++++++++++++++++++++++ platform/frontend/metrics.html | 231 +++++++++++++++++ platform/frontend/navigation-component.js | 11 +- platform/frontend/platforms.html | 207 +++++++++++++++ platform/frontend/tasks.html | 208 +++++++++++++++ tests/test_api_unit.py | 146 +++++++++++ tests/test_frontend.sh | 71 ++++++ 9 files changed, 1430 insertions(+), 4 deletions(-) create mode 100644 platform/frontend/assets.html create mode 100644 platform/frontend/calendar.html create mode 100644 platform/frontend/metrics.html create mode 100644 platform/frontend/platforms.html create mode 100644 platform/frontend/tasks.html create mode 100644 tests/test_api_unit.py create mode 100755 tests/test_frontend.sh diff --git a/platform/backend/app/api/assets.py b/platform/backend/app/api/assets.py index 39bf322..efbbd38 100644 --- a/platform/backend/app/api/assets.py +++ b/platform/backend/app/api/assets.py @@ -4,6 +4,7 @@ import hashlib from pathlib import Path from fastapi import APIRouter, Depends, HTTPException, UploadFile, File, Query from sqlalchemy.orm import Session +from sqlalchemy import func from typing import List, Optional from ..database import get_db @@ -68,7 +69,7 @@ def get_counts( ): total = db.query(MediaAsset).count() by_type = {} - rows = db.query(MediaAsset.file_type, db.func.count(MediaAsset.id)).group_by(MediaAsset.file_type).all() + rows = db.query(MediaAsset.file_type, func.count(MediaAsset.id)).group_by(MediaAsset.file_type).all() for ftype, cnt in rows: by_type[ftype] = cnt return {"total": total, "by_type": by_type} diff --git a/platform/frontend/assets.html b/platform/frontend/assets.html new file mode 100644 index 0000000..02ecec0 --- /dev/null +++ b/platform/frontend/assets.html @@ -0,0 +1,261 @@ + + + + + + 宇之然内容创作平台 - 素材库 + + + + + + +
+ + +
+
+

🖼️ 素材库

+
+
+ + + + + + + + + + + + + 🔄 刷新 + 📤 上传素材 +
+
+ 总计: {{ assetStats.total }} 个 + {{ getTypeName(type) }}: {{ count }} +
+
加载中...
+
+
📂
+
暂无素材,点击上方按钮上传
+
+
+
+
+ + + +
+
{{ asset.filename }}
+
{{ formatSize(asset.size) }} | {{ formatDate(asset.created_at) }}
+
+ {{ tag }} +
+
+ 复制 + 删除 +
+
+
+
+
+
+ + +
+
📤
+
将文件拖到此处,或点击上传
+
支持: JPG, PNG, GIF, WebP, PDF, Word, PPT, MP4
+
+
+
+ + +
+ +
+ +
+
+ + + +
+
{{ previewAssetData.filename }}
+
{{ formatSize(previewAssetData.size) }} | {{ formatDate(previewAssetData.created_at) }}
+
{{ previewAssetData.alt_text }}
+
+ {{ tag }} +
+
使用次数: {{ previewAssetData.usage_count || 0 }}
+
+
+
+ + + + + diff --git a/platform/frontend/calendar.html b/platform/frontend/calendar.html new file mode 100644 index 0000000..206b85c --- /dev/null +++ b/platform/frontend/calendar.html @@ -0,0 +1,296 @@ + + + + + + 宇之然内容创作平台 - 内容日历 + + + + + + +
+ + +
+
+
+
+

📅 内容日历

+
+ + {{ currentYear }}年 {{ currentMonth }}月 + + 今天 +
+
+ +
+
待发布: {{ stats.planned }}
+
已发布: {{ stats.published }}
+
延迟: {{ stats.delayed }}
+
取消: {{ stats.cancelled }}
+
+ +
+
{{ day }}
+
+
{{ day.day }}
+
+
+ {{ entry.platform_icon }} {{ entry.title || '未命名' }} +
+
+
+
+
+
+
+ + +
+ + 添加日程 + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + \ No newline at end of file diff --git a/platform/frontend/metrics.html b/platform/frontend/metrics.html new file mode 100644 index 0000000..13d9c1d --- /dev/null +++ b/platform/frontend/metrics.html @@ -0,0 +1,231 @@ + + + + + + 宇之然内容创作平台 - 数据分析 + + + + + + +
+ + +
+
+

📊 数据分析

+
+
+
{{ dashboard.total_topics }}
+
选题总数
+
+
+
{{ dashboard.total_published }}
+
已发布
+
+
+
{{ dashboard.total_views }}
+
总阅读
+
+
+
{{ dashboard.avg_engagement_rate }}%
+
平均互动率
+
+
+
+

📈 选题状态分布

+
+
+
{{ count }}
+
{{ getStatusLabel(status) }}
+
+
+
+
+

🔥 热门选题 TOP10

+ + + + + + + + + + +
+
+

📉 数据趋势

+
+ + 7天 + 30天 + 90天 + +
+
+
+
+
{{ item.period }}
+
+
+
+
{{ item.views || 0 }} 阅读
+
+
暂无数据
+
+
+
+
+

🏆 平台对比

+ + + + + + + + + + + + + + +
+
+

💡 选题推荐

+ + + + + + + + + + +
+
+
+
+ + + + + diff --git a/platform/frontend/navigation-component.js b/platform/frontend/navigation-component.js index 20f679a..2282ed3 100644 --- a/platform/frontend/navigation-component.js +++ b/platform/frontend/navigation-component.js @@ -35,6 +35,11 @@