主要内容: - 包含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>
99 lines
3.5 KiB
Python
99 lines
3.5 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
import re
|
|
|
|
def fix_multiline_strings(content):
|
|
"""修复JavaScript文件中的多行字符串问题"""
|
|
|
|
# 查找所有的 "overview":, "process":, "keyPoints": 字段
|
|
lines = content.split('\n')
|
|
fixed_lines = []
|
|
in_string = False
|
|
current_field = None
|
|
string_content = []
|
|
|
|
for i, line in enumerate(lines):
|
|
# 检查是否是字段开始
|
|
if not in_string:
|
|
if '"overview":' in line or '"process":' in line or '"keyPoints":' in line:
|
|
# 提取字段名和开始的内容
|
|
match = re.match(r'(\s*"(overview|process|keyPoints)":\s*")(.*)', line)
|
|
if match:
|
|
prefix = match.group(1)
|
|
field = match.group(2)
|
|
content = match.group(3)
|
|
|
|
# 检查是否在同一行结束
|
|
if content.endswith('",') or content.endswith('"'):
|
|
# 单行字符串,直接添加
|
|
fixed_lines.append(line)
|
|
else:
|
|
# 多行字符串开始
|
|
in_string = True
|
|
current_field = field
|
|
string_content = [content]
|
|
# 保存前缀,稍后使用
|
|
current_prefix = prefix
|
|
else:
|
|
fixed_lines.append(line)
|
|
else:
|
|
fixed_lines.append(line)
|
|
else:
|
|
# 在字符串内部
|
|
# 检查是否是字符串结束
|
|
if line.strip().endswith('",') or line.strip().endswith('"'):
|
|
# 字符串结束
|
|
# 提取结束部分的内容
|
|
end_content = line.strip()
|
|
if end_content.endswith('",'):
|
|
string_content.append(end_content[:-2])
|
|
ending = '",'
|
|
else:
|
|
string_content.append(end_content[:-1])
|
|
ending = '"'
|
|
|
|
# 合并所有内容并转义换行符
|
|
full_content = '\\n'.join(string_content)
|
|
# 转义其他特殊字符
|
|
full_content = full_content.replace('\\', '\\\\')
|
|
full_content = full_content.replace('"', '\\"')
|
|
|
|
# 创建修复后的行
|
|
fixed_line = current_prefix + full_content + ending
|
|
fixed_lines.append(fixed_line)
|
|
|
|
# 重置状态
|
|
in_string = False
|
|
current_field = None
|
|
string_content = []
|
|
else:
|
|
# 继续收集字符串内容
|
|
string_content.append(line)
|
|
|
|
return '\n'.join(fixed_lines)
|
|
|
|
def main():
|
|
# 读取文件
|
|
with open('src/mocks/projectLibraryMock.js', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# 修复多行字符串
|
|
fixed_content = fix_multiline_strings(content)
|
|
|
|
# 保存修复后的文件
|
|
with open('src/mocks/projectLibraryMock.js', 'w', encoding='utf-8') as f:
|
|
f.write(fixed_content)
|
|
|
|
print("✅ 多行字符串已修复")
|
|
|
|
# 验证语法
|
|
import subprocess
|
|
result = subprocess.run(['node', '-c', 'src/mocks/projectLibraryMock.js'],
|
|
capture_output=True, text=True)
|
|
if result.returncode == 0:
|
|
print("✅ JavaScript语法检查通过")
|
|
else:
|
|
print(f"❌ JavaScript语法错误: {result.stderr}")
|
|
|
|
if __name__ == "__main__":
|
|
main() |