From 2ecf62e88b771ce8a317e0a9069611926268c0c8 Mon Sep 17 00:00:00 2001
From: jc <419690370@qq.com>
Date: Thu, 13 Mar 2025 22:06:19 +0800
Subject: [PATCH] first commit
---
app.py | 31 +++++++++++++++++++++++++++++++
public/index.html | 28 ++++++++++++++++++++++++++++
public/script.js | 40 ++++++++++++++++++++++++++++++++++++++++
public/styles.css | 46 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 145 insertions(+)
create mode 100644 app.py
create mode 100644 public/index.html
create mode 100644 public/script.js
create mode 100644 public/styles.css
diff --git a/app.py b/app.py
new file mode 100644
index 0000000..16c64bd
--- /dev/null
+++ b/app.py
@@ -0,0 +1,31 @@
+from flask import Flask, jsonify, send_from_directory
+
+app = Flask(__name__, static_folder="public", static_url_path="")
+
+# 根路径返回 index.html
+@app.route("/")
+def serve_index():
+ return send_from_directory(app.static_folder, "index.html")
+
+# API 子路径,提供《哪吒2》的宣传数据
+@app.route("/api/nezha2")
+def api_nezha2():
+ nezha2_data = {
+ "message": "《哪吒2》宣传信息",
+ "data": {
+ "title": "《哪吒2》",
+ "description": "《哪吒2》是继《哪吒之魔童降世》后的续作,讲述了哪吒的全新冒险故事。",
+ "trailer_url": "https://www.bilibili.com/video/BV11McieTEN5/", # 替换为实际预告片链接
+ "cast": [
+ {"name": "哪吒", "role": "主角", "description": "勇敢无畏的少年英雄"},
+ {"name": "敖丙", "role": "配角", "description": "哪吒的挚友与对手"},
+ {"name": "太乙真人", "role": "配角", "description": "哪吒的师父,搞笑又神秘"}
+ ],
+ "release_date": "2025年12月25日",
+ "rating": "PG-13"
+ }
+ }
+ return jsonify(nezha2_data)
+
+if __name__ == "__main__":
+ app.run(debug=True, port=80)
\ No newline at end of file
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 0000000..70a8235
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+ 《哪吒2》宣传网页
+
+
+
+
+
《哪吒2》
+
+
+
预告片
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/script.js b/public/script.js
new file mode 100644
index 0000000..3f7c76b
--- /dev/null
+++ b/public/script.js
@@ -0,0 +1,40 @@
+document.addEventListener("DOMContentLoaded", function () {
+ fetch("/api/nezha2")
+ .then(response => response.json())
+ .then(data => {
+ const movieData = data.data;
+
+ // 设置标题和描述
+ document.getElementById("title").textContent = movieData.title;
+ document.getElementById("description").textContent = movieData.description;
+
+ // 设置预告片链接
+ const trailerIframe = document.getElementById("trailer-iframe");
+ trailerIframe.src = movieData.trailer_url;
+
+ // 渲染主演介绍
+ const castContainer = document.getElementById("cast-container");
+ movieData.cast.forEach(cast => {
+ const castItem = document.createElement("div");
+ castItem.classList.add("cast-item");
+
+ const castName = document.createElement("div");
+ castName.textContent = `${cast.name} - ${cast.role}`;
+
+ const castDescription = document.createElement("div");
+ castDescription.textContent = cast.description;
+
+ castItem.appendChild(castName);
+ castItem.appendChild(castDescription);
+
+ castContainer.appendChild(castItem);
+ });
+
+ // 设置上映日期和分级
+ document.getElementById("release-date").textContent = movieData.release_date;
+ document.getElementById("rating").textContent = movieData.rating;
+ })
+ .catch(error => {
+ console.error("Error fetching movie data:", error);
+ });
+});
\ No newline at end of file
diff --git a/public/styles.css b/public/styles.css
new file mode 100644
index 0000000..1c28b5c
--- /dev/null
+++ b/public/styles.css
@@ -0,0 +1,46 @@
+body {
+ font-family: Arial, sans-serif;
+ background-color: #f4f4f9;
+ margin: 0;
+ padding: 0;
+}
+
+.container {
+ max-width: 800px;
+ margin: 20px auto;
+ padding: 20px;
+ background: #fff;
+ border-radius: 8px;
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
+}
+
+h1, h2 {
+ text-align: center;
+ color: #333;
+}
+
+.trailer iframe {
+ display: block;
+ margin: 20px auto;
+ border-radius: 8px;
+}
+
+.cast {
+ margin-top: 20px;
+}
+
+.cast-item {
+ margin-bottom: 10px;
+ padding: 10px;
+ border-bottom: 1px solid #ddd;
+}
+
+.cast-item:last-child {
+ border-bottom: none;
+}
+
+.info {
+ margin-top: 20px;
+ text-align: center;
+ color: #666;
+}
\ No newline at end of file