From 11c6960353c05f2fe81e4353090a32c7034e1629 Mon Sep 17 00:00:00 2001 From: superlishunqin <852326703@qq.com> Date: Mon, 22 Sep 2025 07:33:00 +0800 Subject: [PATCH] homepage --- app/static/css/style.css | 27 +++++++++++++++++++++++++++ run.py | 26 +++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/app/static/css/style.css b/app/static/css/style.css index 217aea9..bc8f524 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -210,6 +210,7 @@ main { /* 天空彩虹装饰 - 大彩虹弧形 */ .rainbow-bg { + pointer-events: none; position: fixed; bottom: -200px; left: 50%; @@ -4443,6 +4444,7 @@ a.btn:hover { /* 天空装饰元素 */ .sky-sun { + pointer-events: none; position: fixed; top: 80px; right: 100px; @@ -4473,6 +4475,7 @@ a.btn:hover { } .sky-clouds { + pointer-events: none; position: fixed; top: 0; left: 0; @@ -4566,6 +4569,7 @@ a.btn:hover { /* 小装饰星星 */ .sky-stars { + pointer-events: none; position: fixed; top: 0; left: 0; @@ -4705,6 +4709,7 @@ a.btn:hover { /* 响应式调整 */ @media (max-width: 768px) { .sky-sun { + pointer-events: none; top: 60px; right: 20px; width: 60px; @@ -4723,6 +4728,7 @@ a.btn:hover { } .rainbow-bg { + pointer-events: none; width: 140vw; bottom: -150px; } @@ -4730,6 +4736,7 @@ a.btn:hover { @media (max-width: 576px) { .sky-sun { + pointer-events: none; width: 50px; height: 50px; top: 40px; @@ -4737,9 +4744,29 @@ a.btn:hover { } .rainbow-bg { + pointer-events: none; width: 160vw; bottom: -120px; height: 300px; } } + +/* 确保导航栏正常工作 */ +.navbar { + position: relative; + z-index: 1050 !important; +} + +.navbar .dropdown-menu { + z-index: 1051 !important; +} + +.navbar .nav-link { + pointer-events: auto !important; +} + +.navbar .dropdown-toggle { + pointer-events: auto !important; +} + diff --git a/run.py b/run.py index aeb2794..0600e1a 100644 --- a/run.py +++ b/run.py @@ -117,6 +117,8 @@ def make_shell_context(): } if __name__ == '__main__': + import platform + # 确保日志目录存在 os.makedirs('logs', exist_ok=True) @@ -125,9 +127,31 @@ if __name__ == '__main__': # 强制开启Debug模式,便于前端开发 debug = True + # 根据操作系统选择合适的host + if platform.system() == 'Darwin': # macOS + host = '127.0.0.1' + else: + host = os.environ.get('HOST', '0.0.0.0') + print("🚀 启动儿童语言学习系统...") print(f"📱 访问地址: http://localhost:{port}") print(f"🔧 调试模式: {debug}") + print(f"🌐 监听地址: {host}:{port}") print(f"📊 数据库: {app.config['SQLALCHEMY_DATABASE_URI']}") - app.run(host='0.0.0.0', port=port, debug=debug) + try: + app.run(host=host, port=port, debug=debug) + except OSError as e: + if "Unknown host" in str(e) or "getfqdn" in str(e): + print("⚠️ 检测到主机名解析问题,尝试使用localhost...") + try: + app.run(host='localhost', port=port, debug=debug) + except Exception as e2: + print(f"❌ 启动失败: {e2}") + print("💡 尝试使用: python3 run.py 或检查网络配置") + else: + print(f"❌ 启动失败: {e}") + except KeyboardInterrupt: + print("服务器已停止") + except Exception as e: + print(f"❌ 启动失败: {e}")