Files
ALL-teach_sys/frontend_能源/fix_missing_images.py
KQL 38350dca36 更新12个教务系统并优化项目大小
主要更新:
- 更新所有12个产业的教务系统数据和功能
- 删除所有 node_modules 文件夹(节省3.7GB)
- 删除所有 .yoyo 缓存文件夹(节省1.2GB)
- 删除所有 dist 构建文件(节省55MB)

项目优化:
- 项目大小从 8.1GB 减少到 3.2GB(节省60%空间)
- 保留完整的源代码和配置文件
- .gitignore 已配置,防止再次提交大文件

启动脚本:
- start-industry.sh/bat/ps1 脚本会自动检测并安装依赖
- 首次启动时自动运行 npm install
- 支持单个或批量启动产业系统

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 14:36:25 +08:00

49 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""
修复CSS文件中缺失的图片引用
"""
import os
import re
from pathlib import Path
def check_and_fix_css_files():
"""检查并修复CSS文件中的图片引用"""
src_dir = Path('src')
fixed_count = 0
# 遍历所有CSS文件
for css_file in src_dir.rglob('*.css'):
try:
content = css_file.read_text(encoding='utf-8')
original_content = content
# 查找所有图片引用
pattern = r'background-image:\s*url\("@/assets/images/([^"]+)"\);'
matches = re.finditer(pattern, content)
for match in matches:
image_path = match.group(1)
full_path = src_dir / 'assets' / 'images' / image_path
# 如果图片不存在,注释掉这行
if not full_path.exists():
old_line = match.group(0)
new_line = f'/* {old_line} */'
content = content.replace(old_line, new_line)
print(f"已注释: {css_file} -> {image_path}")
fixed_count += 1
# 如果内容有变化,写回文件
if content != original_content:
css_file.write_text(content, encoding='utf-8')
except Exception as e:
print(f"处理 {css_file} 时出错: {e}")
return fixed_count
if __name__ == '__main__':
print("开始检查并修复CSS文件中的图片引用...")
count = check_and_fix_css_files()
print(f"\n完成!共修复 {count} 处缺失的图片引用")