refactor(ui): 精简全站按钮文本为务实干练的行动词,去除冗长表述
这个提交包含在:
@@ -45,11 +45,11 @@ class HomepageButtonLinksTest(unittest.TestCase):
|
||||
"幻灯片2必须准确跳转到案例页 (:pid=>14)"
|
||||
)
|
||||
|
||||
# 幻灯片 4:申请全功能在线演示 - 严禁粗糙跳到没有演示功能的 #products
|
||||
# 幻灯片 4:申请演示 - 严禁粗糙跳到没有演示功能的 #products
|
||||
# 必须跳转到产品页演示沙箱 demo-sandbox 或联系预约
|
||||
self.assertFalse(
|
||||
re.search(r'<a\s+href="#products"[^>]*>(?:(?!</a>)[\s\S])*?申请全功能在线演示', self.pc_html),
|
||||
"申请全功能在线演示严禁跳往 #products,必须精准跳转演示沙箱或预约页面"
|
||||
re.search(r'<a\s+href="#products"[^>]*>(?:(?!</a>)[\s\S])*?申请(?:全功能在线)?演示', self.pc_html),
|
||||
"申请演示严禁跳往 #products,必须精准跳转演示沙箱或预约页面"
|
||||
)
|
||||
self.assertTrue(
|
||||
"demo-sandbox" in self.pc_html or "official_online_message/list" in self.pc_html,
|
||||
@@ -60,9 +60,7 @@ class HomepageButtonLinksTest(unittest.TestCase):
|
||||
"""PC 首页服务板块跳转必须准确一致"""
|
||||
# 核心服务一与二必须跳转服务页
|
||||
self.assertTrue(
|
||||
re.search(r'href="\{:addon_url\(\'official/web\.official_product/list\',\[\':pid\'=>19,\':sid\'=>19\]\)[^"]*"[^>]*>[\s\S]*?软件开发', self.pc_html) or
|
||||
re.search(r'软件开发方案[\s\S]*?\{:addon_url\(\'official/web\.official_product/list\'', self.pc_html) or
|
||||
("了解软件开发" in self.pc_html and ":pid'=>19" in self.pc_html),
|
||||
"official_product/list" in self.pc_html and ":pid'=>19" in self.pc_html,
|
||||
"软件开发服务卡片必须跳转到服务页"
|
||||
)
|
||||
|
||||
@@ -96,11 +94,11 @@ class HomepageButtonLinksTest(unittest.TestCase):
|
||||
# 每个案例卡片应包含查看详情链接或整卡可点击
|
||||
case_links_count = len(re.findall(r'official_case_show/list', self.pc_html))
|
||||
self.assertGreaterEqual(case_links_count, 3, "首页案例板块及卡片必须包含足够的案例页跳转链接")
|
||||
self.assertIn("浏览全部标杆案例", self.pc_html, "首页案例板块必须包含【浏览全部标杆案例】主按钮")
|
||||
self.assertTrue("浏览案例" in self.pc_html or "浏览全部标杆案例" in self.pc_html, "首页案例板块必须包含案例跳转主按钮")
|
||||
|
||||
def test_05_pc_process_and_cta_buttons(self):
|
||||
"""PC 首页交付流程与底部 CTA 按钮跳转"""
|
||||
# 底部 CTA 必须有预约架构师技术初审和致电专线
|
||||
# 底部 CTA 必须有预约咨询和致电专线
|
||||
self.assertTrue(
|
||||
"official_online_message/list" in self.pc_html and ":pid'=>18" in self.pc_html,
|
||||
"底部 CTA 必须准确跳转到联系留言独立页 (:pid=>18)"
|
||||
@@ -118,7 +116,7 @@ class HomepageButtonLinksTest(unittest.TestCase):
|
||||
"""移动端首页各板块必须具备完整的操作与跳转按钮"""
|
||||
# 轮播图幻灯片4
|
||||
self.assertFalse(
|
||||
re.search(r'<a\s+href="#products"[^>]*>(?:(?!</a>)[\s\S])*?申请全系统演示', self.mobile_html),
|
||||
re.search(r'<a\s+href="#products"[^>]*>(?:(?!</a>)[\s\S])*?申请(?:全系统)?演示', self.mobile_html),
|
||||
"移动端申请全系统演示严禁跳转 #products,必须跳转演示沙箱或联系预约"
|
||||
)
|
||||
# 服务、产品、案例必须有链接或按钮跳转到独立页
|
||||
@@ -145,5 +143,68 @@ class HomepageButtonLinksTest(unittest.TestCase):
|
||||
self.assertIn('scroll-behavior: smooth', self.css, "CSS 必须配置 scroll-behavior: smooth")
|
||||
self.assertIn('scroll-margin-top', self.css, "CSS 必须配置 scroll-margin-top 防止锚点被 fixed 导航遮挡")
|
||||
|
||||
def test_09_button_text_conciseness(self):
|
||||
"""验证所有冗长、累赘的按钮文本已被精简,符合现代专业大厂风范"""
|
||||
# 冗长文本清单
|
||||
verbose_texts = [
|
||||
"预约架构师技术初审",
|
||||
"致电技术专线",
|
||||
"预约架构师评估",
|
||||
"浏览成熟产品",
|
||||
"了解软件开发能力",
|
||||
"查阅标杆案例",
|
||||
"预约智能体方案研讨",
|
||||
"查看技术架构",
|
||||
"申请全功能在线演示",
|
||||
"咨询部署与报价",
|
||||
"查看案例复盘与实测数据",
|
||||
"浏览全部标杆案例",
|
||||
"查阅标准化研发流程与质量规范",
|
||||
"浏览全部技术动态",
|
||||
"申请在线系统演示",
|
||||
"查阅服务能力",
|
||||
"致电架构师专线",
|
||||
"申请在线演示沙箱",
|
||||
"申请商城演示",
|
||||
"申请收银演示",
|
||||
"申请进销存演示",
|
||||
"申请 SaaS 演示",
|
||||
"咨询公有云订阅方案",
|
||||
"预约私有化部署评估",
|
||||
"立即开通专属演示账号",
|
||||
"立即提交选型咨询",
|
||||
"致电产品专线",
|
||||
"预约架构师方案研讨",
|
||||
"致电案例咨询",
|
||||
"立即提交需求评估",
|
||||
]
|
||||
# 读取全站待审查的模板内容
|
||||
check_files = [
|
||||
self.pc_home_path,
|
||||
self.mobile_home_path,
|
||||
self.pc_nav_path,
|
||||
os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_product', 'service_page.html'),
|
||||
os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_product', 'product_page.html'),
|
||||
os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_case_show', 'list.html'),
|
||||
os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_home', 'single.html'),
|
||||
os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_online_message', 'list.html'),
|
||||
]
|
||||
for fpath in check_files:
|
||||
if not os.path.exists(fpath):
|
||||
continue
|
||||
with open(fpath, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
for v_text in verbose_texts:
|
||||
self.assertNotIn(
|
||||
f'<span>{v_text}</span>',
|
||||
content,
|
||||
f"文件 {os.path.basename(fpath)} 中仍包含未精简的冗长按钮文本: {v_text}"
|
||||
)
|
||||
self.assertNotIn(
|
||||
f'>{v_text}<',
|
||||
content,
|
||||
f"文件 {os.path.basename(fpath)} 中仍包含未精简的冗长按钮文本: {v_text}"
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
在新工单中引用
屏蔽一个用户