diff --git a/.superpowers/prototype/index.html b/.superpowers/prototype/index.html index 9bc91c4..7ea4ec6 100644 --- a/.superpowers/prototype/index.html +++ b/.superpowers/prototype/index.html @@ -366,7 +366,7 @@
分类 浓香
时间范围
-

状态徽章 · 全部

.badge .b-* · 对齐 schema 真实枚举
+

状态徽章 · 全部

.badge .b-* · 对齐 schema 真实枚举 · 圆点已全局图标化(icons.js BADGE_ICON 单源映射自动注入,屏内无需手写 svg)
库存 · 按 min_stock 派生在售预警缺货
单据 · 入库/出库草稿待审核已通过已驳回
diff --git a/.superpowers/prototype/screens/icons.js b/.superpowers/prototype/screens/icons.js index aab40b7..dd49d03 100644 --- a/.superpowers/prototype/screens/icons.js +++ b/.superpowers/prototype/screens/icons.js @@ -5,4 +5,33 @@ var SPRITE=''; function inject(){ if(document.getElementById('ym-icon-sprite'))return; var d=document.createElement('div'); d.id='ym-icon-sprite'; d.style.cssText='position:absolute;width:0;height:0'; d.innerHTML=SPRITE; document.body.insertBefore(d,document.body.firstChild); } if(document.readyState!=='loading')inject(); else document.addEventListener('DOMContentLoaded',inject); + // ---- 徽章图标化(2026-07-04 拍板:全系统圆点→代表图标)---- + // 单一真相源映射:任何屏渲染出的 .badge.b-*(无 .bi/.ico 者)自动注入图标并隐藏圆点。 + // 屏内无需手写 svg;新增状态在此登记即可全局生效。 + var BADGE_ICON = { + '在售':'i-check','预警':'i-alert','缺货':'i-close', + '草稿':'i-ic06','待审核':'i-ic04','已审核':'i-check','已拒绝':'i-close','已通过':'i-check','已驳回':'i-close', + '部分退单':'i-undo','已退单':'i-undo','待定价':'i-yen', + '启用':'i-check','停用':'i-close','供应商':'i-box','客户':'i-ic37','两者':'i-refresh', + '管理员':'i-shield-2','普通':'i-ic37','只读':'i-eye', + '在线':'i-check','离线':'i-close', + '进行中':'i-ic04','已完成':'i-check', + '未使用':'i-tag','已兑换':'i-check','作废':'i-close', + '未结清':'i-ic04','已结清':'i-check','收款':'i-download','付款':'i-upload' + }; + window.BADGE_ICON = BADGE_ICON; + function enhanceBadges(){ + document.querySelectorAll('.badge:not(.bi):not(.ico)').forEach(function(b){ + var st=''; b.classList.forEach(function(c){ if(c.indexOf('b-')===0) st=c.slice(2); }); + var ic=BADGE_ICON[st]; if(!ic) return; + b.classList.add('bi'); + b.insertAdjacentHTML('afterbegin',''); + }); + } + function watchBadges(){ + enhanceBadges(); + new MutationObserver(function(){ enhanceBadges(); }).observe(document.body,{childList:true,subtree:true}); + } + if(document.readyState!=='loading')watchBadges(); else document.addEventListener('DOMContentLoaded',watchBadges); + })();