// 临时生成脚本:富样式底部导航图标方案预览(勿提交) const fs = require('fs'); const path = 'js/data/sources/'; global.window = {}; const RED = '#C8102E'; const GRAY = '#999999'; function load(sid) { eval(fs.readFileSync(path + sid + '.js', 'utf8')); return window['HGB_Source_' + sid]; } function findIcon(data, ref) { const namePart = ref.includes(':') ? ref.split(':')[1] : ref; return (data.icons || []).find(i => i.id === ref || i.name === namePart) || null; } // 富样式源:全部 native(内容自带颜色 / currentColor),viewBox 24 const SOURCES = {}; ['twemoji', 'emojione', 'fluent-emoji', 'flat-color-icons', 'pixelarticons', 'gameicons'].forEach(sid => { SOURCES[sid] = {}; }); function renderSVG(ic) { return '' + ic.svg + ''; } const SOLUTIONS = [ { key: 'G', title: 'Twemoji 多彩扁平表情', desc: 'Twitter 同款扁平表情,彩色生动、识别度高;未选中置灰、选中全彩;「发房」= 彩色铅笔', mode: 'color', source: 'twemoji', pub: 'twemoji:pencil', items: [ { label: '首页', n: 'twemoji:house', a: 'twemoji:house' }, { label: '租房', n: 'twemoji:magnifying-glass-tilted-left', a: 'twemoji:magnifying-glass-tilted-left' }, { label: '消息', n: 'twemoji:speech-balloon', a: 'twemoji:speech-balloon' }, { label: '我的', n: 'twemoji:bust-in-silhouette', a: 'twemoji:bust-in-silhouette' } ] }, { key: 'H', title: 'EmojiOne 3D 立体表情', desc: 'EmojiOne 3D 渲染表情,立体质感、色彩饱和;「发房」= 彩色铅笔', mode: 'color', source: 'emojione', pub: 'emojione:pencil', items: [ { label: '首页', n: 'emojione:house', a: 'emojione:house' }, { label: '租房', n: 'emojione:magnifying-glass-tilted-left', a: 'emojione:magnifying-glass-tilted-left' }, { label: '消息', n: 'emojione:speech-balloon', a: 'emojione:speech-balloon' }, { label: '我的', n: 'emojione:bust-in-silhouette', a: 'emojione:bust-in-silhouette' } ] }, { key: 'I', title: 'Fluent Emoji 微软 3D 卡通', desc: '微软 Fluent 3D 表情,圆润软萌、细节丰富;「发房」= 彩色铅笔', mode: 'color', source: 'fluent-emoji', pub: 'fluent-emoji:pencil', items: [ { label: '首页', n: 'fluent-emoji:house', a: 'fluent-emoji:house' }, { label: '租房', n: 'fluent-emoji:magnifying-glass-tilted-left', a: 'fluent-emoji:magnifying-glass-tilted-left' }, { label: '消息', n: 'fluent-emoji:speech-balloon', a: 'fluent-emoji:speech-balloon' }, { label: '我的', n: 'fluent-emoji:bust-in-silhouette', a: 'fluent-emoji:bust-in-silhouette' } ] }, { key: 'J', title: 'Flat Color Icons 多彩扁平', desc: '多彩半透明玻璃质感图标,商务活泼兼顾;「发房」= 彩色钥匙', mode: 'color', source: 'flat-color-icons', pub: 'flat-color-icons:key', items: [ { label: '首页', n: 'flat-color-icons:home', a: 'flat-color-icons:home' }, { label: '租房', n: 'flat-color-icons:search', a: 'flat-color-icons:search' }, { label: '消息', n: 'flat-color-icons:comments', a: 'flat-color-icons:comments' }, { label: '我的', n: 'flat-color-icons:businessman', a: 'flat-color-icons:businessman' } ] }, { key: 'K', title: 'Pixel 像素风', desc: '8-bit 像素图标,造型感强、辨识度高;「发房」= 红圆内置铅笔', mode: 'mono', source: 'pixelarticons', pub: 'pixelarticons:edit', items: [ { label: '首页', n: 'pixelarticons:home', a: 'pixelarticons:home' }, { label: '租房', n: 'pixelarticons:search', a: 'pixelarticons:search' }, { label: '消息', n: 'pixelarticons:message', a: 'pixelarticons:message' }, { label: '我的', n: 'pixelarticons:user', a: 'pixelarticons:user' } ] }, { key: 'L', title: 'Game Icons 游戏插画风', desc: '游戏插画质感、细节华丽,风格大胆独特;「发房」= 红圆内置羽毛笔', mode: 'mono', source: 'gameicons', pub: 'gameicons:quill-ink', items: [ { label: '首页', n: 'gameicons:house', a: 'gameicons:house' }, { label: '租房', n: 'gameicons:magnifying-glass', a: 'gameicons:magnifying-glass' }, { label: '消息', n: 'gameicons:chat-bubble', a: 'gameicons:chat-bubble' }, { label: '我的', n: 'gameicons:person', a: 'gameicons:person' } ] } ]; const dataCache = {}; for (const sid of Object.keys(SOURCES)) { try { dataCache[sid] = load(sid); } catch (e) { console.error('加载失败 ' + sid); process.exit(1); } } let cards = ''; const missList = []; // 发房按钮:单色方案=红圆白图标;彩色方案=大号彩色相机图标(带投影) function pubBtn(sol) { const ic = findIcon(dataCache[sol.source], sol.pub); if (!ic) { missList.push(sol.pub); return '
+
'; } if (sol.mode === 'mono') return '
' + renderSVG(ic) + '
'; return '
' + renderSVG(ic) + '
'; } for (const sol of SOLUTIONS) { const res = []; for (const it of sol.items) { const nIc = findIcon(dataCache[sol.source], it.n); const aIc = findIcon(dataCache[sol.source], it.a); if (!nIc) missList.push(it.n); if (!aIc) missList.push(it.a); res.push({ label: it.label, normal: nIc ? renderSVG(nIc) : '', active: aIc ? renderSVG(aIc) : '' }); } const mono = sol.mode === 'mono'; const plus = pubBtn(sol); const icCls = (r, active) => mono ? `
${active ? r.active : r.normal}
` : `
${active ? r.active : r.normal}
`; const arr = [res[0], res[1], null, res[2], res[3]]; const barNormal = `
${arr.map(r => r ? `
${icCls(r, false)}
${r.label}
` : `
${plus}
发房
`).join('')}
`; const barActive = `
${arr.map((r, i) => r ? `
${icCls(r, i === 0)}
${r.label}
` : `
${plus}
发房
`).join('')}
`; const strip = res.map(r => `
${r.normal}
${r.label}·未选
${r.active}
${r.label}·选中
`).join(''); const ids = [...sol.items.map(it => it.n), ...sol.items.map(it => it.a)].join('、'); cards += `
方案 ${sol.key}${sol.title}
${sol.desc}
常规态(全部未选)
${barNormal}
选中态(首页高亮)
${barActive}
${strip}
图标:${ids}
`; } const html = ` 小虎租房 · 底部导航图标方案(富样式篇)

小虎租房 · 底部导航图标方案(富样式篇)

6 套更丰富的图标风格 · 彩色表情/多彩扁平:未选中置灰、选中全彩 · 像素/插画:未选中 #999999、选中 ${RED} ·「发房」彩色方案为铅笔/钥匙彩色图标、单色方案为红圆内置图标(非相机)
${cards} `; fs.writeFileSync('D:/SGP_KF3/ruyizu_web/docs/tabbar-icons-rich.html', html, 'utf8'); if (missList.length) console.log('缺失图标: ' + missList.join(', ')); else console.log('OK,已生成 docs/tabbar-icons-rich.html(' + SOLUTIONS.length + ' 套方案,全部图标命中)');