文件
nahaichuan/tests/generate_badges.py

118 行
7.2 KiB
Python

# -*- coding: utf-8 -*-
"""
生成团队专家专属专业徽章与法定资质证书矢量图
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TARGET_DIR = os.path.join(BASE_DIR, 'public', 'assets', 'addons', 'official', 'images', 'showcases')
os.makedirs(TARGET_DIR, exist_ok=True)
# 1. 首席系统架构师徽章
team_architect_svg = '''<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="120" height="120" rx="60" fill="#EFF6FF"/>
<circle cx="60" cy="60" r="54" stroke="#BFDBFE" stroke-width="2"/>
<circle cx="60" cy="60" r="48" stroke="#E2E8F0" stroke-width="1" stroke-dasharray="3,3"/>
<!-- 架构中枢微服务拓扑图标 -->
<path d="M60 28 L84 42 L84 70 L60 84 L36 70 L36 42 Z" fill="#FFFFFF" stroke="#2563EB" stroke-width="2.5"/>
<circle cx="60" cy="56" r="8" fill="#2563EB"/>
<line x1="60" y1="28" x2="60" y2="48" stroke="#2563EB" stroke-width="2"/>
<line x1="36" y1="70" x2="52" y2="60" stroke="#2563EB" stroke-width="2"/>
<line x1="84" y1="70" x2="68" y2="60" stroke="#2563EB" stroke-width="2"/>
<!-- 中式印章小徽 -->
<rect x="42" y="90" width="36" height="16" rx="2" fill="#FEF2F2" stroke="#EF4444" stroke-width="1"/>
<text x="47" y="102" fill="#DC2626" font-family="'Noto Serif SC', 'SimSun', serif" font-size="9" font-weight="700">架构</text>
</svg>'''
# 2. 全栈研发总监徽章
team_fullstack_svg = '''<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="120" height="120" rx="60" fill="#ECFEFF"/>
<circle cx="60" cy="60" r="54" stroke="#A5F3FC" stroke-width="2"/>
<circle cx="60" cy="60" r="48" stroke="#E2E8F0" stroke-width="1" stroke-dasharray="3,3"/>
<!-- 移动与多端代码图标 -->
<rect x="36" y="32" width="48" height="42" rx="4" fill="#FFFFFF" stroke="#0891B2" stroke-width="2.5"/>
<path d="M48 46 L42 53 L48 60" stroke="#0891B2" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M72 46 L78 53 L72 60" stroke="#0891B2" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
<line x1="57" y1="62" x2="63" y2="44" stroke="#0891B2" stroke-width="2" stroke-linecap="round"/>
<!-- 手机端小角标 -->
<rect x="66" y="60" width="18" height="26" rx="3" fill="#FFFFFF" stroke="#2563EB" stroke-width="1.5"/>
<circle cx="75" cy="82" r="1.5" fill="#2563EB"/>
<!-- 中式印章小徽 -->
<rect x="42" y="90" width="36" height="16" rx="2" fill="#FEF2F2" stroke="#EF4444" stroke-width="1"/>
<text x="47" y="102" fill="#DC2626" font-family="'Noto Serif SC', 'SimSun', serif" font-size="9" font-weight="700">全栈</text>
</svg>'''
# 3. AI 智能体专家徽章
team_ai_svg = '''<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="120" height="120" rx="60" fill="#FAF5FF"/>
<circle cx="60" cy="60" r="54" stroke="#E9D5FF" stroke-width="2"/>
<circle cx="60" cy="60" r="48" stroke="#E2E8F0" stroke-width="1" stroke-dasharray="3,3"/>
<!-- 神经网络与智能 Agent 交互节点 -->
<circle cx="60" cy="40" r="6" fill="#7C3AED"/>
<circle cx="40" cy="65" r="5" fill="#7C3AED"/>
<circle cx="80" cy="65" r="5" fill="#7C3AED"/>
<circle cx="60" cy="72" r="7" fill="#FFFFFF" stroke="#7C3AED" stroke-width="2.5"/>
<line x1="60" y1="46" x2="43" y2="61" stroke="#A855F7" stroke-width="2"/>
<line x1="60" y1="46" x2="77" y2="61" stroke="#A855F7" stroke-width="2"/>
<line x1="45" y1="66" x2="54" y2="70" stroke="#A855F7" stroke-width="2"/>
<line x1="75" y1="66" x2="66" y2="70" stroke="#A855F7" stroke-width="2"/>
<!-- 中式印章小徽 -->
<rect x="42" y="90" width="36" height="16" rx="2" fill="#FEF2F2" stroke="#EF4444" stroke-width="1"/>
<text x="47" y="102" fill="#DC2626" font-family="'Noto Serif SC', 'SimSun', serif" font-size="9" font-weight="700">算法</text>
</svg>'''
# 4. 安全合规与质控专家徽章
team_security_svg = '''<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="120" height="120" rx="60" fill="#ECFDF5"/>
<circle cx="60" cy="60" r="54" stroke="#A7F3D0" stroke-width="2"/>
<circle cx="60" cy="60" r="48" stroke="#E2E8F0" stroke-width="1" stroke-dasharray="3,3"/>
<!-- 安全盾牌与质控勾选 -->
<path d="M60 30 C72 30 84 34 84 34 L84 62 C84 76 60 86 60 86 C60 86 36 76 36 62 L36 34 C36 34 48 30 60 30 Z" fill="#FFFFFF" stroke="#059669" stroke-width="2.5"/>
<path d="M50 58 L57 65 L70 50" stroke="#059669" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
<!-- 中式印章小徽 -->
<rect x="42" y="90" width="36" height="16" rx="2" fill="#FEF2F2" stroke="#EF4444" stroke-width="1"/>
<text x="47" y="102" fill="#DC2626" font-family="'Noto Serif SC', 'SimSun', serif" font-size="9" font-weight="700">安全</text>
</svg>'''
# 5. 国家高新技术企业权威证书徽标
cert_hi_tech_svg = '''<svg width="160" height="100" viewBox="0 0 160 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="160" height="100" rx="4" fill="#FFFFFF" stroke="#E2E8F0" stroke-width="1"/>
<!-- 细金边与内框 -->
<rect x="4" y="4" width="152" height="92" rx="2" fill="#FFFBEB" stroke="#FDE68A" stroke-width="1"/>
<!-- 权威太阳齿轮徽章 -->
<circle cx="80" cy="38" r="18" fill="#F59E0B" opacity="0.15"/>
<circle cx="80" cy="38" r="14" stroke="#D97706" stroke-width="1.5"/>
<path d="M80 27 L83 34 L90 35 L85 40 L86 47 L80 44 L74 47 L75 40 L70 35 L77 34 Z" fill="#D97706"/>
<text x="80" y="68" fill="#92400E" font-family="'Noto Serif SC', 'SimSun', serif" font-size="11" font-weight="700" text-anchor="middle">国家高新技术企业</text>
<text x="80" y="82" fill="#B45309" font-family="'Inter', sans-serif" font-size="8" text-anchor="middle">HIGH-TECH ENTERPRISE</text>
</svg>'''
# 6. ISO9001 质量认证权威徽标
cert_iso9001_svg = '''<svg width="160" height="100" viewBox="0 0 160 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="160" height="100" rx="4" fill="#FFFFFF" stroke="#E2E8F0" stroke-width="1"/>
<rect x="4" y="4" width="152" height="92" rx="2" fill="#EFF6FF" stroke="#BFDBFE" stroke-width="1"/>
<!-- ISO 认证徽记 -->
<circle cx="80" cy="38" r="18" fill="#2563EB" opacity="0.1"/>
<circle cx="80" cy="38" r="14" stroke="#2563EB" stroke-width="1.5"/>
<text x="80" y="42" fill="#1D4ED8" font-family="'Inter', sans-serif" font-size="10" font-weight="800" text-anchor="middle">ISO</text>
<text x="80" y="68" fill="#1E40AF" font-family="'Noto Serif SC', 'SimSun', serif" font-size="11" font-weight="700" text-anchor="middle">ISO 9001 认证</text>
<text x="80" y="82" fill="#3B82F6" font-family="'Inter', sans-serif" font-size="8" text-anchor="middle">QUALITY MANAGEMENT</text>
</svg>'''
badges = {
'team_architect.svg': team_architect_svg,
'team_fullstack.svg': team_fullstack_svg,
'team_ai.svg': team_ai_svg,
'team_security.svg': team_security_svg,
'cert_hi_tech.svg': cert_hi_tech_svg,
'cert_iso9001.svg': cert_iso9001_svg
}
for name, content in badges.items():
p = os.path.join(TARGET_DIR, name)
with open(p, 'w', encoding='utf-8') as f:
f.write(content.strip())
print(f"Generated badge: {name}")
print("All badges generated successfully!")