Files
ALL-teach_sys/frontend_食品/fix_structure.py
KQL cd2e307402 初始化12个产业教务系统项目
主要内容:
- 包含12个产业的完整教务系统前端代码
- 智能启动脚本 (start-industry.sh)
- 可视化产业导航页面 (index.html)
- 项目文档 (README.md)

优化内容:
- 删除所有node_modules和.yoyo文件夹,从7.5GB减少到2.7GB
- 添加.gitignore文件避免上传不必要的文件
- 自动依赖管理和智能启动系统

产业列表:
1. 文旅产业 (5150)
2. 智能制造 (5151)
3. 智能开发 (5152)
4. 财经商贸 (5153)
5. 视觉设计 (5154)
6. 交通物流 (5155)
7. 大健康 (5156)
8. 土木水利 (5157)
9. 食品产业 (5158)
10. 化工产业 (5159)
11. 能源产业 (5160)
12. 环保产业 (5161)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 14:14:14 +08:00

82 lines
3.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def fix_mockdata_structure():
"""完全重构mockData.js的结构"""
file_path = 'src/data/mockData.js'
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
print("开始重构文件结构...")
# 找到profileOverview的开始位置
profile_start = content.find('// 个人档案页面数据\n profileOverview: {')
if profile_start == -1:
profile_start = content.find('profileOverview: {')
if profile_start != -1:
print(f"找到profileOverview定义位置: {profile_start}")
# 在profileOverview之前添加正确的结束符
before_profile = content[:profile_start]
# 确保在profileOverview之前正确关闭之前的对象
if not before_profile.rstrip().endswith(','):
before_profile = before_profile.rstrip() + ',\n\n '
# 提取profileOverview之后的内容
after_profile_start = content[profile_start:]
# 找到profileOverview的结束位置
profile_end = after_profile_start.find('};\n\n// 课程直播间的课程列表数据')
if profile_end == -1:
profile_end = after_profile_start.find('};\n\n// 生成公共课程列表')
if profile_end == -1:
profile_end = after_profile_start.find('};\n\nmockData.courseLiveList')
if profile_end != -1:
print(f"找到profileOverview结束位置: {profile_end}")
profile_content = after_profile_start[:profile_end + 2] # 包含 };
after_profile = after_profile_start[profile_end + 3:] # 不包含 };
# 修复profileOverview内容确保结构正确
profile_content = profile_content.replace('};\n\n// 课程直播间', '};\n\n// 在mockData对象内\n\n// 课程直播间')
# 重新组合内容
new_content = before_profile + profile_content.rstrip()
# 如果profileOverview后面还有内容确保正确关闭mockData对象
if after_profile.strip():
new_content += '\n};\n\n' + after_profile
else:
new_content += '\n};\n\nexport { mockData };'
else:
print("未找到profileOverview结束位置")
return
else:
print("未找到profileOverview定义")
return
# 保存修复后的文件
with open(file_path, 'w', encoding='utf-8') as f:
f.write(new_content)
print("文件结构重构完成!")
# 验证语法
import subprocess
result = subprocess.run(['node', '-c', file_path], capture_output=True, text=True)
if result.returncode == 0:
print("✅ JavaScript语法检查通过!")
else:
print(f"❌ JavaScript语法仍有错误: {result.stderr}")
except Exception as e:
print(f"修复过程中出错: {e}")
if __name__ == "__main__":
fix_mockdata_structure()