Files
ALL-teach_sys/frontend_视觉设计/precise_update_questions.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

123 lines
4.1 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
import json
import os
from datetime import datetime
# 读取视觉设计岗位简历.json文件获取UI设计师的完整面试题
json_file = '网页未导入数据/视觉设计产业/视觉设计岗位简历.json'
mock_file = 'src/mocks/resumeInterviewMock.js'
print("正在读取UI设计师的完整面试题数据...")
with open(json_file, 'r', encoding='utf-8') as f:
positions_data = json.load(f)
# 找到UI设计师的面试题
ui_questions = []
for position in positions_data:
if position.get("岗位名称") == "UI设计师":
interview_content = position.get("面试题内容", "")
lines = interview_content.split('\n')
for line in lines:
line = line.strip()
if line and line[0].isdigit() and '. 问题' in line:
parts = line.split('问题:', 1)
if len(parts) > 1:
question_text = parts[1].strip()
ui_questions.append(question_text)
break
print(f"找到 {len(ui_questions)} 个UI设计师面试题")
# 创建备份
backup_file = f"{mock_file}.backup_precise_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
with open(mock_file, 'r', encoding='utf-8') as f:
original_content = f.read()
with open(backup_file, 'w', encoding='utf-8') as f:
f.write(original_content)
print(f"已创建备份:{backup_file}")
# 构建新的questions数组只更新UI设计
new_questions = [
{
"id": "group_q1",
"question": "# 一、专业能力类",
"subQuestions": []
},
{
"id": "group_q2",
"question": "# 二、行为经历类",
"subQuestions": []
},
{
"id": "group_q3",
"question": "# 三、情景应变类",
"subQuestions": []
}
]
# 分配问题到不同分类
for idx, q in enumerate(ui_questions, 1):
if idx <= 5: # 前5个为专业能力类
group_idx = 0
sub_idx = len(new_questions[0]["subQuestions"]) + 1
q_id = f"q1_{sub_idx}"
elif idx <= 10: # 6-10为行为经历类
group_idx = 1
sub_idx = len(new_questions[1]["subQuestions"]) + 1
q_id = f"q2_{sub_idx}"
else: # 11以后为情景应变类
group_idx = 2
sub_idx = len(new_questions[2]["subQuestions"]) + 1
q_id = f"q3_{sub_idx}"
new_questions[group_idx]["subQuestions"].append({
"id": q_id,
"question": q,
"answer": "请根据您的实际经验和项目情况,结合专业知识进行回答。"
})
# 生成格式化的JSON字符串
questions_json = json.dumps(new_questions, ensure_ascii=False, indent=6)
# 替换UI设计产业的questions
# 找到UI设计的questions位置
ui_start = original_content.find('"name": "UI设计"')
if ui_start > 0:
# 找到questions字段
q_start = original_content.find('"questions":', ui_start)
if q_start > 0 and q_start < ui_start + 1000:
# 找到数组开始
arr_start = original_content.find('[', q_start)
# 找到对应的结束]
bracket_count = 1
idx = arr_start + 1
while idx < len(original_content) and bracket_count > 0:
if original_content[idx] == '[':
bracket_count += 1
elif original_content[idx] == ']':
bracket_count -= 1
idx += 1
# 替换内容
new_content = original_content[:arr_start] + questions_json + original_content[idx-1:]
# 写入文件
with open(mock_file, 'w', encoding='utf-8') as f:
f.write(new_content)
print("已更新UI设计产业的面试题")
# 验证语法
result = os.popen(f'node -c {mock_file} 2>&1').read()
if result:
print(f"❌ 语法错误:{result}")
# 恢复备份
with open(backup_file, 'r', encoding='utf-8') as f:
content = f.read()
with open(mock_file, 'w', encoding='utf-8') as f:
f.write(content)
print("已恢复备份")
else:
print("✓ 语法验证通过")
print("\nUI设计产业的面试题已成功更新为完整数据")