Files
ALL-teach_sys/frontend_环保/update_modified_resumes.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

110 lines
3.3 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 -*-
import re
import os
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 clean_markdown_content(content):
"""清理markdown内容"""
# 删除删除线内容(两种格式)
content = re.sub(r'~~[^~]+~~', '', content)
content = re.sub(r'[^]+', '', content)
# 移除加粗格式
content = re.sub(r'\*\*([^*]+)\*\*', r'\1', content)
content = re.sub(r'__([^_]+)__', r'\1', content)
# 清理多余的空行
content = re.sub(r'\n{3,}', '\n\n', content)
content = re.sub(r' {2,}', ' ', content)
# 移除行首尾空格
lines = content.split('\n')
lines = [line.strip() for line in lines]
content = '\n'.join(lines)
return content.strip()
def update_modified_resumes():
"""更新10个岗位的修改版简历内容"""
# 岗位列表
positions = [
"会展策划师",
"会展执行助理",
"会展讲解员",
"活动策划师",
"活动执行",
"漫展策划师",
"旅游规划师",
"旅游计调专员",
"景区运营专员",
"文旅运营总监助理"
]
# 修改版简历文件夹路径
resume_folder = "/Users/apple/Documents/cursor/教务系统/frontend/网页未导入数据/文旅产业/修改后简历"
# 目标文件路径
target_file = "src/mocks/resumeInterviewMock.js"
# 创建备份
create_backup(target_file)
# 读取目标文件
with open(target_file, 'r', encoding='utf-8') as f:
content = f.read()
# 处理每个岗位
for position in positions:
# 读取修改版简历内容
resume_file = os.path.join(resume_folder, f"{position}.md")
if not os.path.exists(resume_file):
print(f"⚠️ 文件不存在: {resume_file}")
continue
with open(resume_file, 'r', encoding='utf-8') as f:
modified_content = f.read()
# 清理内容
modified_content = clean_markdown_content(modified_content)
# 转义反引号
modified_content = modified_content.replace('`', '\\`')
# 查找并更新对应位置
# 使用更精确的正则表达式匹配
pattern = rf'(position:\s*"{re.escape(position)}"[^{{]*content:\s*{{[^}}]*modified:\s*`)([^`]*?)(`)'
def replace_func(match):
return match.group(1) + modified_content + match.group(3)
# 执行替换
new_content, count = re.subn(pattern, replace_func, content, flags=re.DOTALL)
if count > 0:
content = new_content
print(f"✓ 已更新 {position}")
else:
print(f"✗ 未找到 {position} 的modified字段")
# 保存更新后的文件
with open(target_file, 'w', encoding='utf-8') as f:
f.write(content)
print("\n更新完成!")
if __name__ == "__main__":
update_modified_resumes()