Files
ALL-teach_sys/frontend_大健康/final_fix_questions.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
2.7 KiB
Python
Raw Permalink 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 -*-
print("最终修复Mock文件结构...")
# 读取文件
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
lines = f.readlines()
# 备份
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js.backup_final_fix', 'w', encoding='utf-8') as f:
f.writelines(lines)
# 找到health_10的questions在第1787行
# 需要把从1787行开始的questions移到health_10的positions数组后面
# 找到health_10的positions数组结束第2073行
# 在这之前插入questions
# 提取questions内容从第1787行到某个结束位置
questions_start = 1786 # 第1787行索引是1786
questions_lines = []
bracket_count = 0
in_questions = False
for i in range(questions_start, len(lines)):
line = lines[i]
if '"questions": [' in line:
in_questions = True
bracket_count = 1
questions_lines.append(line)
elif in_questions:
questions_lines.append(line)
# 计算括号
bracket_count += line.count('[') - line.count(']')
if bracket_count == 0:
# questions数组结束
break
# 删除原位置的questions
# 从1785行有个多余的]开始删除到questions结束
del_start = 1784 # 第1785行
del_end = questions_start + len(questions_lines) + 1
# 删除这些行
new_lines = lines[:del_start] + lines[del_end:]
# 现在需要在health_10的positions数组后插入questions
# 找到正确的位置positions数组的结束
# 由于删除了一些行,需要重新定位
# 查找health_10的positions结束位置
for i in range(1760, len(new_lines)):
if 'health_10_4' in new_lines[i]:
# 找到最后一个position
# 继续找到它的结束
for j in range(i, min(i+50, len(new_lines))):
if '}' in new_lines[j] and 'requirements' in ''.join(new_lines[max(0, j-10):j]):
# 这是position对象的结束
# 在下一行插入
insert_pos = j + 1
# 修正格式确保positions数组正确关闭
new_lines[insert_pos-1] = ' }\n'
# 插入positions数组的关闭和questions
insert_lines = [' ],\n']
insert_lines.extend(questions_lines)
# 在insert_pos插入
new_lines = new_lines[:insert_pos] + insert_lines + new_lines[insert_pos:]
break
break
# 写回文件
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.writelines(new_lines)
print("✓ 修复完成!")