fix(works): 头像选型取消 10 张上限,改为不限数量多选
- works/avatar-picker.html:移除 LIMIT 常量与上限拦截,底部显示「已选 N 张」,头部文案改为「自由多选(不限数量)」 - works.js:索引 desc/stats 同步(选择=不限),file 加 ?v= 破缓存 - works.html:works.js 引用 bump 到 20261115c
This commit is contained in:
+3
-3
@@ -20,15 +20,15 @@ window.HGB_Works = [
|
|||||||
{
|
{
|
||||||
id: 'avatar-picker',
|
id: 'avatar-picker',
|
||||||
name: '默认头像选型 · 线条人像',
|
name: '默认头像选型 · 线条人像',
|
||||||
desc: '按 10 个图标库分组的线条人像头像选型页:点击卡片多选(上限 10 张)、localStorage 记忆、一键复制清单,用于确定产品默认头像。',
|
desc: '按 10 个图标库分组的线条人像头像选型页:点击卡片自由多选(不限数量)、localStorage 记忆、一键复制清单,用于确定产品默认头像。',
|
||||||
category: 'avatar',
|
category: 'avatar',
|
||||||
categoryCn: '头像',
|
categoryCn: '头像',
|
||||||
tags: ['头像', '选型', '线条人像', '多选', 'clipboard', 'localStorage'],
|
tags: ['头像', '选型', '线条人像', '多选', 'clipboard', 'localStorage'],
|
||||||
date: '2026-11-15',
|
date: '2026-11-15',
|
||||||
file: 'works/avatar-picker.html',
|
file: 'works/avatar-picker.html?v=20261115b',
|
||||||
accent: '#C8102E',
|
accent: '#C8102E',
|
||||||
emoji: '🖼',
|
emoji: '🖼',
|
||||||
stats: [['候选', '41'], ['图标库', '10'], ['上限', '10 张']],
|
stats: [['候选', '41'], ['图标库', '10'], ['选择', '不限']],
|
||||||
notes: '素材来自画个标素材 API;SVG 全部内联,零外部依赖,可离线单独使用。'
|
notes: '素材来自画个标素材 API;SVG 全部内联,零外部依赖,可离线单独使用。'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
+1
-1
@@ -117,7 +117,7 @@ main{max-width:1180px;margin:0 auto;padding:26px 16px 64px}
|
|||||||
<iframe id="modal-frame" title="成品预览"></iframe>
|
<iframe id="modal-frame" title="成品预览"></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="js/data/works.js?v=20261115a"></script>
|
<script src="js/data/works.js?v=20261115c"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
var WORKS = window.HGB_Works || [];
|
var WORKS = window.HGB_Works || [];
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ footer{position:fixed;left:0;right:0;bottom:0;background:#fff;border-top:1px sol
|
|||||||
.btn.ghost{background:#F1F3F8;color:#555}
|
.btn.ghost{background:#F1F3F8;color:#555}
|
||||||
.tip{font-size:12px;color:var(--muted);margin:0 0 14px}
|
.tip{font-size:12px;color:var(--muted);margin:0 0 14px}
|
||||||
</style></head><body>
|
</style></head><body>
|
||||||
<header><h1>默认头像选型 · 线条人像</h1><div class="sub">点击卡片选中(最多 10 张),底部可复制清单发我。全部为线条/描边风格人物图标,共 10 个图标库。素材来源:画个标素材 API</div>
|
<header><h1>默认头像选型 · 线条人像</h1><div class="sub">点击卡片自由多选(不限数量),底部可复制清单发我。全部为线条/描边风格人物图标,共 10 个图标库。素材来源:画个标素材 API</div>
|
||||||
<div class="tabs"><button class="tab active" data-filter="all">全部</button>
|
<div class="tabs"><button class="tab active" data-filter="all">全部</button>
|
||||||
<button class="tab" data-filter="lucide">Lucide</button>
|
<button class="tab" data-filter="lucide">Lucide</button>
|
||||||
<button class="tab" data-filter="tabler">Tabler</button>
|
<button class="tab" data-filter="tabler">Tabler</button>
|
||||||
@@ -115,7 +115,6 @@ footer{position:fixed;left:0;right:0;bottom:0;background:#fff;border-top:1px sol
|
|||||||
<button class="btn primary" id="copy">复制清单</button>
|
<button class="btn primary" id="copy">复制清单</button>
|
||||||
</footer>
|
</footer>
|
||||||
<script>
|
<script>
|
||||||
const LIMIT = 10;
|
|
||||||
const KEY = 'dm_avatar_pick_line_v1';
|
const KEY = 'dm_avatar_pick_line_v1';
|
||||||
const cards = Array.from(document.querySelectorAll('.card'));
|
const cards = Array.from(document.querySelectorAll('.card'));
|
||||||
let picked = JSON.parse(localStorage.getItem(KEY) || '[]');
|
let picked = JSON.parse(localStorage.getItem(KEY) || '[]');
|
||||||
@@ -123,16 +122,13 @@ let picked = JSON.parse(localStorage.getItem(KEY) || '[]');
|
|||||||
function render() {
|
function render() {
|
||||||
cards.forEach(c => c.classList.toggle('sel', picked.includes(c.dataset.ref)));
|
cards.forEach(c => c.classList.toggle('sel', picked.includes(c.dataset.ref)));
|
||||||
const el = document.getElementById('picked');
|
const el = document.getElementById('picked');
|
||||||
if (!picked.length) { el.innerHTML = '尚未选择 · 已选 <b>0</b>/' + LIMIT; return; }
|
if (!picked.length) { el.innerHTML = '尚未选择 · 已选 <b>0</b> 张'; return; }
|
||||||
el.innerHTML = '已选 <b>' + picked.length + '</b>/' + LIMIT + ':' + picked.join('、');
|
el.innerHTML = '已选 <b>' + picked.length + '</b> 张:' + picked.join('、');
|
||||||
}
|
}
|
||||||
function toggle(ref) {
|
function toggle(ref) {
|
||||||
const i = picked.indexOf(ref);
|
const i = picked.indexOf(ref);
|
||||||
if (i >= 0) picked.splice(i, 1);
|
if (i >= 0) picked.splice(i, 1);
|
||||||
else {
|
else picked.push(ref);
|
||||||
if (picked.length >= LIMIT) { alert('最多选 ' + LIMIT + ' 张,先取消一张再选'); return; }
|
|
||||||
picked.push(ref);
|
|
||||||
}
|
|
||||||
localStorage.setItem(KEY, JSON.stringify(picked));
|
localStorage.setItem(KEY, JSON.stringify(picked));
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user