主要内容: - 包含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>
78 lines
2.6 KiB
Python
78 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import re
|
||
import json
|
||
|
||
def safe_escape_js_string(text):
|
||
"""安全地转义JavaScript字符串"""
|
||
# 转义反斜杠(必须首先执行)
|
||
text = text.replace('\\', '\\\\')
|
||
# 转义双引号
|
||
text = text.replace('"', '\\"')
|
||
# 转义换行符
|
||
text = text.replace('\n', '\\n')
|
||
# 转义回车符
|
||
text = text.replace('\r', '\\r')
|
||
# 转义制表符
|
||
text = text.replace('\t', '\\t')
|
||
return text
|
||
|
||
def main():
|
||
# 读取BIM工程师的修改版简历
|
||
with open('网页未导入数据/土木水利产业/土木水利修改版简历/BIM工程师.md', 'r', encoding='utf-8') as f:
|
||
bim_content = f.read()
|
||
|
||
print("原始内容长度:", len(bim_content))
|
||
|
||
# 安全转义内容
|
||
escaped_content = safe_escape_js_string(bim_content)
|
||
print("转义后内容长度:", len(escaped_content))
|
||
print("转义后内容前100字符:", escaped_content[:100])
|
||
|
||
# 读取当前的resumeInterviewMock.js文件
|
||
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
|
||
js_content = f.read()
|
||
|
||
# 查找BIM工程师的modified字段并替换
|
||
# 使用更精确的正则表达式来匹配
|
||
pattern = r'("modified":\s*"# 对应岗位:BIM工程师[^"]*")'
|
||
|
||
# 构建新的替换内容
|
||
replacement = f'"modified": "{escaped_content}"'
|
||
|
||
# 查找当前错误的内容位置
|
||
error_pattern = r'"modified":\s*"# 对应岗位:BIM工程师[^}]*?(?=")'
|
||
|
||
# 先查看是否能找到错误位置
|
||
match = re.search(error_pattern, js_content, re.DOTALL)
|
||
if match:
|
||
print("找到错误的modified字段,位置:", match.start(), "-", match.end())
|
||
print("错误内容开头:", match.group()[:100])
|
||
|
||
# 替换内容
|
||
new_js_content = re.sub(error_pattern, replacement, js_content, flags=re.DOTALL)
|
||
|
||
# 保存修复后的文件
|
||
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
|
||
f.write(new_js_content)
|
||
|
||
print("已成功修复BIM工程师的modified字段")
|
||
|
||
# 验证语法
|
||
import subprocess
|
||
try:
|
||
result = subprocess.run(['node', '-c', 'src/mocks/resumeInterviewMock.js'],
|
||
capture_output=True, text=True)
|
||
if result.returncode == 0:
|
||
print("✅ JavaScript语法检查通过")
|
||
else:
|
||
print("❌ JavaScript语法错误:")
|
||
print(result.stderr)
|
||
except Exception as e:
|
||
print("无法验证JavaScript语法:", e)
|
||
else:
|
||
print("未找到BIM工程师的modified字段")
|
||
|
||
if __name__ == "__main__":
|
||
main() |