- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸 - 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB - 配置完善的.gitignore文件 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
205 lines
10 KiB
Python
205 lines
10 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import json
|
||
import re
|
||
|
||
def escape_for_js(text):
|
||
"""转义字符串用于JavaScript"""
|
||
if not text:
|
||
return ""
|
||
text = text.replace('\\', '\\\\')
|
||
text = text.replace('`', '\\`')
|
||
text = text.replace('${', '\\${')
|
||
return text
|
||
|
||
def load_all_mappings():
|
||
"""加载所有三个部分的映射数据"""
|
||
all_positions = {}
|
||
|
||
for part in [1, 2, 3]:
|
||
file_path = f'/Users/apple/Documents/cursor/教务系统/frontend/scripts/resume_mapping_part{part}.json'
|
||
try:
|
||
with open(file_path, 'r', encoding='utf-8') as f:
|
||
part_data = json.load(f)
|
||
all_positions.update(part_data)
|
||
print(f"加载第 {part} 部分:{len(part_data)} 个岗位")
|
||
except FileNotFoundError:
|
||
print(f"未找到第 {part} 部分的映射文件")
|
||
|
||
return all_positions
|
||
|
||
def create_additional_industries(all_positions):
|
||
"""根据岗位类型创建额外的行业分类"""
|
||
|
||
# 定义岗位分类
|
||
categories = {
|
||
"二次元文化": ["二次元周边选品专员", "二次元周边店店员", "二次元周边店店长"],
|
||
"宠物行业": ["宠物店店长", "宠物营养师"],
|
||
"数字营销": ["SEO专员", "SEM专员", "网络运营专员"],
|
||
"会展活动": ["会展策划师", "会展执行助理", "会展讲解员", "会展营销", "商业会展执行专员", "漫展策划师"],
|
||
"品牌运营": ["品牌策划运营专员", "品牌公关", "品牌推广专员", "品牌公关管培生", "ip运营", "IP运营总监助理"],
|
||
"演艺赛事": ["赛事经纪", "赛事礼仪", "赛事编辑", "艺人经纪人", "演出执行经理", "场馆运营人员"],
|
||
"直播新媒体": ["直播中控", "直播助理", "新媒体运营专员", "社群运营"],
|
||
"旅游规划": ["旅游规划师", "旅游计调专员", "露营地运营专员"],
|
||
"文创设计": ["文创产品设计师", "文创产品策划师", "文创产品设计师助理"],
|
||
"文旅管理": ["文旅运营总监助理", "文旅项目投资拓展管培生"]
|
||
}
|
||
|
||
industries_code = []
|
||
|
||
for category_name, position_names in categories.items():
|
||
# 生成行业ID
|
||
industry_id = category_name.replace("文化", "culture").replace("行业", "industry").replace("营销", "marketing")
|
||
industry_id = industry_id.replace("活动", "event").replace("运营", "operation").replace("赛事", "sports")
|
||
industry_id = industry_id.replace("新媒体", "newmedia").replace("规划", "planning").replace("设计", "design")
|
||
industry_id = industry_id.replace("管理", "management").replace("二次元", "acg").replace("宠物", "pet")
|
||
industry_id = industry_id.replace("数字", "digital").replace("会展", "exhibition").replace("品牌", "brand")
|
||
industry_id = industry_id.replace("演艺", "performance").replace("直播", "live").replace("旅游", "tourism")
|
||
industry_id = industry_id.replace("文创", "cultural").replace("文旅", "culture-tourism")
|
||
|
||
# 开始构建行业对象
|
||
industry_lines = []
|
||
industry_lines.append(f' {{\n')
|
||
industry_lines.append(f' id: "{industry_id}",\n')
|
||
industry_lines.append(f' name: "{category_name}",\n')
|
||
industry_lines.append(f' positions: [\n')
|
||
|
||
# 添加该类别下的所有岗位
|
||
for idx, position_name in enumerate(position_names):
|
||
if position_name in all_positions:
|
||
resume_data = all_positions[position_name]
|
||
|
||
# 根据岗位名称选择合适的公司名称
|
||
company_map = {
|
||
"二次元": "B站文化",
|
||
"宠物": "宠物之家",
|
||
"SEO": "百度营销",
|
||
"SEM": "谷歌广告",
|
||
"会展": "国际会展中心",
|
||
"漫展": "ChinaJoy",
|
||
"品牌": "奥美广告",
|
||
"赛事": "体育赛事中心",
|
||
"艺人": "华谊兄弟",
|
||
"演出": "大麦网",
|
||
"直播": "抖音直播",
|
||
"新媒体": "字节跳动",
|
||
"社群": "小红书",
|
||
"旅游": "携程旅游",
|
||
"露营": "户外探索",
|
||
"文创": "故宫文创",
|
||
"文旅": "文旅集团"
|
||
}
|
||
|
||
# 选择合适的公司名称
|
||
company = "文旅企业"
|
||
for key, value in company_map.items():
|
||
if key in position_name:
|
||
company = value
|
||
break
|
||
|
||
# 根据岗位级别设置薪资
|
||
if "总监" in position_name or "经理" in position_name:
|
||
salary = "15-25K"
|
||
level = "储备干部岗"
|
||
elif "主管" in position_name or "店长" in position_name:
|
||
salary = "12-20K"
|
||
level = "技术骨干岗"
|
||
elif "助理" in position_name or "实习" in position_name:
|
||
salary = "6-10K"
|
||
level = "实习"
|
||
else:
|
||
salary = "8-15K"
|
||
level = "技术骨干岗"
|
||
|
||
industry_lines.append(f' {{\n')
|
||
industry_lines.append(f' id: "{industry_id}-{idx+1}",\n')
|
||
industry_lines.append(f' name: "{position_name}",\n')
|
||
industry_lines.append(f' company: "{company}",\n')
|
||
industry_lines.append(f' level: "{level}",\n')
|
||
industry_lines.append(f' salary: "{salary}",\n')
|
||
industry_lines.append(f' experience: "1-3年",\n')
|
||
industry_lines.append(f' resume: {{\n')
|
||
industry_lines.append(f' personalInfo: {{\n')
|
||
industry_lines.append(f' name: "应聘者{idx+1}",\n')
|
||
industry_lines.append(f' phone: "138****8888",\n')
|
||
industry_lines.append(f' email: "candidate{idx+1}@example.com",\n')
|
||
industry_lines.append(f' location: "苏州市",\n')
|
||
industry_lines.append(f' }},\n')
|
||
industry_lines.append(f' education: {{\n')
|
||
industry_lines.append(f' university: "苏州信息职业技术学院",\n')
|
||
industry_lines.append(f' major: "智慧旅游技术应用",\n')
|
||
industry_lines.append(f' degree: "专科",\n')
|
||
industry_lines.append(f' graduationYear: "2023",\n')
|
||
industry_lines.append(f' period: "2020.9 - 2023.6",\n')
|
||
industry_lines.append(f' }},\n')
|
||
industry_lines.append(f' projectExperience: `{escape_for_js(resume_data["projectExperience"])}`,\n')
|
||
industry_lines.append(f' skills: `{escape_for_js(resume_data["skills"])}`,\n')
|
||
industry_lines.append(f' personalSummary: `{escape_for_js(resume_data["personalSummary"])}`,\n')
|
||
industry_lines.append(f' }},\n')
|
||
industry_lines.append(f' interviews: {{\n')
|
||
industry_lines.append(f' hookQuestions: [\n')
|
||
industry_lines.append(f' "{position_name}的核心职责是什么?",\n')
|
||
industry_lines.append(f' "如何提升服务质量和客户满意度?",\n')
|
||
industry_lines.append(f' "请分享您的相关项目经验",\n')
|
||
industry_lines.append(f' "如何应对工作中的突发情况?",\n')
|
||
industry_lines.append(f' "团队协作中您扮演什么角色?",\n')
|
||
industry_lines.append(f' ],\n')
|
||
industry_lines.append(f' allQuestions: [],\n')
|
||
industry_lines.append(f' }},\n')
|
||
industry_lines.append(f' }},\n')
|
||
|
||
industry_lines.append(f' ],\n')
|
||
industry_lines.append(f' }},\n')
|
||
|
||
industries_code.extend(industry_lines)
|
||
|
||
return industries_code
|
||
|
||
def insert_industries_to_mockdata(industries_code):
|
||
"""将新的行业数据插入到mockData.js中"""
|
||
|
||
# 读取当前的mockData.js文件
|
||
with open('/Users/apple/Documents/cursor/教务系统/frontend/src/data/mockData.js', 'r', encoding='utf-8') as f:
|
||
lines = f.readlines()
|
||
|
||
# 查找industries数组的结束位置
|
||
# 根据之前的分析,industries数组在第2944行结束
|
||
insert_position = None
|
||
for i, line in enumerate(lines):
|
||
if i >= 2940 and i <= 2950 and '],' in line:
|
||
insert_position = i
|
||
break
|
||
|
||
if not insert_position:
|
||
print("未找到合适的插入位置")
|
||
return False
|
||
|
||
print(f"将在第 {insert_position} 行插入新的行业数据")
|
||
|
||
# 插入新数据
|
||
new_lines = lines[:insert_position] + industries_code + lines[insert_position:]
|
||
|
||
# 写回文件
|
||
with open('/Users/apple/Documents/cursor/教务系统/frontend/src/data/mockData.js', 'w', encoding='utf-8') as f:
|
||
f.writelines(new_lines)
|
||
|
||
return True
|
||
|
||
# 主程序
|
||
if __name__ == "__main__":
|
||
print("开始添加所有岗位数据到mockData.js...")
|
||
|
||
# 加载所有映射数据
|
||
all_positions = load_all_mappings()
|
||
print(f"\n总共加载了 {len(all_positions)} 个岗位的数据")
|
||
|
||
# 创建行业分类代码
|
||
industries_code = create_additional_industries(all_positions)
|
||
print(f"\n生成了 {len([line for line in industries_code if 'id:' in line and 'industry' not in line])/2} 个行业的代码")
|
||
|
||
# 插入到mockData.js
|
||
if insert_industries_to_mockdata(industries_code):
|
||
print("\n✓ 成功将所有岗位数据添加到mockData.js!")
|
||
else:
|
||
print("\n✗ 添加失败") |