feat: 为全站核心板块丰富高保真系统视窗配图与专业徽章 (服务/产品/案例/关于我们)
这个提交包含在:
117
tests/generate_badges.py
普通文件
117
tests/generate_badges.py
普通文件
@@ -0,0 +1,117 @@
|
||||
# -*- 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!")
|
||||
1199
tests/generate_showcases.py
普通文件
1199
tests/generate_showcases.py
普通文件
文件差异内容过多而无法显示
加载差异
144
tests/test_site_images.py
普通文件
144
tests/test_site_images.py
普通文件
@@ -0,0 +1,144 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
站点配图与视觉丰富度自动化测试 (TDD)
|
||||
验证:
|
||||
1. 所有核心配图资产物理存在、非空且格式正确
|
||||
2. PC 首页与移动端首页正确展示服务、产品、案例等丰富配图
|
||||
3. 独立服务页、产品页、案例页包含深度高保真系统与业务界面配图
|
||||
4. 关于我们页面包含专家徽章与资质认证图
|
||||
5. CSS 针对配图有严格的响应式(max-width: 100%、圆角、细线边框、悬停微光)控制
|
||||
6. 无破损路径或 404 资源引用
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import unittest
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
class SiteImagesTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.img_dir = os.path.join(BASE_DIR, 'public', 'assets', 'addons', 'official', 'images', 'showcases')
|
||||
self.pc_home_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_home', 'index.html')
|
||||
self.mobile_home_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_home', 'index_e.html')
|
||||
self.service_page_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_product', 'service_page.html')
|
||||
self.product_page_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_product', 'product_page.html')
|
||||
self.case_page_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_case_show', 'list.html')
|
||||
self.case_mobile_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_case_show', 'list_e.html')
|
||||
self.about_page_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_home', 'single.html')
|
||||
self.about_mobile_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_home', 'single_e.html')
|
||||
self.css_path = os.path.join(BASE_DIR, 'public', 'assets', 'addons', 'official', 'css', 'modern_nhc.css')
|
||||
|
||||
def test_01_image_assets_exist_and_non_empty(self):
|
||||
"""核心配图资源必须物理存在且内容非空"""
|
||||
required_images = [
|
||||
# 服务类配图
|
||||
'service_middle.svg',
|
||||
'service_app.svg',
|
||||
'service_agent.svg',
|
||||
# 产品类配图
|
||||
'product_mall.svg',
|
||||
'product_pos.svg',
|
||||
'product_erp.svg',
|
||||
'product_saas.svg',
|
||||
# 案例类配图
|
||||
'case_distrib.svg',
|
||||
'case_catering.svg',
|
||||
'case_gov_agent.svg',
|
||||
'case_manufacture.svg',
|
||||
# 专家与资质徽标
|
||||
'team_architect.svg',
|
||||
'team_fullstack.svg',
|
||||
'team_ai.svg',
|
||||
'team_security.svg',
|
||||
'cert_hi_tech.svg',
|
||||
'cert_iso9001.svg'
|
||||
]
|
||||
self.assertTrue(os.path.isdir(self.img_dir), f"图片目录 {self.img_dir} 必须存在")
|
||||
for img_name in required_images:
|
||||
img_path = os.path.join(self.img_dir, img_name)
|
||||
self.assertTrue(os.path.isfile(img_path), f"图片文件 {img_name} 必须存在于 showcases 目录下")
|
||||
size = os.path.getsize(img_path)
|
||||
self.assertGreater(size, 100, f"图片文件 {img_name} 大小不能过小")
|
||||
|
||||
def test_02_pc_and_mobile_homepage_service_images(self):
|
||||
"""首页服务卡片必须包含对应的服务系统配图"""
|
||||
with open(self.pc_home_path, 'r', encoding='utf-8') as f:
|
||||
pc_content = f.read()
|
||||
with open(self.mobile_home_path, 'r', encoding='utf-8') as f:
|
||||
mobile_content = f.read()
|
||||
|
||||
for content, page_name in [(pc_content, "PC 首页"), (mobile_content, "移动端首页")]:
|
||||
self.assertIn('service_middle.svg', content, f"{page_name} 应包含软件中台服务配图")
|
||||
self.assertIn('service_app.svg', content, f"{page_name} 应包含APP小程序定制服务配图")
|
||||
self.assertIn('service_agent.svg', content, f"{page_name} 应包含智能体定制服务配图")
|
||||
|
||||
def test_03_pc_and_mobile_homepage_product_images(self):
|
||||
"""首页产品卡片必须包含产品界面示意配图"""
|
||||
with open(self.pc_home_path, 'r', encoding='utf-8') as f:
|
||||
pc_content = f.read()
|
||||
with open(self.mobile_home_path, 'r', encoding='utf-8') as f:
|
||||
mobile_content = f.read()
|
||||
|
||||
for content, page_name in [(pc_content, "PC 首页"), (mobile_content, "移动端首页")]:
|
||||
self.assertIn('product_mall.svg', content, f"{page_name} 应包含商城产品配图")
|
||||
self.assertIn('product_pos.svg', content, f"{page_name} 应包含收银产品配图")
|
||||
self.assertIn('product_erp.svg', content, f"{page_name} 应包含进销存产品配图")
|
||||
self.assertIn('product_saas.svg', content, f"{page_name} 应包含SaaS产品配图")
|
||||
|
||||
def test_04_cases_pages_have_preview_images(self):
|
||||
"""标杆案例卡片必须配有真实的业务系统视窗图"""
|
||||
with open(self.case_page_path, 'r', encoding='utf-8') as f:
|
||||
case_pc = f.read()
|
||||
with open(self.case_mobile_path, 'r', encoding='utf-8') as f:
|
||||
case_mobile = f.read()
|
||||
|
||||
for content, page_name in [(case_pc, "PC 案例独立页"), (case_mobile, "移动端案例独立页")]:
|
||||
self.assertIn('case_distrib.svg', content, f"{page_name} 应包含分销订货中台界面图")
|
||||
self.assertIn('case_catering.svg', content, f"{page_name} 应包含连锁餐饮收银界面图")
|
||||
self.assertIn('case_gov_agent.svg', content, f"{page_name} 应包含政务智能体界面图")
|
||||
self.assertIn('case_manufacture.svg', content, f"{page_name} 应包含工业制造进销存界面图")
|
||||
|
||||
def test_05_service_and_product_pages_have_showcases(self):
|
||||
"""独立服务页与产品页必须嵌入高质量系统拓扑与界面大图"""
|
||||
with open(self.service_page_path, 'r', encoding='utf-8') as f:
|
||||
service_content = f.read()
|
||||
with open(self.product_page_path, 'r', encoding='utf-8') as f:
|
||||
product_content = f.read()
|
||||
|
||||
self.assertIn('service_middle.svg', service_content)
|
||||
self.assertIn('service_app.svg', service_content)
|
||||
self.assertIn('service_agent.svg', service_content)
|
||||
|
||||
self.assertIn('product_mall.svg', product_content)
|
||||
self.assertIn('product_pos.svg', product_content)
|
||||
self.assertIn('product_erp.svg', product_content)
|
||||
self.assertIn('product_saas.svg', product_content)
|
||||
|
||||
def test_06_about_pages_have_expert_and_cert_badges(self):
|
||||
"""关于我们页必须包含专家团队专业徽标与资质认证图"""
|
||||
with open(self.about_page_path, 'r', encoding='utf-8') as f:
|
||||
about_pc = f.read()
|
||||
with open(self.about_mobile_path, 'r', encoding='utf-8') as f:
|
||||
about_mobile = f.read()
|
||||
|
||||
for content, page_name in [(about_pc, "PC 关于我们页"), (about_mobile, "移动端关于我们页")]:
|
||||
self.assertIn('team_architect.svg', content, f"{page_name} 应包含首席架构师徽章")
|
||||
self.assertIn('team_fullstack.svg', content, f"{page_name} 应包含全栈研发总监徽章")
|
||||
self.assertIn('team_ai.svg', content, f"{page_name} 应包含AI智能体专家徽章")
|
||||
self.assertIn('team_security.svg', content, f"{page_name} 应包含质量安全合规专家徽章")
|
||||
self.assertIn('cert_hi_tech.svg', content, f"{page_name} 应包含高新技术企业认证图")
|
||||
self.assertIn('cert_iso9001.svg', content, f"{page_name} 应包含ISO9001认证图")
|
||||
|
||||
def test_07_responsive_image_styles_in_css(self):
|
||||
"""CSS 必须具备严谨的配图自适应与质感样式定义"""
|
||||
with open(self.css_path, 'r', encoding='utf-8') as f:
|
||||
css = f.read()
|
||||
|
||||
self.assertIn('.nhc-card-thumb', css, "CSS 应定义 .nhc-card-thumb 图片容器类")
|
||||
self.assertIn('object-fit', css, "CSS 应规范图片的适应展示模式")
|
||||
self.assertIn('.nhc-case-img-wrap', css, "CSS 应定义案例图视窗包装器")
|
||||
self.assertIn('.nhc-service-media-box', css, "CSS 应定义服务媒体容器")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
在新工单中引用
屏蔽一个用户