# -*- coding: utf-8 -*- import re with open('/data/workspace/index.html', 'r', encoding='utf-8') as f: html = f.read() required_products = [ '菠萝格原木','菠萝格地板','非洲菠萝格','菠萝格栈道', '菠萝格花架','菠萝格实木','菠萝格栏杆','菠萝格木材', ] product_imgs = [ 'Image26090315563649725c.jpg','Image2609031556347316a6.jpg', 'Image260903155636622e23.jpg','Image2609031556353096d1.jpg', 'Image260903155634841f97.jpg','Image2609031556351843ad.jpg', 'Image260903155634794284.jpg','Image260903155634778b2f.jpg', ] banner = 'Image260912145751541729.jpg' about = 'Image260912141652677735.png' cities = [ ('湖北宜昌非洲菠萝格','https://xfrzp.szbla.com'), ('贵州毕节防腐木木屋别墅','https://cntph.9c3c.com'), ('新疆巴音郭楞俄罗斯防腐木','https://gfkbc.9c3c.com'), ('浙江湖州柳桉木木方','https://qofjt.aixixin.com'), ('湖北鄂州菠萝格加工','https://pjdrq.bfcmgg.com'), ('山东淄博防腐木木屋别墅','https://rgtin.jntfw.com'), ('江西九江柳桉木古建用材','https://ddwno.wggjl.com'), ('香港新界柳桉木原木','https://xoouv.773588.com'), ('安徽安庆芬兰防腐木','https://sghsx.bfcmgg.com'), ('内蒙古包头防腐木围栏','https://fnvyf.bfcmgg.com'), ] sections = ['首页Banner','产品展示','关于我们','应用场景','合作案例','售后服务','常见问题FAQ','城市分站入口','友情链接'] banned = ['最','第一','顶级','全网最优','最好','国家级','世界级','唯一','极致','绝无仅有'] print('=== 图片链接检查 ===') for p in product_imgs: print(f' 产品图 {p}: {"OK" if p in html else "MISSING"}') print(f' Banner {banner}: {"OK" if banner in html else "MISSING"}') print(f' 关于配图 {about}: {"OK" if about in html else "MISSING"}') print('\n=== 产品关键词 ===') for kw in required_products: print(f' {kw}: {"OK" if kw in html else "MISSING"}') print('\n=== 城市分站 ===') for name,url in cities: ok = (name in html) and (url in html) print(f' {name}: {"OK" if ok else "MISSING"}') print('\n=== 板块 ===') for s in sections: kw = s if s != '首页Banner' else 'banner' print(f' {s}: {"OK" if s in html or kw in html else "MISSING"}') print('\n=== 硬性约束 ===') checks = [] checks.append(('1 无输入模块(无form/input/textarea)', not re.search(r'<(form|input|textarea)\b', html, re.I))) checks.append(('2 有viewport自适应', 'viewport' in html)) checks.append(('3 含index.html可保存(是完整HTML)', html.strip().startswith(''))) checks.append(('4 title keywords description均含宿迁+产品+公司', ('江苏宿迁' in html.split('')[0]) and ('keywords' in html) and ('description' in html))) checks.append(('6 有响应式媒体查询', '@media' in html)) checks.append(('7 移动端折叠菜单(menu-toggle)', 'menu-toggle' in html)) checks.append(('8 无虚构资质证书模块(素材未提供,故不写)', '资质' not in html and '证书' not in html)) checks.append(('10 无ICP备案信息', 'ICP' not in html and '备案' not in html)) checks.append(('Banner 1920x1000 完整显示(figure比例+object-fit)', 'aspect-ratio:1920/1000' in html)) for name,ok in checks: print(f' [{"PASS" if ok else "FAIL"}] {name}') print('\n=== 广告法违规词扫描 ===') found = [w for w in banned if w in html] print(f' 命中违规词: {found if found else "无,合规"}') print('\n=== 图片上叠加文字/水印检查(自动无法判图,需人工确认;代码层面无绝对定位文字覆盖于img上) ===') overlay = re.findall(r'img[^>]*>.*?