主要内容: - 包含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>
162 lines
5.2 KiB
Python
162 lines
5.2 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import re
|
||
from datetime import datetime
|
||
|
||
def create_backup(file_path):
|
||
"""创建备份文件"""
|
||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||
backup_path = f"{file_path}.backup_{timestamp}"
|
||
with open(file_path, 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
with open(backup_path, 'w', encoding='utf-8') as f:
|
||
f.write(content)
|
||
print(f"已创建备份: {backup_path}")
|
||
return backup_path
|
||
|
||
def remove_modified_fields():
|
||
"""删除没有真实修改版的岗位的modified字段,保持content对象完整"""
|
||
|
||
# 有真实修改版的岗位列表(这些要保留modified)
|
||
real_modified_positions = {
|
||
"会展策划师",
|
||
"会展执行助理",
|
||
"会展讲解员",
|
||
"活动策划师",
|
||
"活动执行",
|
||
"漫展策划师",
|
||
"旅游规划师",
|
||
"旅游计调专员",
|
||
"景区运营专员",
|
||
"文旅运营总监助理"
|
||
}
|
||
|
||
file_path = 'src/mocks/resumeInterviewMock.js'
|
||
|
||
# 创建备份
|
||
create_backup(file_path)
|
||
|
||
# 读取文件内容
|
||
with open(file_path, 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
|
||
modified_count = 0
|
||
kept_count = 0
|
||
|
||
# 更精确的正则表达式:匹配content对象中的modified字段
|
||
# 这个模式会匹配从position到content对象,找到modified字段并删除它
|
||
def process_position(match):
|
||
nonlocal modified_count, kept_count
|
||
full_match = match.group(0)
|
||
position_name = match.group(1)
|
||
|
||
# 如果是有真实修改版的岗位,保持不变
|
||
if position_name in real_modified_positions:
|
||
kept_count += 1
|
||
print(f"✓ 保留 {position_name} 的modified字段")
|
||
return full_match
|
||
|
||
# 删除modified字段,但保持content对象的结构
|
||
# 查找并删除 ,modified: `...` 部分
|
||
# 使用非贪婪匹配来找到modified字段
|
||
pattern = r',\s*modified:\s*`[^`]*`'
|
||
new_content = re.sub(pattern, '', full_match, flags=re.DOTALL)
|
||
|
||
modified_count += 1
|
||
print(f"✗ 删除 {position_name} 的modified字段")
|
||
return new_content
|
||
|
||
# 匹配从position到整个content对象的模式
|
||
# 使用更精确的模式来确保不会破坏content对象的结构
|
||
pattern = r'position:\s*"([^"]+)"[^}]*?content:\s*\{[^}]*?original:\s*`[^`]*?`(?:,\s*modified:\s*`[^`]*?`)?\s*\}'
|
||
|
||
# 执行替换
|
||
new_content = re.sub(pattern, process_position, content, flags=re.DOTALL)
|
||
|
||
# 保存文件
|
||
with open(file_path, 'w', encoding='utf-8') as f:
|
||
f.write(new_content)
|
||
|
||
print(f"\n处理完成!")
|
||
print(f"- 删除了 {modified_count} 个岗位的modified字段")
|
||
print(f"- 保留了 {kept_count} 个岗位的modified字段")
|
||
|
||
def verify_results():
|
||
"""验证处理结果"""
|
||
file_path = 'src/mocks/resumeInterviewMock.js'
|
||
|
||
# 首先检查文件语法
|
||
import subprocess
|
||
result = subprocess.run(['node', '-c', file_path], capture_output=True, text=True)
|
||
if result.returncode != 0:
|
||
print(f"⚠️ 文件语法错误: {result.stderr}")
|
||
return False
|
||
else:
|
||
print("✓ 文件语法正确")
|
||
|
||
with open(file_path, 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
|
||
# 统计所有有modified字段的岗位
|
||
pattern = r'position:\s*"([^"]+)"[^}]*?modified:\s*`'
|
||
matches = re.findall(pattern, content, re.DOTALL)
|
||
|
||
print("\n验证结果:")
|
||
print("=" * 50)
|
||
print(f"还有modified字段的岗位(共{len(set(matches))}个):")
|
||
|
||
unique_positions = set(matches)
|
||
for position in sorted(unique_positions):
|
||
print(f" - {position}")
|
||
|
||
# 期望的岗位列表
|
||
expected = {
|
||
"会展策划师",
|
||
"会展执行助理",
|
||
"会展讲解员",
|
||
"活动策划师",
|
||
"活动执行",
|
||
"漫展策划师",
|
||
"旅游规划师",
|
||
"旅游计调专员",
|
||
"景区运营专员",
|
||
"文旅运营总监助理"
|
||
}
|
||
|
||
# 检查是否匹配
|
||
if unique_positions == expected:
|
||
print("\n✓ 完美!所有岗位的modified字段都处理正确")
|
||
|
||
# 额外检查:确认所有岗位的original字段还在
|
||
original_pattern = r'position:\s*"([^"]+)"[^}]*?original:\s*`'
|
||
original_matches = re.findall(original_pattern, content, re.DOTALL)
|
||
print(f"\n共有 {len(set(original_matches))} 个岗位保留了original字段")
|
||
|
||
return True
|
||
else:
|
||
missing = expected - unique_positions
|
||
extra = unique_positions - expected
|
||
|
||
if missing:
|
||
print(f"\n⚠️ 缺少modified的岗位:{missing}")
|
||
if extra:
|
||
print(f"\n⚠️ 不应该有modified的岗位:{extra}")
|
||
|
||
return False
|
||
|
||
def main():
|
||
print("开始修复:删除没有真实修改版的岗位的modified字段...")
|
||
print("=" * 50)
|
||
|
||
# 删除没有真实修改版的岗位的modified字段
|
||
remove_modified_fields()
|
||
|
||
# 验证结果
|
||
if verify_results():
|
||
print("\n✅ 修复成功!")
|
||
else:
|
||
print("\n❌ 修复可能有问题,请检查")
|
||
|
||
if __name__ == "__main__":
|
||
main() |