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

186 lines
5.8 KiB
Python
Raw 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
# 读取视觉设计项目案例数据
with open('网页未导入数据/视觉设计产业/视觉设计项目案例.json', 'r', encoding='utf-8') as f:
visual_design_data = json.load(f)
# 生成项目列表数据
projects_js = []
for idx, item in enumerate(visual_design_data[:30], 1): # 取前30个项目
project = {
'id': idx,
'name': item['案例名称'],
'description': item.get('所属垂直方向', ''),
'positions': [pos.strip() for pos in item.get('对应个人简历名称', '').split(',') if pos.strip()],
'unit': item.get('对应单元名称(复合能力课)', ''),
'direction': item.get('所属垂直方向', ''),
'category': item.get('对应单元名称(垂直能力课)', '')
}
projects_js.append(project)
# 生成项目详情数据选择前10个有内容的项目
project_details = {}
for item in visual_design_data[:10]:
project_id = visual_design_data.index(item) + 1
# 解析项目内容
content = item.get('项目案例内容', '')
sections = []
# 简单解析Markdown内容提取章节
if content:
lines = content.split('\n')
current_section = None
for line in lines:
if line.startswith('# '):
if current_section:
sections.append(current_section)
current_section = {
'title': line[2:].strip(),
'content': ''
}
elif current_section:
current_section['content'] += line + '\n'
if current_section:
sections.append(current_section)
# 处理适用岗位
positions = item.get('对应个人简历名称', '').split(',')
applicable_positions = []
for pos in positions:
pos = pos.strip()
if pos:
# 根据岗位名称判断级别
if '助理' in pos or '专员' in pos:
level = '普通岗'
elif '主管' in pos or '经理' in pos:
level = '管理岗'
else:
level = '技术骨干岗'
applicable_positions.append({
'position': pos,
'level': level
})
# 处理对应单元
corresponding_units = {
'compound': [item.get('对应单元名称(复合能力课)', '')] if item.get('对应单元名称(复合能力课)') else [],
'vertical': [item.get('对应单元名称(垂直能力课)', '')] if item.get('对应单元名称(垂直能力课)') else []
}
# 处理附件
attachments = []
if item.get('附件'):
files = item['附件'].split(',')
for file in files[:5]: # 最多显示5个附件
file = file.strip()
if file:
# 根据文件扩展名确定类型
ext = file.split('.')[-1].lower()
file_type = 'document'
if ext in ['jpg', 'jpeg', 'png', 'gif']:
file_type = 'image'
elif ext in ['mp4', 'avi', 'mov']:
file_type = 'video'
elif ext == 'pdf':
file_type = 'pdf'
elif ext in ['doc', 'docx']:
file_type = 'word'
elif ext in ['psd']:
file_type = 'design'
attachments.append({
'name': file,
'type': file_type,
'size': '2.3MB' # 模拟文件大小
})
project_details[project_id] = {
'title': item['案例名称'],
'category': item.get('所属垂直方向', ''),
'overview': sections[0]['content'][:200] if sections else '暂无项目概述',
'applicablePositions': applicable_positions,
'correspondingUnits': corresponding_units,
'process': sections[1]['content'] if len(sections) > 1 else '暂无流程介绍',
'keyPoints': sections[2]['content'] if len(sections) > 2 else '暂无关键技术点',
'attachments': attachments
}
# 生成JavaScript代码
js_code = '''// 项目库Mock数据
export const getMockProjectsList = (params = {}) => {
const { search = "", page = 1, pageSize = 10 } = params;
// 完整项目列表数据
const projects = '''
# 添加项目列表数组
js_code += json.dumps(projects_js, ensure_ascii=False, indent=2)
js_code += ''';
// 根据搜索条件过滤
let filteredProjects = projects;
if (search) {
filteredProjects = projects.filter(p =>
p.name.toLowerCase().includes(search.toLowerCase()) ||
p.description.toLowerCase().includes(search.toLowerCase())
);
}
// 分页
const startIndex = (page - 1) * pageSize;
const endIndex = startIndex + pageSize;
const paginatedProjects = filteredProjects.slice(startIndex, endIndex);
return {
success: true,
data: paginatedProjects,
total: filteredProjects.length,
page,
pageSize
};
};
// 获取项目详情
export const getMockProjectDetail = (id) => {
// 项目详情数据
const projectDetails = '''
# 添加项目详情对象
js_code += json.dumps(project_details, ensure_ascii=False, indent=2)
js_code += ''';
const detail = projectDetails[id];
if (detail) {
return {
success: true,
data: detail
};
}
// 如果没有找到详情,返回默认数据
return {
success: true,
data: {
title: "项目详情",
category: "视觉设计",
overview: "暂无详细信息",
applicablePositions: [],
correspondingUnits: { compound: [], vertical: [] },
process: "暂无流程介绍",
keyPoints: "暂无关键技术点",
attachments: []
}
};
};
'''
# 写入文件
with open('src/mocks/projectLibraryMock.js', 'w', encoding='utf-8') as f:
f.write(js_code)
print("Mock文件已更新完成")