From e96b88d9c792e91bc6e4ce3428e1951b3d36c569 Mon Sep 17 00:00:00 2001
From: jc <419690370@qq.com>
Date: Sat, 15 Mar 2025 23:36:56 +0800
Subject: [PATCH] first commit

---
 app.py            | 34 ++++++++++++++++++++++++++++++++++
 public/index.html | 23 +++++++++++++++++++++++
 public/script.js  | 38 ++++++++++++++++++++++++++++++++++++++
 public/styles.css | 45 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 140 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..edd980f
--- /dev/null
+++ b/app.py
@@ -0,0 +1,34 @@
+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 子路径,提供期末考试复习计划数据
+@app.route("/api/review-plan")
+def api_review_plan():
+    review_plan_data = {
+        "message": "期末考试复习计划",
+        "data": {
+            "subjects": [
+                {"name": "数学", "plan": "每天复习一个章节,做 20 道练习题,重点复习函数和几何部分。"},
+                {"name": "语文", "plan": "每天阅读一篇文言文,背诵 5 个成语,练习一篇作文。"},
+                {"name": "英语", "plan": "每天背诵 30 个单词,做一套阅读理解题,练习口语 15 分钟。"},
+                {"name": "物理", "plan": "每天复习一个物理定律,做 10 道相关习题,总结错题。"},
+                {"name": "化学", "plan": "每天背诵 5 个化学方程式,做 10 道选择题,复习元素周期表。"}
+            ],
+            "tips": [
+                "制定每日复习计划,合理分配时间。",
+                "保持良好的作息,保证充足的睡眠。",
+                "复习时保持专注,避免分心。",
+                "定期进行模拟考试,检验复习效果。"
+            ]
+        }
+    }
+    return jsonify(review_plan_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..9e98974
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>期末考试复习计划</title>
+    <link rel="stylesheet" href="styles.css">
+</head>
+<body>
+    <div class="container">
+        <h1>期末考试复习计划</h1>
+        <div class="section">
+            <h2>科目复习计划</h2>
+            <div id="subjects-container"></div>
+        </div>
+        <div class="section">
+            <h2>复习小贴士</h2>
+            <div id="tips-container"></div>
+        </div>
+    </div>
+    <script src="script.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/public/script.js b/public/script.js
new file mode 100644
index 0000000..56d1876
--- /dev/null
+++ b/public/script.js
@@ -0,0 +1,38 @@
+document.addEventListener("DOMContentLoaded", function () {
+    fetch("/api/review-plan")
+        .then(response => response.json())
+        .then(data => {
+            const subjectsContainer = document.getElementById("subjects-container");
+            const tipsContainer = document.getElementById("tips-container");
+
+            // 渲染科目复习计划
+            data.data.subjects.forEach(subject => {
+                const subjectItem = document.createElement("div");
+                subjectItem.classList.add("item");
+
+                const subjectName = document.createElement("div");
+                subjectName.classList.add("item-name");
+                subjectName.textContent = subject.name;
+
+                const subjectPlan = document.createElement("div");
+                subjectPlan.classList.add("item-description");
+                subjectPlan.textContent = subject.plan;
+
+                subjectItem.appendChild(subjectName);
+                subjectItem.appendChild(subjectPlan);
+
+                subjectsContainer.appendChild(subjectItem);
+            });
+
+            // 渲染复习小贴士
+            data.data.tips.forEach(tip => {
+                const tipItem = document.createElement("div");
+                tipItem.classList.add("item");
+                tipItem.textContent = tip;
+                tipsContainer.appendChild(tipItem);
+            });
+        })
+        .catch(error => {
+            console.error("Error fetching review plan data:", error);
+        });
+});
\ No newline at end of file
diff --git a/public/styles.css b/public/styles.css
new file mode 100644
index 0000000..a894304
--- /dev/null
+++ b/public/styles.css
@@ -0,0 +1,45 @@
+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;
+}
+
+.section {
+    margin-top: 20px;
+}
+
+.item {
+    margin-bottom: 15px;
+    padding: 10px;
+    border-bottom: 1px solid #ddd;
+}
+
+.item:last-child {
+    border-bottom: none;
+}
+
+.item-name {
+    font-size: 1.2em;
+    font-weight: bold;
+    color: #444;
+}
+
+.item-description {
+    font-size: 0.9em;
+    color: #666;
+}
\ No newline at end of file