主要功能: - 修改RequirementModal支持12个订单班选择 - 添加OrderClassIconMap图标映射组件 - Store中添加selectedOrderClass状态管理 - WorkflowPage支持传递orderClass参数 - web_result添加URL参数切换功能 - 创建order-class-handler.js动态处理页面主题 技术改进: - 创建软链接关联订单班数据目录 - 生成wenlu.json和food.json数据结构 - 删除重复的web_result目录 - 添加测试页面test-order-class.html 影响范围: - 展会策划系统现支持12个订单班 - 结果展示页面自动适配不同订单班主题 - 用户可选择不同行业生成对应方案 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
99 lines
3.3 KiB
Python
99 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
最终修复所有订单班Markdown文件中的URL编码图片路径
|
|
"""
|
|
|
|
import re
|
|
from pathlib import Path
|
|
from urllib.parse import unquote
|
|
|
|
def fix_order_class(order_class: str, notion_dir: Path):
|
|
"""修复单个订单班的所有路径问题"""
|
|
image_dir = notion_dir / "image"
|
|
if not image_dir.exists():
|
|
return
|
|
|
|
# 获取所有实际的图片文件
|
|
actual_images = {img.name for img in image_dir.glob("*.jpg")}
|
|
|
|
# 处理所有MD文件
|
|
for md_file in notion_dir.glob("*.md"):
|
|
if md_file.name == "图片索引.md":
|
|
continue
|
|
|
|
try:
|
|
content = md_file.read_text(encoding='utf-8')
|
|
original_content = content
|
|
|
|
# 查找所有图片引用
|
|
pattern = r'!\[([^\]]*)\]\(([^\)]+)\)'
|
|
|
|
def replace_path(match):
|
|
"""替换函数"""
|
|
alt_text = match.group(1)
|
|
path = match.group(2)
|
|
|
|
# 解码URL编码
|
|
decoded_path = unquote(path)
|
|
|
|
# 提取文件名
|
|
if '/' in decoded_path:
|
|
filename = decoded_path.split('/')[-1]
|
|
else:
|
|
filename = decoded_path
|
|
|
|
# 检查是否是图片文件
|
|
if not any(filename.lower().endswith(ext) for ext in ['.jpg', '.jpeg', '.png', '.gif', '.bmp']):
|
|
return match.group(0)
|
|
|
|
# 尝试匹配实际的图片文件
|
|
for actual_img in actual_images:
|
|
# 直接匹配
|
|
if actual_img == filename:
|
|
return f''
|
|
# 忽略扩展名匹配
|
|
if actual_img.rsplit('.', 1)[0] == filename.rsplit('.', 1)[0]:
|
|
return f''
|
|
|
|
# 如果没找到匹配,返回原始内容
|
|
return match.group(0)
|
|
|
|
# 应用替换
|
|
content = re.sub(pattern, replace_path, content)
|
|
|
|
# 保存修改
|
|
if content != original_content:
|
|
md_file.write_text(content, encoding='utf-8')
|
|
print(f" ✓ 修复: {md_file.name}")
|
|
|
|
except Exception as e:
|
|
print(f" ✗ 失败 {md_file.name}: {e}")
|
|
|
|
def main():
|
|
"""主函数"""
|
|
base_path = Path("/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/data/订单班文档资料")
|
|
|
|
# 需要修复的订单班
|
|
order_classes_to_fix = ["财经商贸", "环保", "交通物流", "视觉设计", "智能开发"]
|
|
|
|
print("=" * 60)
|
|
print("最终修复URL编码路径")
|
|
print("=" * 60)
|
|
|
|
for order_class in order_classes_to_fix:
|
|
order_dir = base_path / order_class
|
|
if not order_dir.exists():
|
|
continue
|
|
|
|
notion_dir = order_dir / "notion文稿"
|
|
if not notion_dir.exists():
|
|
continue
|
|
|
|
print(f"\n处理 {order_class}...")
|
|
fix_order_class(order_class, notion_dir)
|
|
|
|
print("\n" + "=" * 60)
|
|
print("✅ 最终修复完成!")
|
|
|
|
if __name__ == "__main__":
|
|
main() |