diff --git a/backend/app.py b/backend/app.py index 4189992..4eea4dd 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1,9 +1,29 @@ -from flask import Flask, jsonify +from flask import Flask, jsonify, send_from_directory from flask_cors import CORS import logging import os app = Flask(__name__) + +# 配置静态文件目录为dist +# 说明:这里指向后端目录中的 dist(前端构建产物应复制或输出到此) +dist_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'dist')) +app.static_folder = dist_dir + +# 为 SPA 提供静态文件与回退到 index.html 的路由 +@app.route('/') +def serve_index(): + # 返回构建后的前端入口文件 + return send_from_directory(app.static_folder, 'index.html') + +@app.route('/') +def serve_static_or_fallback(path): + # 如果请求的文件存在则直接返回,否则回退到 index.html(用于前端路由) + file_path = os.path.join(app.static_folder, path) + if os.path.isfile(file_path): + return send_from_directory(app.static_folder, path) + return send_from_directory(app.static_folder, 'index.html') + CORS(app) # 允许跨域访问 # 配置日志 @@ -29,6 +49,6 @@ app.register_blueprint(article_bp) if __name__ == '__main__': print("启动主程序服务...") - print("服务地址: http://localhost:5001") + print("服务地址: http://localhost:8443") - app.run(host='0.0.0.0', port=5001, debug=True) \ No newline at end of file + app.run(host='0.0.0.0', port=8443, debug=True) diff --git a/backend/routers/rank_api_routes.py b/backend/routers/rank_api_routes.py index b083615..ccb4041 100644 --- a/backend/routers/rank_api_routes.py +++ b/backend/routers/rank_api_routes.py @@ -1289,8 +1289,14 @@ def update_content_classification(): } field_name = field_mapping[classification_type] - # 优先使用 mix_id 获取管理库文档,不做日期过滤 - mgmt_doc = find_management_data({'mix_id': mix_id_param, 'mix_name': mix_name}) + # 首先从Rankings_management获取短剧的mix_id,使用今天的日期 + today = datetime.now().date() + start_of_day = datetime.combine(today, datetime.min.time()) + end_of_day = datetime.combine(today, datetime.max.time()) + + mgmt_doc = rankings_management_collection.find_one({ + "mix_name": mix_name + }) if not mgmt_doc: return jsonify({"success": False, "message": f"未找到短剧:{mix_name or mix_id_param}"}) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 4872c7c..abdca4b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,7 +11,8 @@ "axios": "^1.12.2", "bootstrap": "^5.3.0-alpha1", "bootstrap-icons": "^1.13.1", - "vue": "^3.5.22" + "vue": "^3.5.22", + "vue-router": "^4.6.3" }, "devDependencies": { "@vitejs/plugin-vue": "^6.0.1", @@ -1333,6 +1334,11 @@ "@vue/shared": "3.5.22" } }, + "node_modules/@vue/devtools-api": { + "version": "6.6.4", + "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.6.4.tgz", + "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==" + }, "node_modules/@vue/devtools-core": { "version": "8.0.3", "resolved": "https://registry.npmmirror.com/@vue/devtools-core/-/devtools-core-8.0.3.tgz", @@ -2643,6 +2649,20 @@ } } }, + "node_modules/vue-router": { + "version": "4.6.3", + "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-4.6.3.tgz", + "integrity": "sha512-ARBedLm9YlbvQomnmq91Os7ck6efydTSpRP3nuOKCvgJOHNrhRoJDSKtee8kcL1Vf7nz6U+PMBL+hTvR3bTVQg==", + "dependencies": { + "@vue/devtools-api": "^6.6.4" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "vue": "^3.5.0" + } + }, "node_modules/wsl-utils": { "version": "0.1.0", "resolved": "https://registry.npmmirror.com/wsl-utils/-/wsl-utils-0.1.0.tgz", @@ -3459,6 +3479,11 @@ "@vue/shared": "3.5.22" } }, + "@vue/devtools-api": { + "version": "6.6.4", + "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.6.4.tgz", + "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==" + }, "@vue/devtools-core": { "version": "8.0.3", "resolved": "https://registry.npmmirror.com/@vue/devtools-core/-/devtools-core-8.0.3.tgz", @@ -4276,6 +4301,14 @@ "@vue/shared": "3.5.22" } }, + "vue-router": { + "version": "4.6.3", + "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-4.6.3.tgz", + "integrity": "sha512-ARBedLm9YlbvQomnmq91Os7ck6efydTSpRP3nuOKCvgJOHNrhRoJDSKtee8kcL1Vf7nz6U+PMBL+hTvR3bTVQg==", + "requires": { + "@vue/devtools-api": "^6.6.4" + } + }, "wsl-utils": { "version": "0.1.0", "resolved": "https://registry.npmmirror.com/wsl-utils/-/wsl-utils-0.1.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index b5c65b5..bbec006 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,7 +15,8 @@ "axios": "^1.12.2", "bootstrap": "^5.3.0-alpha1", "bootstrap-icons": "^1.13.1", - "vue": "^3.5.22" + "vue": "^3.5.22", + "vue-router": "^4.6.3" }, "devDependencies": { "@vitejs/plugin-vue": "^6.0.1", diff --git a/frontend/src/AdminPanel.vue b/frontend/src/AdminPanel.vue index c311807..bcc2cc8 100644 --- a/frontend/src/AdminPanel.vue +++ b/frontend/src/AdminPanel.vue @@ -34,7 +34,7 @@ const editForm = reactive({ }) // API基础URL -const API_BASE_URL = 'http://localhost:5001/api' +const API_BASE_URL = 'http://159.75.150.210:8443/api' // 格式化播放量 const formatPlayCount = (count) => { diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 9e073b2..521e2a8 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -77,7 +77,7 @@ const fetchRankingData = async () => { params.classification_type = selectedCategory.value } - const response = await axios.get('http://localhost:5001/api/rank/videos', { + const response = await axios.get('http://159.75.150.210:8443/api/rank/videos', { params: params }) @@ -271,32 +271,16 @@ onMounted(() => {
- -
-
-

