| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <title>原型门户 - 恒隆公寓AMS</title>
- <style>
- * { margin:0; padding:0; box-sizing:border-box; }
- html { overflow-x:hidden; }
- body { font-family:"PingFang SC","Microsoft YaHei",sans-serif; font-size:13px; color:#333; background:#f0f2f5; display:flex; height:100vh; overflow:hidden; }
- .nav { width:190px; background:#1f2d3d; color:#bfcbd9; flex-shrink:0; overflow-y:auto; }
- .nav .logo { height:56px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:14px; font-weight:600; background:#18222e; text-align:center; line-height:1.3; }
- .nav .group-title { padding:10px 16px 4px; font-size:11px; color:#7f95ad; }
- .nav .item { padding:8px 16px 8px 22px; cursor:pointer; display:flex; justify-content:space-between; }
- .nav .item:hover { color:#fff; }
- .nav .item.active { color:#fff; background:#2563eb; }
- .nav .item .cnt { font-size:11px; color:#7f95ad; }
- .nav .item.active .cnt { color:#dbeafe; }
- .mid { flex:1; min-width:340px; display:flex; flex-direction:column; }
- .topbar { height:56px; background:#fff; border-bottom:1px solid #e4e7ed; display:flex; align-items:center; padding:0 20px; gap:14px; }
- .topbar b { font-size:14px; }
- .topbar .sub { color:#909399; font-size:12px; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
- .upd-banner { display:none; align-items:center; gap:10px; background:#fff7ed; border-bottom:1px solid #fdba74;
- color:#9a3412; padding:8px 20px; font-size:12.5px; }
- .upd-banner.show { display:flex; }
- .upd-banner b { color:#c2410c; }
- .upd-banner .btn-ok { margin-left:auto; height:26px; padding:0 12px; line-height:24px; border-radius:4px;
- border:1px solid #fdba74; background:#fff; color:#b45309; cursor:pointer; font-size:12px; white-space:nowrap; }
- .upd-banner .btn-ok:hover { background:#fef3c7; }
- .topbar input { height:32px; border:1px solid #dcdfe6; border-radius:4px; padding:0 10px; width:220px; outline:none; }
- .topbar input:focus { border-color:#2563eb; }
- .topbar a.btn, .topbar .btn { height:30px; padding:0 12px; line-height:28px; border-radius:4px; font-size:12px; cursor:pointer; text-decoration:none; border:1px solid #dcdfe6; color:#606266; background:#fff; white-space:nowrap; }
- .list { flex:1; overflow-y:auto; padding:16px 20px; }
- .cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
- .card { background:#fff; border:1px solid #ebeef5; border-radius:8px; padding:14px 16px; cursor:pointer; transition:box-shadow .15s,border-color .15s; }
- .card:hover { border-color:#93c5fd; box-shadow:0 2px 10px rgba(37,99,235,.12); }
- .card.sel { border-color:#2563eb; box-shadow:0 0 0 2px rgba(37,99,235,.18); }
- .card h3 { font-size:14px; margin-bottom:6px; display:flex; align-items:center; gap:8px; }
- .card h3 .st { font-size:11px; font-weight:400; color:#2563eb; background:#eff6ff; padding:1px 7px; border-radius:3px; }
- .meta-row { color:#909399; font-size:12px; line-height:1.8; }
- .meta-row .src { color:#0e7490; cursor:pointer; }
- .meta-row a { color:#2563eb; text-decoration:none; }
- .meta-row .pend { color:#c0c4cc; }
- .card .ops { margin-top:8px; display:flex; gap:8px; }
- .card .ops span { font-size:12px; color:#2563eb; }
- .card .ops .off { color:#c0c4cc; cursor:default; }
- .empty-tip { text-align:center; color:#909399; padding:60px 0; grid-column:1/-1; }
- /* 右侧预览 */
- .preview { width:46%; min-width:420px; flex-shrink:0; background:#fff; border-left:1px solid #e4e7ed; display:flex; flex-direction:column; }
- .preview.off { display:none; }
- .pv-head { height:56px; border-bottom:1px solid #ebeef5; display:flex; align-items:center; padding:0 16px; gap:10px; }
- .pv-head b { flex:1; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
- .pv-head .x { cursor:pointer; color:#909399; font-size:17px; padding:0 4px; }
- .pv-bar { height:34px; background:#f5f7fa; display:flex; align-items:center; gap:8px; padding:0 12px; font-size:11px; color:#909399; border-bottom:1px solid #ebeef5; }
- .pv-bar a { color:#2563eb; text-decoration:none; }
- .pv-bar .ph { color:#c0c4cc; }
- iframe { flex:1; border:none; width:100%; background:#fff; }
- .pv-empty { flex:1; display:flex; align-items:center; justify-content:center; color:#c0c4cc; flex-direction:column; gap:10px; }
- </style>
- </head>
- <body>
- <div class="nav">
- <div class="logo">恒隆原型库<br><span style="font-size:10px;font-weight:400;color:#7f95ad">补充重构·二开</span></div>
- <div class="group-title">全部模块</div>
- <div class="item active" data-d="全部">全部 <span class="cnt" id="cntAll"></span></div>
- <div class="group-title">业务域</div>
- <div id="domains"></div>
- </div>
- <div class="mid">
- <div class="upd-banner" id="updBanner">
- 🔔 <b>原型有更新:</b><span id="updText"></span>
- <button class="btn-ok" onclick="ackSync()">✔ 我已同步(proto_sync)</button>
- </div>
- <div class="topbar">
- <b>原型门户</b>
- <span class="sub" id="subTitle"></span>
- <input id="kw" placeholder="搜索页面名称/状态…">
- <a class="btn" id="liveBtn" target="_blank">🖥 线上系统</a>
- <a class="btn" id="repoBtn" target="_blank">📦 Gogs 仓库</a>
- </div>
- <div class="list"><div class="cards" id="cards"></div></div>
- </div>
- <div class="preview off" id="preview">
- <div class="pv-head"><b id="pvTitle"></b><a class="btn" id="pvOpen" target="_blank" style="height:28px;line-height:26px;font-size:12px;padding:0 10px;border:1px solid #dcdfe6;border-radius:4px;color:#2563eb;text-decoration:none">新标签打开</a><span class="x" onclick="closePv()">✕</span></div>
- <div class="pv-bar" id="pvBar"></div>
- <iframe id="pvFrame"></iframe>
- <div class="pv-empty" id="pvEmpty"><div style="font-size:36px">👁</div>点击左侧卡片在此预览原型<br><span style="font-size:12px">原型内「ⓘ 逻辑标注」等交互均可在预览中操作</span></div>
- </div>
- <script src="_meta.js"></script>
- <script>
- var M = window.PROTO_META, curDomain = "全部", curPage = null;
- document.getElementById("subTitle").textContent = M.system + " · " + M.repo.desc;
- document.getElementById("repoBtn").href = M.repo.url;
- var liveBtn = document.getElementById("liveBtn");
- if (M.live.url) { liveBtn.href = M.live.url; } else { liveBtn.title = M.live.note; liveBtn.style.color = "#c0c4cc"; liveBtn.onclick = function () { alert("线上系统地址待登记:编辑 _meta.js 的 live.url"); return false; }; }
- /* 域导航 */
- var dbox = document.getElementById("domains");
- M.domains.forEach(function (d) {
- var n = M.pages.filter(function (p) { return p.domain === d; }).length;
- var el = document.createElement("div"); el.className = "item"; el.dataset.d = d;
- el.innerHTML = d + (n ? ' <span class="cnt">' + n + "</span>" : "");
- if (!n) { el.style.color = "#5b6b7d"; el.title = "暂无原型,欢迎补充"; }
- dbox.appendChild(el);
- });
- document.getElementById("cntAll").textContent = M.pages.length;
- document.querySelector(".nav").addEventListener("click", function (e) {
- var it = e.target.closest(".item"); if (!it) return;
- document.querySelectorAll(".nav .item").forEach(function (x) { x.classList.remove("active"); });
- it.classList.add("active"); curDomain = it.dataset.d; render();
- });
- document.getElementById("kw").addEventListener("input", render);
- function typeBadge(t) {
- var c = { "墨刀": "#7c3aed", "线上系统": "#0e7490", "需求文档": "#b45309", "新设计": "#16a34a" }[t] || "#909399";
- return '<b style="color:' + c + ';font-weight:600">[' + t + ']</b>';
- }
- function render() {
- var kw = (document.getElementById("kw").value || "").trim();
- var box = document.getElementById("cards"); box.innerHTML = "";
- var list = M.pages.filter(function (p) {
- if (curDomain !== "全部" && p.domain !== curDomain) return false;
- if (kw && !(p.name + p.status + p.domain).includes(kw)) return false;
- return true;
- });
- if (!list.length) { box.innerHTML = '<div class="empty-tip">该模块暂无原型<br><span style="font-size:12px">用 reproto 流程重构后收录,并更新 _meta.js</span></div>'; return; }
- list.forEach(function (p) {
- var c = document.createElement("div");
- c.className = "card" + (curPage === p.file ? " sel" : "");
- var src = p.initialSource;
- c.innerHTML =
- "<h3>" + p.domain + " · " + p.name + ' <span class="st">' + p.status + "</span></h3>" +
- '<div class="meta-row">初始版本:' + typeBadge(src.type) +
- (src.url ? ' <a href="' + src.url + '" target="_blank" onclick="event.stopPropagation()">' + (src.desc || "查看来源") + "</a>" : " " + (src.desc || "")) + "</div>" +
- '<div class="meta-row">线上对照:' + (p.liveUrl ? ' <a href="' + p.liveUrl + '" target="_blank" onclick="event.stopPropagation()">打开线上页面</a>' : ' <span class="pend">待登记(_meta.js liveUrl)</span>') +
- ' · 更新:' + p.updated + "</div>" +
- (p.related ? '<div class="meta-row" style="white-space:normal;color:#b0b6bf">' + p.related + "</div>" : "") +
- '<div class="ops"><span>👁 点击预览</span></div>';
- c.onclick = function () { openPv(p); };
- box.appendChild(c);
- });
- }
- function openPv(p) {
- curPage = p.file; render();
- document.getElementById("preview").classList.remove("off");
- document.getElementById("pvEmpty").style.display = "none";
- document.getElementById("pvFrame").style.display = "block";
- document.getElementById("pvTitle").textContent = p.domain + " · " + p.name + "(" + p.status + ")";
- document.getElementById("pvOpen").href = p.file;
- document.getElementById("pvBar").innerHTML =
- "本地: " + p.file + " · 线上: " + (p.liveUrl ? '<a href="' + p.liveUrl + '" target="_blank">' + p.liveUrl + "</a>" : '<span class="ph">待登记</span>');
- document.getElementById("pvFrame").src = p.file;
- }
- function closePv() {
- document.getElementById("preview").classList.add("off");
- document.getElementById("pvFrame").src = "about:blank";
- document.getElementById("pvFrame").style.display = "none";
- document.getElementById("pvEmpty").style.display = "flex";
- curPage = null; render();
- }
- render();
- /* ── 协同提醒:轮询 wedo-hub,他人有新改动时横幅提示(本页无法执行git,同步动作交给AI/MCP) ── */
- (function () {
- var H = window.PROTO_META.hub;
- if (!H || !H.url) return;
- var LS = "wedo_lastSynced_" + (H.repo || "default");
- function fetchAll() {
- return fetch(H.url.replace(/\/$/, "") + "/events?repo=" + encodeURIComponent(H.repo || "") + "&since=0",
- { headers: H.token ? { "x-wedo-token": H.token } : {} }).then(function (r) { return r.json(); });
- }
- function check() {
- fetchAll().then(function (d) {
- var evs = (d && d.events) || [];
- if (!evs.length) return;
- var last = evs[evs.length - 1];
- var mine = localStorage.getItem(LS);
- if (mine === null) { localStorage.setItem(LS, String(last.ts)); return; } /* 首访以最新为基线,不误报 */
- if (last.ts > Number(mine)) {
- var t = new Date(last.ts), hh = ("0" + t.getHours()).slice(-2) + ":" + ("0" + t.getMinutes()).slice(-2);
- document.getElementById("updText").textContent =
- last.user + " 于 " + hh + " " + last.message + " —— 请让 AI 执行 proto_sync {pull:true} 同步后刷新本页";
- document.getElementById("updBanner").classList.add("show");
- }
- }).catch(function () { /* hub不可达:静默,不影响浏览 */ });
- }
- window.ackSync = function () {
- document.getElementById("updBanner").classList.remove("show");
- fetchAll().then(function (d) {
- var evs = (d && d.events) || [];
- if (evs.length) localStorage.setItem(LS, String(evs[evs.length - 1].ts));
- }).catch(function () { });
- };
- check();
- setInterval(check, 2 * 60 * 1000);
- })();
- </script>
- </body>
- </html>
|