]> acesimba.cloud Git - studybase.git/commitdiff
1\添加目录下各文件生成一个大的txt的功能;2\修改css让手机访问时首页可以四个按钮竖排显示
authorroot <root@localhost.localdomain>
Sun, 17 May 2026 23:28:10 +0000 (07:28 +0800)
committerroot <root@localhost.localdomain>
Sun, 17 May 2026 23:28:10 +0000 (07:28 +0800)
app.log [new file with mode: 0644]
generate_report.py [new file with mode: 0644]
project_all_in_one.txt [new file with mode: 0644]
static/css/style.css

diff --git a/app.log b/app.log
new file mode 100644 (file)
index 0000000..7daa52b
--- /dev/null
+++ b/app.log
@@ -0,0 +1,41 @@
+nohup: ignoring input
+ * Serving Flask app 'app'
+ * Debug mode: off
+WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
+ * Running on all addresses (0.0.0.0)
+ * Running on http://127.0.0.1:5000
+ * Running on http://10.0.0.16:5000
+Press CTRL+C to quit
+219.144.254.168 - - [18/May/2026 07:11:39] "GET / HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:11:39] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:11:39] "GET /favicon.ico HTTP/1.1" 404 -
+219.144.254.168 - - [18/May/2026 07:11:47] "GET /subject/ HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:11:47] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:11:50] "GET / HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:11:50] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:11:51] "GET /questions/ HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:11:51] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:11:52] "GET / HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:11:52] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:16:45] "GET / HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:16:45] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:17:23] "GET /settings/ HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:17:23] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:17:25] "GET / HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:17:25] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:17:26] "GET /papers/ HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:17:26] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:18:24] "GET / HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:18:24] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:18:25] "GET /papers/ HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:18:25] "GET /static/css/style.css HTTP/1.1" 304 -
+220.196.160.101 - - [18/May/2026 07:18:29] "GET / HTTP/1.1" 200 -
+220.196.160.101 - - [18/May/2026 07:18:29] "GET /static/css/style.css HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:19:45] "GET /papers/ HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:19:45] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:19:46] "GET /papers/ HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:19:46] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:19:47] "GET /papers/ HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:19:47] "GET /static/css/style.css HTTP/1.1" 304 -
+219.144.254.168 - - [18/May/2026 07:21:04] "GET / HTTP/1.1" 200 -
+219.144.254.168 - - [18/May/2026 07:21:04] "GET /static/css/style.css HTTP/1.1" 304 -
diff --git a/generate_report.py b/generate_report.py
new file mode 100644 (file)
index 0000000..0d6d16b
--- /dev/null
@@ -0,0 +1,134 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import io
+
+# ================= 配置区域 =================
+# 输出文件名
+OUTPUT_FILENAME = "project_all_in_one.txt"
+
+# 需要排除的目录名(完全匹配),例如:['.git','gitea', 'node_modules', 'ZZ Old Version']
+EXCLUDE_DIRS = {".git", "__pycache__", "ZZ Old Version", "Media"}
+
+# 需要排除的文件后缀(不区分大小写),例如:['.exe', '.pyc', '.png', '.jpg']
+EXCLUDE_EXTS = {".exe", ".pyc", ".png", ".jpg", ".jpeg", ".gif", ".pdf", ".zip", ".tar", ".gz"}
+
+# 需要排除的具体文件名
+EXCLUDE_FILES = {OUTPUT_FILENAME, ".DS_Store","gitea"}
+# ===========================================
+
+ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
+
+def write_line(f, line=""):
+    f.write(line + "\n")
+
+def should_exclude(path):
+    """检查路径中是否包含任何被排除的目录"""
+    parts = path.split(os.sep)
+    for d in EXCLUDE_DIRS:
+        if d in parts:
+            return True
+    return False
+
+def collect_tree(root):
+    """生成目录结构树"""
+    lines = []
+    for dirpath, dirnames, filenames in os.walk(root):
+        # 过滤掉排除目录,修改 dirnames 会影响 os.walk 的后续遍历
+        dirnames[:] = [d for d in dirnames if d not in EXCLUDE_DIRS]
+        
+        rel = os.path.relpath(dirpath, root)
+        if rel == ".":
+            indent_level = 0
+            display_path = "."
+        else:
+            indent_level = rel.count(os.sep) + 1
+            display_path = rel.replace(os.sep, "/")
+
+        indent = "    " * indent_level
+        lines.append(f"{indent}{display_path}/")
+
+        for fn in sorted(filenames):
+            if fn in EXCLUDE_FILES:
+                continue
+            _, ext = os.path.splitext(fn)
+            if ext.lower() in EXCLUDE_EXTS:
+                continue
+            lines.append(f"{indent}    {fn}")
+    return lines
+
+def gather_all_files(root):
+    """收集所有符合条件的文件路径"""
+    matches = []
+    for dirpath, dirnames, filenames in os.walk(root):
+        # 过滤排除目录
+        dirnames[:] = [d for d in dirnames if d not in EXCLUDE_DIRS]
+        
+        for fn in filenames:
+            # 过滤排除的文件名和后缀
+            if fn in EXCLUDE_FILES:
+                continue
+            _, ext = os.path.splitext(fn)
+            if ext.lower() in EXCLUDE_EXTS:
+                continue
+                
+            full_path = os.path.join(dirpath, fn)
+            rel_path = os.path.relpath(full_path, root).replace(os.sep, "/")
+            matches.append((rel_path, full_path))
+            
+    matches.sort()
+    return matches
+
+def read_file_content(path):
+    """尝试多种编码读取文件内容,非文本或无法读取则跳过"""
+    encodings = ["utf-8", "utf-8-sig", "gbk", "latin-1"]
+    for enc in encodings:
+        try:
+            with io.open(path, "r", encoding=enc, errors="strict") as f:
+                return f.read()
+        except (UnicodeDecodeError, Exception):
+            continue
+    return "[警告:该文件编码不兼容或为二进制格式,已跳过内容提取]"
+
+def generate_report(root, out_path):
+    with io.open(out_path, "w", encoding="utf-8") as out:
+        # 第一部分:目录结构
+        write_line(out, "==================================================")
+        write_line(out, "第一部分:项目目录结构")
+        write_line(out, "==================================================")
+        tree_lines = collect_tree(root)
+        for ln in tree_lines:
+            write_line(out, ln)
+        write_line(out, "\n")
+
+        # 第二部分:文件内容整合
+        write_line(out, "==================================================")
+        write_line(out, "第二部分:文件内容整合")
+        write_line(out, "==================================================")
+        
+        all_files = gather_all_files(root)
+        if not all_files:
+            write_line(out, "[未找到符合条件的可处理文件]")
+            
+        for rel_path, full_path in all_files:
+            write_line(out, f"\n>>> FILE START: {rel_path} <<<")
+            write_line(out, "=" * 40)
+            
+            content = read_file_content(full_path)
+            out.write(content)
+            
+            if not content.endswith("\n"):
+                out.write("\n")
+            write_line(out, "=" * 40)
+            write_line(out, f">>> FILE END: {rel_path} <<<\n")
+
+if __name__ == "__main__":
+    try:
+        output_full_path = os.path.join(ROOT_DIR, OUTPUT_FILENAME)
+        generate_report(ROOT_DIR, output_full_path)
+        print(f"成功!整合后的文件已保存至:{OUTPUT_FILENAME}")
+    except Exception as e:
+        print(f"程序运行出错:{e}")
+        sys.exit(1)
diff --git a/project_all_in_one.txt b/project_all_in_one.txt
new file mode 100644 (file)
index 0000000..8816595
--- /dev/null
@@ -0,0 +1,448 @@
+==================================================
+第一部分:项目目录结构
+==================================================
+./
+    .gitignore
+    app.py
+    generate_report.py
+    custom/
+        custom/conf/
+            app.ini
+    templates/
+        index.html
+        templates/settings/
+            index.html
+        templates/questions/
+            index.html
+        templates/papers/
+            index.html
+        templates/subject/
+            index.html
+    static/
+        static/css/
+            style.css
+
+
+==================================================
+第二部分:文件内容整合
+==================================================
+
+>>> FILE START: .gitignore <<<
+========================================
+__pycache__/
+*.py[cod]
+*$py.class
+.venv/
+venv/
+ENV/
+*.db
+.DS_Store
+========================================
+>>> FILE END: .gitignore <<<
+
+
+>>> FILE START: app.py <<<
+========================================
+from flask import Flask, render_template
+
+app = Flask(__name__)
+
+# 首页
+@app.route('/')
+def index():
+    return render_template('index.html')
+
+# 科目面板
+@app.route('/subject/')
+def subject():
+    return render_template('subject/index.html')
+
+# 题目管理
+@app.route('/questions/')
+def questions():
+    return render_template('questions/index.html')
+
+# 试卷管理
+@app.route('/papers/')
+def papers():
+    return render_template('papers/index.html')
+
+# 系统设定
+@app.route('/settings/')
+def settings():
+    return render_template('settings/index.html')
+
+if __name__ == '__main__':
+    app.run(host='0.0.0.0', port=5000)
+========================================
+>>> FILE END: app.py <<<
+
+
+>>> FILE START: custom/conf/app.ini <<<
+========================================
+[server]
+LOCAL_ROOT_URL = http://localhost:4999/
+========================================
+>>> FILE END: custom/conf/app.ini <<<
+
+
+>>> FILE START: generate_report.py <<<
+========================================
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import io
+
+# ================= 配置区域 =================
+# 输出文件名
+OUTPUT_FILENAME = "project_all_in_one.txt"
+
+# 需要排除的目录名(完全匹配),例如:['.git','gitea', 'node_modules', 'ZZ Old Version']
+EXCLUDE_DIRS = {".git", "__pycache__", "ZZ Old Version", "Media"}
+
+# 需要排除的文件后缀(不区分大小写),例如:['.exe', '.pyc', '.png', '.jpg']
+EXCLUDE_EXTS = {".exe", ".pyc", ".png", ".jpg", ".jpeg", ".gif", ".pdf", ".zip", ".tar", ".gz"}
+
+# 需要排除的具体文件名
+EXCLUDE_FILES = {OUTPUT_FILENAME, ".DS_Store","gitea"}
+# ===========================================
+
+ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
+
+def write_line(f, line=""):
+    f.write(line + "\n")
+
+def should_exclude(path):
+    """检查路径中是否包含任何被排除的目录"""
+    parts = path.split(os.sep)
+    for d in EXCLUDE_DIRS:
+        if d in parts:
+            return True
+    return False
+
+def collect_tree(root):
+    """生成目录结构树"""
+    lines = []
+    for dirpath, dirnames, filenames in os.walk(root):
+        # 过滤掉排除目录,修改 dirnames 会影响 os.walk 的后续遍历
+        dirnames[:] = [d for d in dirnames if d not in EXCLUDE_DIRS]
+        
+        rel = os.path.relpath(dirpath, root)
+        if rel == ".":
+            indent_level = 0
+            display_path = "."
+        else:
+            indent_level = rel.count(os.sep) + 1
+            display_path = rel.replace(os.sep, "/")
+
+        indent = "    " * indent_level
+        lines.append(f"{indent}{display_path}/")
+
+        for fn in sorted(filenames):
+            if fn in EXCLUDE_FILES:
+                continue
+            _, ext = os.path.splitext(fn)
+            if ext.lower() in EXCLUDE_EXTS:
+                continue
+            lines.append(f"{indent}    {fn}")
+    return lines
+
+def gather_all_files(root):
+    """收集所有符合条件的文件路径"""
+    matches = []
+    for dirpath, dirnames, filenames in os.walk(root):
+        # 过滤排除目录
+        dirnames[:] = [d for d in dirnames if d not in EXCLUDE_DIRS]
+        
+        for fn in filenames:
+            # 过滤排除的文件名和后缀
+            if fn in EXCLUDE_FILES:
+                continue
+            _, ext = os.path.splitext(fn)
+            if ext.lower() in EXCLUDE_EXTS:
+                continue
+                
+            full_path = os.path.join(dirpath, fn)
+            rel_path = os.path.relpath(full_path, root).replace(os.sep, "/")
+            matches.append((rel_path, full_path))
+            
+    matches.sort()
+    return matches
+
+def read_file_content(path):
+    """尝试多种编码读取文件内容,非文本或无法读取则跳过"""
+    encodings = ["utf-8", "utf-8-sig", "gbk", "latin-1"]
+    for enc in encodings:
+        try:
+            with io.open(path, "r", encoding=enc, errors="strict") as f:
+                return f.read()
+        except (UnicodeDecodeError, Exception):
+            continue
+    return "[警告:该文件编码不兼容或为二进制格式,已跳过内容提取]"
+
+def generate_report(root, out_path):
+    with io.open(out_path, "w", encoding="utf-8") as out:
+        # 第一部分:目录结构
+        write_line(out, "==================================================")
+        write_line(out, "第一部分:项目目录结构")
+        write_line(out, "==================================================")
+        tree_lines = collect_tree(root)
+        for ln in tree_lines:
+            write_line(out, ln)
+        write_line(out, "\n")
+
+        # 第二部分:文件内容整合
+        write_line(out, "==================================================")
+        write_line(out, "第二部分:文件内容整合")
+        write_line(out, "==================================================")
+        
+        all_files = gather_all_files(root)
+        if not all_files:
+            write_line(out, "[未找到符合条件的可处理文件]")
+            
+        for rel_path, full_path in all_files:
+            write_line(out, f"\n>>> FILE START: {rel_path} <<<")
+            write_line(out, "=" * 40)
+            
+            content = read_file_content(full_path)
+            out.write(content)
+            
+            if not content.endswith("\n"):
+                out.write("\n")
+            write_line(out, "=" * 40)
+            write_line(out, f">>> FILE END: {rel_path} <<<\n")
+
+if __name__ == "__main__":
+    try:
+        output_full_path = os.path.join(ROOT_DIR, OUTPUT_FILENAME)
+        generate_report(ROOT_DIR, output_full_path)
+        print(f"成功!整合后的文件已保存至:{OUTPUT_FILENAME}")
+    except Exception as e:
+        print(f"程序运行出错:{e}")
+        sys.exit(1)
+========================================
+>>> FILE END: generate_report.py <<<
+
+
+>>> FILE START: static/css/style.css <<<
+========================================
+/* 全局样式 */
+body {
+    margin: 0;
+    padding: 0;
+    background-color: #f0f2f5;
+    font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft YaHei", sans-serif;
+}
+
+/* 顶部导航栏 */
+.navbar {
+    height: 60px;
+    background: linear-gradient(135deg, #4088d8 0%, #2a69b5 100%);
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    color: white;
+    font-size: 24px;
+    font-weight: bold;
+    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
+}
+
+/* 主体区域 - 设置为不换行,确保在一行显示 */
+.container {
+    display: flex;
+    flex-direction: row; /* 横向排列 */
+    justify-content: center;
+    align-items: center;
+    gap: 20px;           /* 适当缩小间距以适应屏幕宽度 */
+    padding: 60px 20px;
+    margin: 0 auto;
+    overflow-x: auto;    /* 如果屏幕太窄,允许横向滚动 */
+}
+
+/* 卡片按钮基础样式 */
+.card {
+    width: 260px;        /* 略微调窄一点点确保一行能放下 */
+    height: 80px;
+    background-color: white;
+    border-radius: 12px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    font-size: 18px;
+    font-weight: 600;
+    cursor: pointer;
+    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
+    text-decoration: none;
+    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
+    border: 1px solid rgba(0,0,0,0.05);
+}
+
+.card:hover {
+    transform: translateY(-5px);
+    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
+}
+
+/* 丰富的配色方案 */
+/* ① 科目面板 - 蓝色系 */
+.card-subject { color: #0066cc; border-left: 6px solid #0066cc; }
+.card-subject:hover { background-color: #f0f7ff; color: #004499; }
+
+/* ② 题目管理 - 绿色系 */
+.card-question { color: #009944; border-left: 6px solid #009944; }
+.card-question:hover { background-color: #f0fff4; color: #007733; }
+
+/* ③ 试卷管理 - 橙色系 */
+.card-paper { color: #e67e22; border-left: 6px solid #e67e22; }
+.card-paper:hover { background-color: #fffaf5; color: #d35400; }
+
+/* ④ 系统设定 - 紫色/灰色系 */
+.card-setting { color: #8e44ad; border-left: 6px solid #8e44ad; }
+.card-setting:hover { background-color: #f9f5fb; color: #732d91; }
+
+.icon-num {
+    margin-right: 12px;
+    font-size: 22px;
+    font-style: italic;
+    opacity: 0.8;
+}
+
+/* 子页面特定的 Header 颜色 */
+.header-subject { background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important; }
+.header-question { background: linear-gradient(135deg, #009944 0%, #007733 100%) !important; }
+.header-paper { background: linear-gradient(135deg, #e67e22 0%, #d35400 100%) !important; }
+.header-setting { background: linear-gradient(135deg, #8e44ad 0%, #732d91 100%) !important; }
+
+========================================
+>>> FILE END: static/css/style.css <<<
+
+
+>>> FILE START: templates/index.html <<<
+========================================
+<!DOCTYPE html>
+<html lang="zh">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>错题智能整理系统</title>
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
+</head>
+<body>
+    <div class="navbar">错题智能整理系统</div>
+
+    <div class="container">
+        <a href="/subject/" class="card card-subject"><span class="icon-num">①</span> 科目面板</a>
+        <a href="/questions/" class="card card-question"><span class="icon-num">②</span> 题目管理</a>
+        <a href="/papers/" class="card card-paper"><span class="icon-num">③</span> 试卷管理</a>
+        <a href="/settings/" class="card card-setting"><span class="icon-num">④</span> 系统设定</a>
+    </div>
+</body>
+</html>
+========================================
+>>> FILE END: templates/index.html <<<
+
+
+>>> FILE START: templates/papers/index.html <<<
+========================================
+<!DOCTYPE html>
+<html lang="zh">
+<head>
+    <meta charset="UTF-8">
+    <title>试卷管理 - 错题系统</title>
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
+    <style>
+        .sub-container { padding: 50px; text-align: center; }
+        .back-btn { display: inline-block; margin-top: 20px; padding: 10px 20px; background: #666; color: white; text-decoration: none; border-radius: 5px; }
+    </style>
+</head>
+<body>
+    <div class="navbar header-paper">试卷管理</div>
+    <div class="sub-container">
+        <h2>这里是试卷管理内容区域</h2>
+        <p>正在从原 Python 程序迁移逻辑...</p>
+        <a href="/" class="back-btn">返回首页</a>
+    </div>
+</body>
+</html>
+========================================
+>>> FILE END: templates/papers/index.html <<<
+
+
+>>> FILE START: templates/questions/index.html <<<
+========================================
+<!DOCTYPE html>
+<html lang="zh">
+<head>
+    <meta charset="UTF-8">
+    <title>科目面板 - 错题系统</title>
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
+    <style>
+        .sub-container { padding: 50px; text-align: center; }
+        .back-btn { display: inline-block; margin-top: 20px; padding: 10px 20px; background: #666; color: white; text-decoration: none; border-radius: 5px; }
+    </style>
+</head>
+<body>
+    <div class="navbar header-question">科目面板</div>
+    <div class="sub-container">
+        <h2>这里是科目面板内容区域</h2>
+        <p>正在从原 Python 程序迁移逻辑...</p>
+        <a href="/" class="back-btn">返回首页</a>
+    </div>
+</body>
+</html>
+========================================
+>>> FILE END: templates/questions/index.html <<<
+
+
+>>> FILE START: templates/settings/index.html <<<
+========================================
+<!DOCTYPE html>
+<html lang="zh">
+<head>
+    <meta charset="UTF-8">
+    <title>系统设定 - 错题系统</title>
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
+    <style>
+        .sub-container { padding: 50px; text-align: center; }
+        .back-btn { display: inline-block; margin-top: 20px; padding: 10px 20px; background: #666; color: white; text-decoration: none; border-radius: 5px; }
+    </style>
+</head>
+<body>
+    <div class="navbar header-setting">系统设定</div>
+    <div class="sub-container">
+        <h2>这里是系统设定内容区域</h2>
+        <p>正在从原 Python 程序迁移逻辑...</p>
+        <a href="/" class="back-btn">返回首页</a>
+    </div>
+</body>
+</html>
+========================================
+>>> FILE END: templates/settings/index.html <<<
+
+
+>>> FILE START: templates/subject/index.html <<<
+========================================
+<!DOCTYPE html>
+<html lang="zh">
+<head>
+    <meta charset="UTF-8">
+    <title>科目首页 - 错题系统</title>
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
+    <style>
+        .sub-container { padding: 50px; text-align: center; }
+        .back-btn { display: inline-block; margin-top: 20px; padding: 10px 20px; background: #666; color: white; text-decoration: none; border-radius: 5px; }
+    </style>
+</head>
+<body>
+    <div class="navbar header-subject">科目首页</div>
+    <div class="sub-container">
+        <h2>这里是科目首页内容区域</h2>
+        <p>正在从原 Python 程序迁移逻辑...</p>
+        <a href="/" class="back-btn">返回首页</a>
+    </div>
+</body>
+</html>
+========================================
+>>> FILE END: templates/subject/index.html <<<
+
index 54417d51e1390688cc3f286fdb743f4812220268..144ce60e01e3ea531435bb60414be536750d9f2f 100644 (file)
@@ -1,12 +1,13 @@
-/* 全局样式 */
+/* 全局基础样式 */
 body {
     margin: 0;
     padding: 0;
     background-color: #f0f2f5;
-    font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft YaHei", sans-serif;
+    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
+    -webkit-font-smoothing: antialiased;
 }
 
-/* 顶部导航栏 */
+/* 顶部导航栏基础样式 */
 .navbar {
     height: 60px;
     background: linear-gradient(135deg, #4088d8 0%, #2a69b5 100%);
@@ -14,29 +15,49 @@ body {
     justify-content: center;
     align-items: center;
     color: white;
-    font-size: 24px;
+    font-size: 22px;
     font-weight: bold;
     box-shadow: 0 2px 10px rgba(0,0,0,0.1);
+    position: sticky;
+    top: 0;
+    z-index: 1000;
 }
 
-/* 主体区域 - 设置为不换行,确保在一行显示 */
+/* 子页面特定的 Header 颜色 - 对应首页按钮色系 */
+.header-subject { background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important; }
+.header-question { background: linear-gradient(135deg, #009944 0%, #007733 100%) !important; }
+.header-paper { background: linear-gradient(135deg, #e67e22 0%, #d35400 100%) !important; }
+.header-setting { background: linear-gradient(135deg, #8e44ad 0%, #732d91 100%) !important; }
+
+/* 主体容器 - 响应式 Flex 布局 */
 .container {
     display: flex;
-    flex-direction: row; /* 横向排列 */
+    flex-wrap: wrap;      /* 核心:允许在空间不足时换行 */
+    flex-direction: row; 
     justify-content: center;
     align-items: center;
-    gap: 20px;           /* 适当缩小间距以适应屏幕宽度 */
-    padding: 60px 20px;
+    gap: 20px;
+    padding: 40px 20px;
+    max-width: 1200px;
+    margin: 0 auto;
+}
+
+/* 详情页容器 */
+.sub-container {
+    padding: 30px 20px;
+    text-align: center;
+    max-width: 800px;
     margin: 0 auto;
-    overflow-x: auto;    /* 如果屏幕太窄,允许横向滚动 */
 }
 
 /* 卡片按钮基础样式 */
 .card {
-    width: 260px;        /* 略微调窄一点点确保一行能放下 */
-    height: 80px;
+    flex: 1;               /* 自动伸缩 */
+    min-width: 240px;      /* 保证电脑端不会太窄 */
+    max-width: 280px;      /* 保证电脑端不会太宽 */
+    height: 85px;
     background-color: white;
-    border-radius: 12px;
+    border-radius: 15px;
     display: flex;
     align-items: center;
     justify-content: center;
@@ -45,42 +66,74 @@ body {
     cursor: pointer;
     transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
     text-decoration: none;
-    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
+    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
     border: 1px solid rgba(0,0,0,0.05);
 }
 
 .card:hover {
     transform: translateY(-5px);
-    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
+    box-shadow: 0 12px 20px rgba(0,0,0,0.15);
 }
 
-/* 丰富的配色方案 */
-/* ① 科目面板 - 蓝色系 */
-.card-subject { color: #0066cc; border-left: 6px solid #0066cc; }
-.card-subject:hover { background-color: #f0f7ff; color: #004499; }
+/* 四个模块的丰富配色方案 */
+.card-subject { color: #0066cc; border-left: 8px solid #0066cc; }
+.card-subject:hover { background-color: #f0f7ff; }
 
-/* ② 题目管理 - 绿色系 */
-.card-question { color: #009944; border-left: 6px solid #009944; }
-.card-question:hover { background-color: #f0fff4; color: #007733; }
+.card-question { color: #009944; border-left: 8px solid #009944; }
+.card-question:hover { background-color: #f0fff4; }
 
-/* ③ 试卷管理 - 橙色系 */
-.card-paper { color: #e67e22; border-left: 6px solid #e67e22; }
-.card-paper:hover { background-color: #fffaf5; color: #d35400; }
+.card-paper { color: #e67e22; border-left: 8px solid #e67e22; }
+.card-paper:hover { background-color: #fffaf5; }
 
-/* ④ 系统设定 - 紫色/灰色系 */
-.card-setting { color: #8e44ad; border-left: 6px solid #8e44ad; }
-.card-setting:hover { background-color: #f9f5fb; color: #732d91; }
+.card-setting { color: #8e44ad; border-left: 8px solid #8e44ad; }
+.card-setting:hover { background-color: #f9f5fb; }
 
+/* 图标/数字样式 */
 .icon-num {
     margin-right: 12px;
     font-size: 22px;
-    font-style: italic;
-    opacity: 0.8;
+    font-weight: bold;
+    opacity: 0.7;
 }
 
-/* 子页面特定的 Header 颜色 */
-.header-subject { background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important; }
-.header-question { background: linear-gradient(135deg, #009944 0%, #007733 100%) !important; }
-.header-paper { background: linear-gradient(135deg, #e67e22 0%, #d35400 100%) !important; }
-.header-setting { background: linear-gradient(135deg, #8e44ad 0%, #732d91 100%) !important; }
+/* 返回按钮样式 */
+.back-btn {
+    display: inline-block;
+    margin-top: 30px;
+    padding: 12px 30px;
+    background: #666;
+    color: white;
+    text-decoration: none;
+    border-radius: 25px;
+    font-weight: 500;
+    transition: background 0.3s;
+}
+.back-btn:hover {
+    background: #333;
+}
+
+/* === 移动端适配 (iPhone 等) === */
+@media (max-width: 600px) {
+    .navbar {
+        font-size: 18px;
+        height: 50px;
+    }
+
+    .container {
+        padding: 20px 15px;
+        gap: 15px;
+    }
 
+    .card {
+        /* 在手机上,让按钮占据几乎全部宽度,防止并排重叠 */
+        min-width: 100%;
+        max-width: 100%;
+        height: 75px;
+        font-size: 17px;
+        border-left-width: 10px; /* 手机上加粗色块更醒目 */
+    }
+
+    .sub-container h2 {
+        font-size: 20px;
+    }
+}