78 lines
3.3 KiB
HTML
78 lines
3.3 KiB
HTML
<!doctype html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>学习进度看板(模板示例)</title>
|
||
<style>
|
||
/* 全部内联;配色克制;420~1200px 自适应 */
|
||
:root { --ok:#2e7d32; --warn:#c62828; --line:#e0e0e0; --muted:#757575; }
|
||
* { box-sizing: border-box; margin: 0; }
|
||
body { font: 14px/1.6 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif; color:#212121; padding:16px; }
|
||
.head { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; }
|
||
.head h1 { font-size:18px; }
|
||
.head .meta { color:var(--muted); font-size:12px; }
|
||
.cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; margin:16px 0; }
|
||
.card { border:1px solid var(--line); border-radius:8px; padding:12px; }
|
||
.card .num { font-size:26px; font-weight:700; }
|
||
.card .label { color:var(--muted); font-size:12px; }
|
||
.bar-row { display:grid; grid-template-columns: 9em 1fr 4em; gap:8px; align-items:center; padding:4px 0; }
|
||
.bar { height:10px; background:#eee; border-radius:5px; overflow:hidden; }
|
||
.bar > i { display:block; height:100%; background:#1976d2; }
|
||
.overdue { color:var(--warn); }
|
||
.done { color:var(--ok); }
|
||
button.wkui { border:1px solid var(--line); background:#fff; border-radius:6px; padding:6px 12px; cursor:pointer; }
|
||
button.wkui:active { background:#f5f5f5; }
|
||
@media (max-width:520px) { .bar-row { grid-template-columns: 7em 1fr 4em; } }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="head">
|
||
<h1>我的学习进度</h1>
|
||
<span class="meta">数据截止:2026-11-09(来源:embedded-data)</span>
|
||
<button class="wkui" id="drill">展开研发部明细</button>
|
||
</div>
|
||
|
||
<div class="cards">
|
||
<div class="card"><div class="num">78%</div><div class="label">总完成率</div></div>
|
||
<div class="card"><div class="num done">12</div><div class="label">已完成课程</div></div>
|
||
<div class="card"><div class="num overdue">3</div><div class="label">逾期未完成</div></div>
|
||
</div>
|
||
|
||
<div id="bars"></div>
|
||
|
||
<!-- 数据快照:来自真实查询结果,禁止编造 -->
|
||
<script id="embedded-data" type="application/json">
|
||
{
|
||
"as_of": "2026-11-09",
|
||
"summary": { "total_rate": 0.78, "done": 12, "overdue": 3 },
|
||
"rows": [
|
||
{ "name": "入职必修", "rate": 1.0 },
|
||
{ "name": "安全合规", "rate": 0.6 },
|
||
{ "name": "岗位技能", "rate": 0.4 }
|
||
]
|
||
}
|
||
</script>
|
||
|
||
<script type="module">
|
||
const data = JSON.parse(document.getElementById('embedded-data').textContent);
|
||
const bars = document.getElementById('bars');
|
||
for (const row of data.rows) {
|
||
const el = document.createElement('div');
|
||
el.className = 'bar-row';
|
||
el.innerHTML = '<span>' + row.name + '</span>' +
|
||
'<span class="bar"><i style="width:' + Math.round(row.rate * 100) + '%"></i></span>' +
|
||
'<span>' + Math.round(row.rate * 100) + '%</span>';
|
||
bars.appendChild(el);
|
||
}
|
||
// 桥接为增强,不是依赖:不存在时按钮隐藏
|
||
const drill = document.getElementById('drill');
|
||
if (!(window.wkui && window.wkui.version >= 1)) {
|
||
drill.style.display = 'none';
|
||
} else {
|
||
drill.addEventListener('click', () => window.wkui.sendChat('展开研发部的培训明细'));
|
||
}
|
||
</script>
|
||
</body>
|
||
</html>
|