AI棒榜

+ +
+
- - - - - - - -
-

{{ formatDateTitle(selectedDate) }}

-
-
- -
+
+ +
+

{{ formatDateTitle(selectedDate) }}

+
+
+
@@ -447,26 +437,43 @@ onMounted(() => { position: relative; } -/* 顶部标题区域 */ -.header-section { - padding-top: 20px; - text-align: center; +/* 顶部横幅(按设计稿) */ +.top-banner { + position: relative; + height: 180px; + /* 背景图改为项目内资源路径 */ + background-image: url('./images/top_bg.png'); + background-position: center; + background-size: cover; + background-repeat: no-repeat; + overflow: hidden; } -.title-wrapper { +.top-banner::after { + content: ''; + position: absolute; + inset: 0; + background: linear-gradient(to bottom, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.05) 60%, rgba(0,0,0,0.1) 100%); +} + +.banner-inner { + position: relative; + z-index: 1; display: flex; + flex-direction: column; align-items: center; justify-content: center; - gap: 10px; - position: relative; + height: 100%; } - -.main-title { - font-size: 24px; - font-weight: bold; - color: #333; - margin: 0; - font-family: Alatsi, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', SimHei, Arial, Helvetica, sans-serif; +.banner-main-title { + width: 136px; +} +.banner-subtitle { + margin-top: 12px; + letter-spacing: 1px; + color: #ffffff; + font-family: ABeeZee, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", SimHei, Arial, Helvetica, sans-serif; + font-size: 16px; } /* 横幅区域 */ @@ -484,20 +491,6 @@ onMounted(() => { z-index: 2; } -.banner-subtitle { - font-size: 14px; - color: rgba(255, 255, 255, 0.8); - margin: 0 0 8px 0; -} - -.banner-title { - font-size: 18px; - font-weight: bold; - color: white; - margin: 0; - line-height: 1.4; -} - /* 装饰分隔线 */ .divider-dots { display: flex; @@ -521,14 +514,13 @@ onMounted(() => { display: flex; align-items: center; justify-content: center; - margin: 20px 0; gap: 8px; } .date-title { - font-size: 16px; - color: #333; - margin: 0; + font-size: 14px; + color: #555; + margin: 8px 0; font-weight: 500; } @@ -570,7 +562,17 @@ onMounted(() => { /* 排行榜内容区域 */ .ranking-content { - padding: 0 16px; + /* 作为白色圆角卡片容器 */ + background: #ffffff; + /* 仅顶部圆角 */ + border-radius: 24px 24px 0 0; + /* 移除两侧内边距与外边距 */ + padding: 0; + margin: -24px 0 16px; + /* 提高层级,确保顶部圆角可见 */ + position: relative; + z-index: 2; + box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06); } /* 加载状态 */ @@ -599,8 +601,6 @@ onMounted(() => { .ranking-list { display: flex; flex-direction: column; - background: white; - border-radius: 12px; padding: 0 16px; } @@ -888,7 +888,8 @@ onMounted(() => { } .ranking-content { - padding: 0 12px; + margin-top: -12px; + padding: 12px 0; } .ranking-item { diff --git a/frontend/src/images/mhru18yf-f5p3yze.svg b/frontend/src/images/mhru18yf-f5p3yze.svg new file mode 100644 index 0000000..29875c4 --- /dev/null +++ b/frontend/src/images/mhru18yf-f5p3yze.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/frontend/src/images/top_bg.png b/frontend/src/images/top_bg.png new file mode 100644 index 0000000..9b3c45a Binary files /dev/null and b/frontend/src/images/top_bg.png differ diff --git a/frontend/vite.config.js b/frontend/vite.config.js index d685998..025c8bd 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -17,7 +17,7 @@ export default defineConfig({ port: 5174, proxy: { '/api': { - target: 'http://localhost:5001', + target: 'http://159.75.150.210:8443', changeOrigin: true, secure: false }