提交
This commit is contained in:
1 parent
a903fcf6d4
commit
259c55cc23
80 files changed
+6090
-123
No files matched your search
@@ -902,20 +902,140 @@ button {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ── 空态 ── */
|
||||
/* ── 空态(方案 B · 插画文件夹,对齐 miniprogram/components/mp-empty) ── */
|
||||
.mp-empty {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
padding: 40px 20px 32px;
|
||||
color: var(--text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.mp-empty__art {
|
||||
position: relative;
|
||||
width: 148px;
|
||||
height: 112px;
|
||||
margin: 0 auto 18px;
|
||||
}
|
||||
|
||||
.mp-empty__shadow {
|
||||
position: absolute;
|
||||
left: 24px;
|
||||
right: 24px;
|
||||
bottom: 6px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
background: rgba(15, 30, 25, 0.08);
|
||||
}
|
||||
|
||||
.mp-empty__folder {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 10px;
|
||||
transform: translateX(-50%);
|
||||
width: 108px;
|
||||
height: 78px;
|
||||
}
|
||||
|
||||
.mp-empty__folder-tab {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: -10px;
|
||||
width: 38px;
|
||||
height: 16px;
|
||||
border-radius: 8px 8px 0 0;
|
||||
background: #87d4b0;
|
||||
}
|
||||
|
||||
.mp-empty__folder-back {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 12px 12px 14px 14px;
|
||||
background: linear-gradient(160deg, #b7e6d2, #7dcea0);
|
||||
}
|
||||
|
||||
.mp-empty__folder-front {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 58px;
|
||||
border-radius: 10px 14px 14px 14px;
|
||||
background: linear-gradient(180deg, #ecfdf5, #dff7ec);
|
||||
border: 1px solid rgba(8, 127, 87, 0.18);
|
||||
box-shadow: 0 8px 18px rgba(10, 159, 109, 0.12);
|
||||
}
|
||||
|
||||
.mp-empty__lines {
|
||||
position: absolute;
|
||||
left: 18px;
|
||||
right: 18px;
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.mp-empty__line {
|
||||
display: block;
|
||||
height: 6px;
|
||||
border-radius: 999px;
|
||||
background: #cfe9dc;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.mp-empty__line--mid { width: 70%; }
|
||||
.mp-empty__line--short { width: 48%; margin-bottom: 0; }
|
||||
|
||||
.mp-empty__title {
|
||||
display: block;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.mp-empty__desc {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.mp-empty__actions {
|
||||
margin-top: 18px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.mp-empty__icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 0 auto 12px;
|
||||
border-radius: 50%;
|
||||
background: #edf5f1;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(160deg, #b7e6d2, #7dcea0);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.mp-empty__icon::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: -6px;
|
||||
width: 22px;
|
||||
height: 10px;
|
||||
border-radius: 6px 6px 0 0;
|
||||
background: #87d4b0;
|
||||
}
|
||||
|
||||
.mp-empty__icon::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
right: 6px;
|
||||
bottom: 8px;
|
||||
height: 34px;
|
||||
border-radius: 8px 10px 10px 10px;
|
||||
background: linear-gradient(180deg, #ecfdf5, #dff7ec);
|
||||
border: 1px solid rgba(8, 127, 87, 0.16);
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════
|
||||
|
||||
@@ -0,0 +1,832 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>山峡化工 · 产品分类树形展示 Demo</title>
|
||||
<link rel="stylesheet" href="shanxia-mp-base.css" />
|
||||
<style>
|
||||
/* 方案切换条(Demo 专用,非业务 UI) */
|
||||
.approach-bar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 10px 12px 8px;
|
||||
}
|
||||
.approach-bar__title {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.approach-tabs {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.approach-tab {
|
||||
flex: 1;
|
||||
padding: 8px 4px;
|
||||
border-radius: 10px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
background: #f3f7f5;
|
||||
border: 1px solid transparent;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
}
|
||||
.approach-tab.active {
|
||||
color: var(--brand-green-dark);
|
||||
background: var(--brand-green-soft);
|
||||
border-color: #b7e6d2;
|
||||
}
|
||||
.approach-tab small {
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
font-size: 10px;
|
||||
opacity: 0.85;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.approach-note {
|
||||
margin: 10px 12px 0;
|
||||
padding: 10px 12px;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
border: 1px solid var(--border);
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.55;
|
||||
}
|
||||
.approach-note strong {
|
||||
color: var(--text-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
.approach-note .rec {
|
||||
display: inline-block;
|
||||
margin-left: 6px;
|
||||
padding: 1px 6px;
|
||||
border-radius: 999px;
|
||||
background: var(--brand-green-soft);
|
||||
color: var(--brand-green-dark);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.panel { display: none; }
|
||||
.panel.active { display: block; }
|
||||
|
||||
.mp-subpage-back { color: #fff; font-size: 13px; opacity: 0.95; }
|
||||
.header-tools {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
.header-tools .mp-header__action {
|
||||
padding: 0 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* ── 方案 A:缩进展开树 ── */
|
||||
.tree-list {
|
||||
margin: 12px;
|
||||
background: #fff;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tree-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 52px;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
background: #fff;
|
||||
}
|
||||
.tree-row:last-child { border-bottom: none; }
|
||||
.tree-row:active { background: #f7fbf9; }
|
||||
.tree-row.is-l2 { background: #fbfdff; }
|
||||
.tree-row.is-l3 { background: #fafcfb; }
|
||||
.tree-chevron {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-muted);
|
||||
font-size: 10px;
|
||||
flex-shrink: 0;
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
.tree-chevron.is-leaf {
|
||||
visibility: hidden;
|
||||
}
|
||||
.tree-chevron.is-open {
|
||||
transform: rotate(90deg);
|
||||
color: var(--brand-green);
|
||||
}
|
||||
.tree-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.tree-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.tree-meta {
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.tree-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.icon-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
color: var(--brand-green-dark);
|
||||
background: var(--brand-green-soft);
|
||||
}
|
||||
.icon-btn.more {
|
||||
background: #f1f5f3;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.children-wrap { display: none; }
|
||||
.children-wrap.open { display: block; }
|
||||
|
||||
/* ── 方案 B:逐级下钻 ── */
|
||||
.crumb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 10px 12px 0;
|
||||
flex-wrap: wrap;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.crumb a {
|
||||
color: var(--brand-green-dark);
|
||||
font-weight: 500;
|
||||
}
|
||||
.crumb .sep { opacity: 0.5; }
|
||||
.crumb .current { color: var(--text-primary); font-weight: 600; }
|
||||
.drill-list {
|
||||
margin: 12px;
|
||||
background: #fff;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.drill-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-height: 56px;
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
}
|
||||
.drill-row:last-child { border-bottom: none; }
|
||||
.drill-row:active { background: #f7fbf9; }
|
||||
.drill-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
background: var(--brand-green-soft);
|
||||
color: var(--brand-green-dark);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.drill-main { flex: 1; min-width: 0; }
|
||||
.drill-name {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.drill-sub {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
.drill-arrow {
|
||||
color: var(--text-placeholder);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* ── 方案 C:扁平 + 全路径 ── */
|
||||
.flat-list {
|
||||
margin: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.flat-card {
|
||||
background: #fff;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
padding: 12px 14px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
.flat-card__head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
.flat-card__title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.flat-card__path {
|
||||
margin-top: 4px;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.4;
|
||||
}
|
||||
.flat-card__foot {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.filter-chips {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 0 12px;
|
||||
margin-top: 10px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.chip {
|
||||
flex-shrink: 0;
|
||||
padding: 6px 12px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
background: #fff;
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.chip.active {
|
||||
background: var(--brand-green-soft);
|
||||
border-color: #b7e6d2;
|
||||
color: var(--brand-green-dark);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 操作菜单 Action Sheet */
|
||||
.cat-as {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 0;
|
||||
transform: translateX(-50%) translateY(100%);
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
z-index: 210;
|
||||
padding: 0 12px calc(10px + env(safe-area-inset-bottom, 0px));
|
||||
transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
|
||||
pointer-events: none;
|
||||
}
|
||||
.cat-as.is-open {
|
||||
transform: translateX(-50%) translateY(0);
|
||||
pointer-events: auto;
|
||||
}
|
||||
.cat-as__handle {
|
||||
width: 36px; height: 4px; border-radius: 999px;
|
||||
background: rgba(255,255,255,0.55); margin: 0 auto 8px;
|
||||
}
|
||||
.cat-as__head {
|
||||
background: #fff; border-radius: 16px 16px 0 0;
|
||||
padding: 14px 16px 10px; border-bottom: 1px solid var(--border-light);
|
||||
}
|
||||
.cat-as__eyebrow { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
|
||||
.cat-as__title { display: block; font-size: 16px; font-weight: 700; color: var(--text-primary); }
|
||||
.cat-as__group {
|
||||
background: #fff; border-radius: 0 0 16px 16px;
|
||||
overflow: hidden; margin-bottom: 8px;
|
||||
}
|
||||
.cat-as__item {
|
||||
display: flex; align-items: center; gap: 12px;
|
||||
min-height: 56px; padding: 12px 14px;
|
||||
border-bottom: 1px solid var(--border-light);
|
||||
width: 100%; text-align: left;
|
||||
}
|
||||
.cat-as__item:last-child { border-bottom: none; }
|
||||
.cat-as__item:active { background: #f7fbf9; }
|
||||
.cat-as__icon {
|
||||
width: 36px; height: 36px; border-radius: 10px;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
font-size: 13px; font-weight: 700; flex-shrink: 0;
|
||||
}
|
||||
.cat-as__icon--edit { color: var(--brand-green-dark); background: var(--brand-green-soft); }
|
||||
.cat-as__icon--add { color: #087f57; background: #e9f9f2; }
|
||||
.cat-as__icon--del { color: var(--danger); background: var(--danger-soft); }
|
||||
.cat-as__meta { flex: 1; min-width: 0; }
|
||||
.cat-as__name { display: block; font-size: 15px; font-weight: 600; color: var(--text-primary); }
|
||||
.cat-as__item--danger .cat-as__name { color: var(--danger); }
|
||||
.cat-as__desc { display: block; margin-top: 2px; font-size: 11px; color: var(--text-muted); }
|
||||
.cat-as__arrow { color: #c5d5cd; font-size: 18px; }
|
||||
.cat-as__cancel {
|
||||
width: 100%; min-height: 50px; background: #fff; border-radius: 16px;
|
||||
font-size: 15px; font-weight: 600; color: var(--text-muted);
|
||||
}
|
||||
.cat-as__cancel:active { background: #f3f7f5; }
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 40px;
|
||||
transform: translateX(-50%) translateY(20px);
|
||||
background: rgba(31, 42, 38, 0.92);
|
||||
color: #fff;
|
||||
padding: 10px 16px;
|
||||
border-radius: 999px;
|
||||
font-size: 13px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: all 0.2s ease;
|
||||
z-index: 100;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.toast.show {
|
||||
opacity: 1;
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="proto-nav">
|
||||
<strong>Demo 导航</strong>
|
||||
<a href="shanxia-mp-index.html">索引</a>
|
||||
<a href="shanxia-mp-workbench-demo.html">工作台</a>
|
||||
<a href="shanxia-mp-crm-demo.html">CRM列表</a>
|
||||
<a class="active" href="shanxia-mp-crm-product-category-demo.html">产品分类树</a>
|
||||
</nav>
|
||||
|
||||
<main class="phone no-tabbar">
|
||||
<!-- 方案切换 -->
|
||||
<div class="approach-bar">
|
||||
<div class="approach-bar__title">移动端树形展示方案对比 · 已采用方案 A(点击切换预览)</div>
|
||||
<div class="approach-tabs">
|
||||
<button class="approach-tab active" type="button" data-approach="a">
|
||||
A 缩进展开
|
||||
<small>推荐</small>
|
||||
</button>
|
||||
<button class="approach-tab" type="button" data-approach="b">
|
||||
B 逐级下钻
|
||||
<small>目录式</small>
|
||||
</button>
|
||||
<button class="approach-tab" type="button" data-approach="c">
|
||||
C 扁平路径
|
||||
<small>搜索友好</small>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── 方案 A ── -->
|
||||
<section class="panel active" id="panel-a">
|
||||
<p class="approach-note">
|
||||
<strong>方案 A · 缩进展开树</strong>
|
||||
<span class="rec">推荐</span><br />
|
||||
对齐 Web 端树形表格:一屏看全层级,点击箭头展开/折叠;右侧「+」新增子分类、「⋯」编辑/删除。适合管理端 CRUD。
|
||||
</p>
|
||||
|
||||
<header class="mp-header">
|
||||
<div class="mp-header__row">
|
||||
<a class="mp-subpage-back" href="shanxia-mp-workbench-demo.html">← 工作台</a>
|
||||
<div class="header-tools">
|
||||
<button class="mp-header__action" type="button" id="btn-expand-all">全部展开</button>
|
||||
<button class="mp-header__action" type="button" data-toast="打开新增分类表单">+ 新增</button>
|
||||
</div>
|
||||
</div>
|
||||
<h1 class="mp-header__title" style="margin-top:8px">产品分类</h1>
|
||||
<div class="mp-header__search" style="margin-top:10px">
|
||||
<span class="mp-header__search-dot"></span>搜索分类名称
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="filter-chips">
|
||||
<button class="chip active" type="button">全部</button>
|
||||
<button class="chip" type="button">启用</button>
|
||||
<button class="chip" type="button">停用</button>
|
||||
</div>
|
||||
|
||||
<div class="tree-list" id="tree-a"></div>
|
||||
</section>
|
||||
|
||||
<!-- ── 方案 B ── -->
|
||||
<section class="panel" id="panel-b">
|
||||
<p class="approach-note">
|
||||
<strong>方案 B · 逐级下钻</strong><br />
|
||||
类似文件管理器:每次只看当前层;面包屑回退。交互简单、层级深时更清晰,但无法一屏总览整棵树,新增子分类需先进入父级。
|
||||
</p>
|
||||
|
||||
<header class="mp-header">
|
||||
<div class="mp-header__row">
|
||||
<a class="mp-subpage-back" href="shanxia-mp-workbench-demo.html">← 工作台</a>
|
||||
<button class="mp-header__action" type="button" data-toast="在当前层新增分类">+ 新增</button>
|
||||
</div>
|
||||
<h1 class="mp-header__title" style="margin-top:8px">产品分类</h1>
|
||||
<div class="mp-header__search" style="margin-top:10px">
|
||||
<span class="mp-header__search-dot"></span>搜索分类名称
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<nav class="crumb" id="drill-crumb"></nav>
|
||||
<div class="drill-list" id="drill-list"></div>
|
||||
</section>
|
||||
|
||||
<!-- ── 方案 C ── -->
|
||||
<section class="panel" id="panel-c">
|
||||
<p class="approach-note">
|
||||
<strong>方案 C · 扁平列表 + 全路径</strong><br />
|
||||
把树拍平为卡片列表,用「父 / 子 / 孙」全路径展示归属(分隔符 <code> / </code>)。搜索命中直观,但丢失展开折叠的树感,深层级可读性一般。
|
||||
</p>
|
||||
|
||||
<header class="mp-header">
|
||||
<div class="mp-header__row">
|
||||
<a class="mp-subpage-back" href="shanxia-mp-workbench-demo.html">← 工作台</a>
|
||||
<button class="mp-header__action" type="button" data-toast="打开新增分类表单">+ 新增</button>
|
||||
</div>
|
||||
<h1 class="mp-header__title" style="margin-top:8px">产品分类</h1>
|
||||
<div class="mp-header__search" style="margin-top:10px">
|
||||
<span class="mp-header__search-dot"></span>搜索分类名称
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="filter-chips">
|
||||
<button class="chip active" type="button">全部</button>
|
||||
<button class="chip" type="button">启用</button>
|
||||
<button class="chip" type="button">停用</button>
|
||||
</div>
|
||||
|
||||
<div class="flat-list" id="flat-list"></div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- 遮罩 + 操作 Action Sheet -->
|
||||
<div class="mp-overlay" id="mask"></div>
|
||||
<div class="cat-as" id="action-sheet">
|
||||
<div class="cat-as__handle"></div>
|
||||
<div class="cat-as__head">
|
||||
<span class="cat-as__eyebrow">操作分类</span>
|
||||
<span class="cat-as__title" id="sheet-title">分类名称</span>
|
||||
</div>
|
||||
<div class="cat-as__group">
|
||||
<button class="cat-as__item" type="button" data-toast="编辑分类">
|
||||
<span class="cat-as__icon cat-as__icon--edit">编</span>
|
||||
<span class="cat-as__meta">
|
||||
<span class="cat-as__name">编辑</span>
|
||||
<span class="cat-as__desc">修改名称、上级、状态等</span>
|
||||
</span>
|
||||
<span class="cat-as__arrow">›</span>
|
||||
</button>
|
||||
<button class="cat-as__item" type="button" data-toast="新增子分类">
|
||||
<span class="cat-as__icon cat-as__icon--add">子</span>
|
||||
<span class="cat-as__meta">
|
||||
<span class="cat-as__name">新增子分类</span>
|
||||
<span class="cat-as__desc">在此分类下创建下级</span>
|
||||
</span>
|
||||
<span class="cat-as__arrow">›</span>
|
||||
</button>
|
||||
<button class="cat-as__item cat-as__item--danger" type="button" data-toast="删除(需二次确认)">
|
||||
<span class="cat-as__icon cat-as__icon--del">删</span>
|
||||
<span class="cat-as__meta">
|
||||
<span class="cat-as__name">删除</span>
|
||||
<span class="cat-as__desc">有子分类或关联产品时不可删</span>
|
||||
</span>
|
||||
<span class="cat-as__arrow">›</span>
|
||||
</button>
|
||||
</div>
|
||||
<button class="cat-as__cancel" type="button" id="sheet-close">取消</button>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 模拟数据:对齐 Web CRM 产品分类树结构
|
||||
* 字段:id / parentId / categoryName / status / orderNum / children
|
||||
*/
|
||||
const TREE = [
|
||||
{
|
||||
id: '1', parentId: '0', categoryName: '化工原料', status: '0', orderNum: 1,
|
||||
children: [
|
||||
{
|
||||
id: '11', parentId: '1', categoryName: '有机溶剂', status: '0', orderNum: 1,
|
||||
children: [
|
||||
{ id: '111', parentId: '11', categoryName: '醇类', status: '0', orderNum: 1, children: [] },
|
||||
{ id: '112', parentId: '11', categoryName: '酮类', status: '0', orderNum: 2, children: [] }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '12', parentId: '1', categoryName: '无机盐', status: '0', orderNum: 2,
|
||||
children: [
|
||||
{ id: '121', parentId: '12', categoryName: '硫酸盐', status: '1', orderNum: 1, children: [] }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '2', parentId: '0', categoryName: '精细化学品', status: '0', orderNum: 2,
|
||||
children: [
|
||||
{
|
||||
id: '21', parentId: '2', categoryName: '催化剂', status: '0', orderNum: 1,
|
||||
children: []
|
||||
},
|
||||
{
|
||||
id: '22', parentId: '2', categoryName: '助剂', status: '0', orderNum: 2,
|
||||
children: [
|
||||
{ id: '221', parentId: '22', categoryName: '分散剂', status: '0', orderNum: 1, children: [] },
|
||||
{ id: '222', parentId: '22', categoryName: '消泡剂', status: '0', orderNum: 2, children: [] }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '3', parentId: '0', categoryName: '包装耗材', status: '1', orderNum: 3,
|
||||
children: []
|
||||
}
|
||||
]
|
||||
|
||||
const statusLabel = (s) => (String(s) === '0' ? '正常' : '停用')
|
||||
const statusTag = (s) =>
|
||||
String(s) === '0'
|
||||
? '<span class="mp-tag mp-tag--success">正常</span>'
|
||||
: '<span class="mp-tag mp-tag--muted">停用</span>'
|
||||
|
||||
/* ── Toast / Sheet ── */
|
||||
const toastEl = document.getElementById('toast')
|
||||
function showToast(msg) {
|
||||
toastEl.textContent = msg
|
||||
toastEl.classList.add('show')
|
||||
clearTimeout(showToast._t)
|
||||
showToast._t = setTimeout(() => toastEl.classList.remove('show'), 1600)
|
||||
}
|
||||
|
||||
const mask = document.getElementById('mask')
|
||||
const sheet = document.getElementById('action-sheet')
|
||||
function openSheet(name) {
|
||||
document.getElementById('sheet-title').textContent = name
|
||||
mask.classList.add('is-open')
|
||||
sheet.classList.add('is-open')
|
||||
}
|
||||
function closeSheet() {
|
||||
mask.classList.remove('is-open')
|
||||
sheet.classList.remove('is-open')
|
||||
}
|
||||
document.getElementById('sheet-close').onclick = closeSheet
|
||||
mask.onclick = closeSheet
|
||||
document.querySelectorAll('[data-toast]').forEach((el) => {
|
||||
el.addEventListener('click', () => {
|
||||
showToast(el.getAttribute('data-toast'))
|
||||
if (el.closest('.cat-as')) closeSheet()
|
||||
})
|
||||
})
|
||||
|
||||
/* ── 方案切换 ── */
|
||||
document.querySelectorAll('.approach-tab').forEach((tab) => {
|
||||
tab.addEventListener('click', () => {
|
||||
document.querySelectorAll('.approach-tab').forEach((t) => t.classList.remove('active'))
|
||||
document.querySelectorAll('.panel').forEach((p) => p.classList.remove('active'))
|
||||
tab.classList.add('active')
|
||||
document.getElementById('panel-' + tab.dataset.approach).classList.add('active')
|
||||
})
|
||||
})
|
||||
|
||||
document.querySelectorAll('.filter-chips .chip').forEach((chip) => {
|
||||
chip.addEventListener('click', () => {
|
||||
const group = chip.parentElement
|
||||
group.querySelectorAll('.chip').forEach((c) => c.classList.remove('active'))
|
||||
chip.classList.add('active')
|
||||
showToast('筛选:' + chip.textContent.trim() + '(Demo 仅示意)')
|
||||
})
|
||||
})
|
||||
|
||||
/* ── 方案 A:缩进展开树 ── */
|
||||
const expanded = new Set(['1', '11', '2']) // 默认展开部分节点
|
||||
|
||||
function childCount(node) {
|
||||
return (node.children || []).length
|
||||
}
|
||||
|
||||
function renderTreeA() {
|
||||
const root = document.getElementById('tree-a')
|
||||
root.innerHTML = ''
|
||||
|
||||
function renderNodes(nodes, level, container) {
|
||||
nodes.forEach((node) => {
|
||||
const hasKids = childCount(node) > 0
|
||||
const isOpen = expanded.has(node.id)
|
||||
const pad = 12 + level * 18
|
||||
|
||||
const row = document.createElement('div')
|
||||
row.className = 'tree-row' + (level === 1 ? ' is-l2' : level >= 2 ? ' is-l3' : '')
|
||||
row.style.paddingLeft = pad + 'px'
|
||||
row.innerHTML = `
|
||||
<button class="tree-chevron ${hasKids ? '' : 'is-leaf'} ${isOpen ? 'is-open' : ''}" type="button" data-toggle="${node.id}" aria-label="展开折叠">▶</button>
|
||||
<div class="tree-main">
|
||||
<div class="tree-name">${node.categoryName}</div>
|
||||
<div class="tree-meta">
|
||||
${statusTag(node.status)}
|
||||
<span>排序 ${node.orderNum}</span>
|
||||
${hasKids ? `<span>${childCount(node)} 个子类</span>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tree-actions">
|
||||
<button class="icon-btn" type="button" data-toast="新增子分类:${node.categoryName}">+</button>
|
||||
<button class="icon-btn more" type="button" data-more="${node.categoryName}">⋯</button>
|
||||
</div>
|
||||
`
|
||||
container.appendChild(row)
|
||||
|
||||
if (hasKids) {
|
||||
const wrap = document.createElement('div')
|
||||
wrap.className = 'children-wrap' + (isOpen ? ' open' : '')
|
||||
wrap.dataset.wrap = node.id
|
||||
renderNodes(node.children, level + 1, wrap)
|
||||
container.appendChild(wrap)
|
||||
}
|
||||
})
|
||||
}
|
||||
renderNodes(TREE, 0, root)
|
||||
|
||||
root.querySelectorAll('[data-toggle]').forEach((btn) => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.stopPropagation()
|
||||
const id = btn.getAttribute('data-toggle')
|
||||
if (expanded.has(id)) expanded.delete(id)
|
||||
else expanded.add(id)
|
||||
renderTreeA()
|
||||
})
|
||||
})
|
||||
root.querySelectorAll('[data-toast]').forEach((btn) => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.stopPropagation()
|
||||
showToast(btn.getAttribute('data-toast'))
|
||||
})
|
||||
})
|
||||
root.querySelectorAll('[data-more]').forEach((btn) => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.stopPropagation()
|
||||
openSheet(btn.getAttribute('data-more'))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function collectIds(nodes, set) {
|
||||
nodes.forEach((n) => {
|
||||
if (childCount(n)) {
|
||||
set.add(n.id)
|
||||
collectIds(n.children, set)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let allExpanded = false
|
||||
document.getElementById('btn-expand-all').addEventListener('click', () => {
|
||||
allExpanded = !allExpanded
|
||||
expanded.clear()
|
||||
if (allExpanded) collectIds(TREE, expanded)
|
||||
document.getElementById('btn-expand-all').textContent = allExpanded ? '全部折叠' : '全部展开'
|
||||
renderTreeA()
|
||||
})
|
||||
|
||||
/* ── 方案 B:逐级下钻 ── */
|
||||
let drillStack = [{ id: '0', categoryName: '全部', children: TREE }]
|
||||
|
||||
function currentDrillNode() {
|
||||
return drillStack[drillStack.length - 1]
|
||||
}
|
||||
|
||||
function renderDrill() {
|
||||
const node = currentDrillNode()
|
||||
const crumb = document.getElementById('drill-crumb')
|
||||
crumb.innerHTML = drillStack
|
||||
.map((n, i) => {
|
||||
if (i === drillStack.length - 1) {
|
||||
return `<span class="current">${n.categoryName}</span>`
|
||||
}
|
||||
return `<a href="#" data-crumb="${i}">${n.categoryName}</a><span class="sep">/</span>`
|
||||
})
|
||||
.join('')
|
||||
|
||||
crumb.querySelectorAll('[data-crumb]').forEach((a) => {
|
||||
a.addEventListener('click', (e) => {
|
||||
e.preventDefault()
|
||||
const idx = Number(a.getAttribute('data-crumb'))
|
||||
drillStack = drillStack.slice(0, idx + 1)
|
||||
renderDrill()
|
||||
})
|
||||
})
|
||||
|
||||
const list = document.getElementById('drill-list')
|
||||
const kids = node.children || []
|
||||
if (!kids.length) {
|
||||
list.innerHTML = `<div class="drill-row"><div class="drill-main"><div class="drill-name">暂无子分类</div><div class="drill-sub">可点击右上角新增</div></div></div>`
|
||||
return
|
||||
}
|
||||
|
||||
list.innerHTML = kids
|
||||
.map((n) => {
|
||||
const hasKids = childCount(n) > 0
|
||||
return `
|
||||
<div class="drill-row" data-enter="${n.id}">
|
||||
<div class="drill-icon">${n.categoryName.slice(0, 1)}</div>
|
||||
<div class="drill-main">
|
||||
<div class="drill-name">${n.categoryName}</div>
|
||||
<div class="drill-sub">${statusLabel(n.status)} · 排序 ${n.orderNum}${hasKids ? ' · ' + childCount(n) + ' 个子类' : ' · 末级'}</div>
|
||||
</div>
|
||||
<button class="icon-btn more" type="button" data-more="${n.categoryName}">⋯</button>
|
||||
${hasKids ? '<span class="drill-arrow">›</span>' : '<span class="drill-arrow" style="opacity:0">›</span>'}
|
||||
</div>
|
||||
`
|
||||
})
|
||||
.join('')
|
||||
|
||||
list.querySelectorAll('[data-enter]').forEach((row) => {
|
||||
row.addEventListener('click', (e) => {
|
||||
if (e.target.closest('[data-more]')) return
|
||||
const id = row.getAttribute('data-enter')
|
||||
const next = kids.find((k) => k.id === id)
|
||||
if (next && childCount(next)) {
|
||||
drillStack.push(next)
|
||||
renderDrill()
|
||||
} else if (next) {
|
||||
openSheet(next.categoryName)
|
||||
}
|
||||
})
|
||||
})
|
||||
list.querySelectorAll('[data-more]').forEach((btn) => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.stopPropagation()
|
||||
openSheet(btn.getAttribute('data-more'))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/* ── 方案 C:扁平 + 全路径 ── */
|
||||
function flattenWithPath(nodes, pathParts, out) {
|
||||
nodes.forEach((n) => {
|
||||
const path = [...pathParts, n.categoryName]
|
||||
out.push({ ...n, pathLabel: path.join(' / ') })
|
||||
if (n.children?.length) flattenWithPath(n.children, path, out)
|
||||
})
|
||||
return out
|
||||
}
|
||||
|
||||
function renderFlat() {
|
||||
const items = flattenWithPath(TREE, [], [])
|
||||
const list = document.getElementById('flat-list')
|
||||
list.innerHTML = items
|
||||
.map(
|
||||
(n) => `
|
||||
<article class="flat-card">
|
||||
<div class="flat-card__head">
|
||||
<div>
|
||||
<div class="flat-card__title">${n.categoryName}</div>
|
||||
<div class="flat-card__path">${n.pathLabel}</div>
|
||||
</div>
|
||||
${statusTag(n.status)}
|
||||
</div>
|
||||
<div class="flat-card__foot">
|
||||
<button class="mp-btn mp-btn--ghost" type="button" data-toast="新增子分类:${n.categoryName}">子分类</button>
|
||||
<button class="mp-btn mp-btn--ghost" type="button" data-more="${n.categoryName}">更多</button>
|
||||
<button class="mp-btn mp-btn--primary" type="button" data-toast="编辑:${n.categoryName}">编辑</button>
|
||||
</div>
|
||||
</article>
|
||||
`
|
||||
)
|
||||
.join('')
|
||||
|
||||
list.querySelectorAll('[data-toast]').forEach((btn) => {
|
||||
btn.addEventListener('click', () => showToast(btn.getAttribute('data-toast')))
|
||||
})
|
||||
list.querySelectorAll('[data-more]').forEach((btn) => {
|
||||
btn.addEventListener('click', () => openSheet(btn.getAttribute('data-more')))
|
||||
})
|
||||
}
|
||||
|
||||
renderTreeA()
|
||||
renderDrill()
|
||||
renderFlat()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,431 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>山峡化工 · 全局空态 Empty State Demo</title>
|
||||
<link rel="stylesheet" href="shanxia-mp-base.css" />
|
||||
<style>
|
||||
body { background: #e8eeeb; }
|
||||
.page-wrap {
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
padding: 20px 16px 48px;
|
||||
}
|
||||
.hero {
|
||||
background: var(--header-gradient);
|
||||
color: #fff;
|
||||
border-radius: 20px;
|
||||
padding: 22px 20px;
|
||||
margin-bottom: 16px;
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
.hero h1 { font-size: 20px; margin-bottom: 6px; }
|
||||
.hero p { font-size: 13px; opacity: 0.92; line-height: 1.55; }
|
||||
.pick-bar {
|
||||
position: sticky;
|
||||
top: 8px;
|
||||
z-index: 20;
|
||||
background: rgba(255,255,255,0.96);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
padding: 12px;
|
||||
margin-bottom: 16px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
backdrop-filter: blur(8px);
|
||||
}
|
||||
.pick-bar__label {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.pick-tabs {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 8px;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.pick-tabs { grid-template-columns: repeat(2, 1fr); }
|
||||
}
|
||||
.pick-tab {
|
||||
border: 1px solid var(--border);
|
||||
background: #f6faf8;
|
||||
border-radius: 12px;
|
||||
padding: 10px 8px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.35;
|
||||
}
|
||||
.pick-tab small {
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
font-size: 10px;
|
||||
margin-top: 2px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
.pick-tab.active {
|
||||
color: var(--brand-green-dark);
|
||||
background: var(--brand-green-soft);
|
||||
border-color: #b7e6d2;
|
||||
box-shadow: 0 0 0 2px rgba(10, 159, 109, 0.12);
|
||||
}
|
||||
.note {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.55;
|
||||
margin: 0 0 16px;
|
||||
padding: 12px 14px;
|
||||
background: #fff;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
}
|
||||
.note strong { color: var(--text-primary); }
|
||||
.stage {
|
||||
display: none;
|
||||
}
|
||||
.stage.active { display: block; }
|
||||
.phone-frame {
|
||||
max-width: 390px;
|
||||
margin: 0 auto;
|
||||
background: var(--bg-page);
|
||||
border-radius: 22px;
|
||||
border: 1px solid var(--border);
|
||||
box-shadow: var(--shadow-md);
|
||||
overflow: hidden;
|
||||
min-height: 640px;
|
||||
}
|
||||
.mp-subpage-back { color: #fff; font-size: 13px; opacity: 0.95; }
|
||||
|
||||
/* ════════ 方案公共 ════════ */
|
||||
.empty {
|
||||
padding: 48px 28px 40px;
|
||||
text-align: center;
|
||||
}
|
||||
.empty__title {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.empty__desc {
|
||||
margin: 8px 0 0;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.55;
|
||||
}
|
||||
.empty__actions {
|
||||
margin-top: 18px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* ════════ A · 柔和圆底 + 清单图标 ════════ */
|
||||
.empty-a__badge {
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
margin: 0 auto 16px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(145deg, #e9f9f2, #dcebe4);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: inset 0 0 0 1px rgba(10, 159, 109, 0.08);
|
||||
}
|
||||
.empty-a__badge svg { width: 42px; height: 42px; }
|
||||
|
||||
/* ════════ B · 插画卡片(文件夹) ════════ */
|
||||
.empty-b__art {
|
||||
width: 148px;
|
||||
height: 112px;
|
||||
margin: 0 auto 18px;
|
||||
position: relative;
|
||||
}
|
||||
.empty-b__shadow {
|
||||
position: absolute;
|
||||
left: 24px; right: 24px; bottom: 6px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
background: rgba(15, 30, 25, 0.08);
|
||||
filter: blur(2px);
|
||||
}
|
||||
.empty-b__folder {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 10px;
|
||||
transform: translateX(-50%);
|
||||
width: 108px;
|
||||
height: 78px;
|
||||
}
|
||||
.empty-b__folder-back {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 12px 12px 14px 14px;
|
||||
background: linear-gradient(160deg, #b7e6d2, #7dcea0);
|
||||
}
|
||||
.empty-b__folder-tab {
|
||||
position: absolute;
|
||||
left: 10px; top: -10px;
|
||||
width: 38px; height: 16px;
|
||||
border-radius: 8px 8px 0 0;
|
||||
background: #87d4b0;
|
||||
}
|
||||
.empty-b__folder-front {
|
||||
position: absolute;
|
||||
left: 0; right: 0; bottom: 0;
|
||||
height: 58px;
|
||||
border-radius: 10px 14px 14px 14px;
|
||||
background: linear-gradient(180deg, #ecfdf5, #dff7ec);
|
||||
border: 1px solid rgba(8, 127, 87, 0.18);
|
||||
box-shadow: 0 8px 18px rgba(10, 159, 109, 0.12);
|
||||
}
|
||||
.empty-b__lines {
|
||||
position: absolute;
|
||||
left: 18px; right: 18px; top: 18px;
|
||||
}
|
||||
.empty-b__lines i {
|
||||
display: block;
|
||||
height: 6px;
|
||||
border-radius: 999px;
|
||||
background: #cfe9dc;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.empty-b__lines i:nth-child(2) { width: 70%; }
|
||||
.empty-b__lines i:nth-child(3) { width: 48%; margin-bottom: 0; }
|
||||
|
||||
/* ════════ C · 极简线条图标 ════════ */
|
||||
.empty-c__glyph {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
margin: 0 auto 14px;
|
||||
color: #9aa8a1;
|
||||
}
|
||||
.empty-c__glyph svg { width: 100%; height: 100%; }
|
||||
.empty-c .empty__title { font-weight: 600; color: #5f6f68; }
|
||||
.empty-c .empty__desc { max-width: 220px; margin-left: auto; margin-right: auto; }
|
||||
|
||||
/* ════════ D · 虚线卡片容器 ════════ */
|
||||
.empty-d__panel {
|
||||
margin: 8px 8px 0;
|
||||
border: 1.5px dashed #b7d9c8;
|
||||
border-radius: 18px;
|
||||
background: #fbfefc;
|
||||
padding: 36px 20px 28px;
|
||||
}
|
||||
.empty-d__icon {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
margin: 0 auto 14px;
|
||||
border-radius: 16px;
|
||||
background: var(--brand-green-soft);
|
||||
color: var(--brand-green-dark);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* 搜索无结果变体提示条 */
|
||||
.scene-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 12px 16px 0;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
background: #fff7e8;
|
||||
color: #a67a1f;
|
||||
border: 1px solid #f0e0b8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="proto-nav">
|
||||
<strong>Demo 导航</strong>
|
||||
<a href="shanxia-mp-index.html">索引</a>
|
||||
<a href="shanxia-mp-pattern-index.html">Pattern</a>
|
||||
<a class="active" href="shanxia-mp-empty-state-demo.html">空态</a>
|
||||
</nav>
|
||||
|
||||
<div class="page-wrap">
|
||||
<header class="hero">
|
||||
<h1>全局空态 Empty State</h1>
|
||||
<p>用于列表无数据 / 搜索无结果。<strong>已采用方案 B · 插画文件夹</strong>,落地组件 <code>miniprogram/components/mp-empty</code>。下方可继续对比未选方案。</p>
|
||||
</header>
|
||||
|
||||
<div class="pick-bar">
|
||||
<div class="pick-bar__label">已采用 B;点击可切换对比其他方案</div>
|
||||
<div class="pick-tabs">
|
||||
<button class="pick-tab" type="button" data-stage="a">A 圆底图标<small>未采用</small></button>
|
||||
<button class="pick-tab active" type="button" data-stage="b">B 插画文件夹<small>已采用</small></button>
|
||||
<button class="pick-tab" type="button" data-stage="c">C 极简线条<small>未采用</small></button>
|
||||
<button class="pick-tab" type="button" data-stage="d">D 虚线卡片<small>未采用</small></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="note" id="note-a" style="display:none">
|
||||
<strong>方案 A · 柔和圆底 + SVG 清单图标</strong><br />
|
||||
保留「圆底」结构,补上可识别图形与标题/说明/主按钮。选型时备选,未采用。
|
||||
</p>
|
||||
<p class="note" id="note-b">
|
||||
<strong>方案 B · 插画风文件夹(已采用)</strong><br />
|
||||
用 CSS 拼出文件夹,品牌绿更明显。对应实现:<code>mp-empty</code> + <code>mp-biz.scss</code> / <code>shanxia-mp-base.css</code> 中的 <code>.mp-empty__*</code>。
|
||||
</p>
|
||||
<p class="note" id="note-c" style="display:none">
|
||||
<strong>方案 C · 极简线条</strong><br />
|
||||
单色 stroke 图标,信息密度最低。适合「搜索无结果」或希望页面更安静的场景。
|
||||
</p>
|
||||
<p class="note" id="note-d" style="display:none">
|
||||
<strong>方案 D · 虚线卡片容器</strong><br />
|
||||
把空态放进虚线面板,CTA 更突出。适合「尚未创建任何数据,引导新增」的首次空态。
|
||||
</p>
|
||||
|
||||
<!-- ── A ── -->
|
||||
<section class="stage" id="stage-a">
|
||||
<div class="phone-frame">
|
||||
<header class="mp-header">
|
||||
<div class="mp-header__row">
|
||||
<a class="mp-subpage-back" href="shanxia-mp-workbench-demo.html">← 工作台</a>
|
||||
<button class="mp-header__action" type="button">+ 新增</button>
|
||||
</div>
|
||||
<h1 class="mp-header__title" style="margin-top:8px">产品分类</h1>
|
||||
<div class="mp-header__search" style="margin-top:10px">
|
||||
<span class="mp-header__search-dot"></span>搜索分类名称
|
||||
</div>
|
||||
</header>
|
||||
<span class="scene-tag">场景:列表无数据</span>
|
||||
<div class="empty empty-a">
|
||||
<div class="empty-a__badge" aria-hidden="true">
|
||||
<svg viewBox="0 0 48 48" fill="none">
|
||||
<rect x="10" y="8" width="28" height="34" rx="4" stroke="#0a9f6d" stroke-width="2.2"/>
|
||||
<path d="M16 18h16M16 25h16M16 32h10" stroke="#0a9f6d" stroke-width="2.2" stroke-linecap="round"/>
|
||||
<circle cx="34" cy="34" r="9" fill="#e9f9f2" stroke="#087f57" stroke-width="2"/>
|
||||
<path d="M34 30v8M30 34h8" stroke="#087f57" stroke-width="2" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
<p class="empty__title">暂无产品分类</p>
|
||||
<p class="empty__desc">还没有分类数据,可先新增一个顶级分类</p>
|
||||
<div class="empty__actions">
|
||||
<button class="mp-btn mp-btn--primary" type="button">新增分类</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ── B(已采用) ── -->
|
||||
<section class="stage active" id="stage-b">
|
||||
<div class="phone-frame">
|
||||
<header class="mp-header">
|
||||
<div class="mp-header__row">
|
||||
<a class="mp-subpage-back" href="shanxia-mp-workbench-demo.html">← 工作台</a>
|
||||
<button class="mp-header__action" type="button">+ 新增</button>
|
||||
</div>
|
||||
<h1 class="mp-header__title" style="margin-top:8px">产品分类</h1>
|
||||
<div class="mp-header__search" style="margin-top:10px">
|
||||
<span class="mp-header__search-dot"></span>搜索分类名称
|
||||
</div>
|
||||
</header>
|
||||
<span class="scene-tag">场景:列表无数据</span>
|
||||
<div class="empty empty-b">
|
||||
<div class="empty-b__art" aria-hidden="true">
|
||||
<div class="empty-b__shadow"></div>
|
||||
<div class="empty-b__folder">
|
||||
<div class="empty-b__folder-tab"></div>
|
||||
<div class="empty-b__folder-back"></div>
|
||||
<div class="empty-b__folder-front">
|
||||
<div class="empty-b__lines"><i></i><i></i><i></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="empty__title">暂无产品分类</p>
|
||||
<p class="empty__desc">分类树为空,创建后即可在产品中引用</p>
|
||||
<div class="empty__actions">
|
||||
<button class="mp-btn mp-btn--ghost" type="button">刷新</button>
|
||||
<button class="mp-btn mp-btn--primary" type="button">新增分类</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ── C ── -->
|
||||
<section class="stage" id="stage-c">
|
||||
<div class="phone-frame">
|
||||
<header class="mp-header">
|
||||
<div class="mp-header__row">
|
||||
<a class="mp-subpage-back" href="shanxia-mp-workbench-demo.html">← 工作台</a>
|
||||
<button class="mp-header__action" type="button">+ 新增</button>
|
||||
</div>
|
||||
<h1 class="mp-header__title" style="margin-top:8px">产品分类</h1>
|
||||
<div class="mp-header__search" style="margin-top:10px">
|
||||
<span class="mp-header__search-dot"></span>有机溶剂zzz
|
||||
</div>
|
||||
</header>
|
||||
<span class="scene-tag">场景:搜索无结果</span>
|
||||
<div class="empty empty-c">
|
||||
<div class="empty-c__glyph" aria-hidden="true">
|
||||
<svg viewBox="0 0 64 64" fill="none">
|
||||
<circle cx="28" cy="28" r="14" stroke="currentColor" stroke-width="2.4"/>
|
||||
<path d="M38 38l12 12" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/>
|
||||
<path d="M22 28h12M28 22v12" stroke="currentColor" stroke-width="2" stroke-linecap="round" opacity="0.45"/>
|
||||
</svg>
|
||||
</div>
|
||||
<p class="empty__title">未找到相关分类</p>
|
||||
<p class="empty__desc">试试更短的关键词,或清除筛选后查看全部</p>
|
||||
<div class="empty__actions">
|
||||
<button class="mp-btn mp-btn--ghost" type="button">清除条件</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ── D ── -->
|
||||
<section class="stage" id="stage-d">
|
||||
<div class="phone-frame">
|
||||
<header class="mp-header">
|
||||
<div class="mp-header__row">
|
||||
<a class="mp-subpage-back" href="shanxia-mp-workbench-demo.html">← 工作台</a>
|
||||
<button class="mp-header__action" type="button">+ 新增</button>
|
||||
</div>
|
||||
<h1 class="mp-header__title" style="margin-top:8px">产品分类</h1>
|
||||
</header>
|
||||
<span class="scene-tag">场景:首次引导创建</span>
|
||||
<div class="empty empty-d">
|
||||
<div class="empty-d__panel">
|
||||
<div class="empty-d__icon" aria-hidden="true">+</div>
|
||||
<p class="empty__title">还没有产品分类</p>
|
||||
<p class="empty__desc">建议先建一级分类(如原料、助剂),再按需添加子类</p>
|
||||
<div class="empty__actions">
|
||||
<button class="mp-btn mp-btn--primary" type="button">立即新增</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const notes = {
|
||||
a: document.getElementById('note-a'),
|
||||
b: document.getElementById('note-b'),
|
||||
c: document.getElementById('note-c'),
|
||||
d: document.getElementById('note-d')
|
||||
}
|
||||
document.querySelectorAll('.pick-tab').forEach((tab) => {
|
||||
tab.addEventListener('click', () => {
|
||||
const key = tab.dataset.stage
|
||||
document.querySelectorAll('.pick-tab').forEach((t) => t.classList.remove('active'))
|
||||
document.querySelectorAll('.stage').forEach((s) => s.classList.remove('active'))
|
||||
Object.values(notes).forEach((n) => { n.style.display = 'none' })
|
||||
tab.classList.add('active')
|
||||
document.getElementById('stage-' + key).classList.add('active')
|
||||
notes[key].style.display = 'block'
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -41,6 +41,14 @@
|
||||
<span class="index-card__tag">开发前必读</span>
|
||||
</div>
|
||||
</a>
|
||||
<a class="index-card" href="shanxia-mp-empty-state-demo.html">
|
||||
<div class="index-card__icon" style="background:linear-gradient(145deg,#087f57,#11b37a)">空态</div>
|
||||
<div>
|
||||
<h2>全局空态 Empty State</h2>
|
||||
<p>已采用方案 B · 插画文件夹;组件 <code>mp-empty</code>,CRM/BX/DB/PL 列表已统一。</p>
|
||||
<span class="index-card__tag">已采用 B</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p class="index-section-title">Tab 主框架(4 个)</p>
|
||||
@@ -85,6 +93,14 @@
|
||||
<div class="index-card__icon" style="background:linear-gradient(145deg,#0a9f6d,#11b37a)">CRM</div>
|
||||
<div><h2>线索管理列表</h2><p>示例:CRM 业务办理页</p></div>
|
||||
</a>
|
||||
<a class="index-card" href="shanxia-mp-crm-product-category-demo.html">
|
||||
<div class="index-card__icon" style="background:linear-gradient(145deg,#087f57,#0a9f6d)">分类</div>
|
||||
<div>
|
||||
<h2>产品分类(树形)</h2>
|
||||
<p>已采用方案 A · 缩进展开;页面 <code>pages/crm/product-category</code>。</p>
|
||||
<span class="index-card__tag">已采用 A</span>
|
||||
</div>
|
||||
</a>
|
||||
<a class="index-card" href="shanxia-mp-bx-demo.html">
|
||||
<div class="index-card__icon" style="background:linear-gradient(145deg,#c9922f,#d6a343)">报销</div>
|
||||
<div><h2>待办任务列表</h2><p>示例:报销审批办理页</p></div>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<h3>核心 Class 速查</h3>
|
||||
<div class="class-list">
|
||||
布局:<code>.mp-navbar</code> <code>.mp-header</code> <code>.mp-footer-bar</code><br>
|
||||
列表:<code>.mp-tabs</code> <code>.mp-card--clickable</code> <code>.mp-list-end</code> <code>.mp-empty</code><br>
|
||||
列表:<code>.mp-tabs</code> <code>.mp-card--clickable</code> <code>.mp-list-end</code> <code>.mp-empty</code>(方案 B · 组件 <code>mp-empty</code>)<br>
|
||||
详情:<code>.mp-detail-hero</code> <code>.mp-block</code> <code>.mp-kv-list</code> <code>.mp-timeline</code><br>
|
||||
表单:<code>.mp-form-group</code> <code>.mp-field</code> <code>.mp-field-row</code> <code>.mp-attach-upload</code><br>
|
||||
弹窗:<code>.mp-overlay</code> <code>.mp-sheet</code> <code>.mp-dialog</code> <code>.mp-action-sheet</code> <code>.mp-toast</code><br>
|
||||
|
||||
Reference in new issue
Block a user