| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <!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; }
- /* 协同状态灯(常驻):绿=已最新 红=有待同步 灰=hub未连通;点击弹详情面板 */
- .hub-wrap { position:relative; }
- .hub-dot { display:inline-flex; align-items:center; gap:6px; height:30px; padding:0 10px; border:1px solid #dcdfe6;
- border-radius:15px; background:#fff; cursor:pointer; font-size:12px; color:#606266; white-space:nowrap; }
- .hub-dot:hover { border-color:#93c5fd; }
- .hub-dot .led { width:9px; height:9px; border-radius:50%; background:#c0c4cc; transition:background .3s; }
- .hub-dot.s-green .led { background:#22c55e; box-shadow:0 0 5px rgba(34,197,94,.7); }
- .hub-dot.s-red .led { background:#ef4444; box-shadow:0 0 5px rgba(239,68,68,.8); animation:hubPulse 1.2s infinite; }
- .hub-dot.s-gray .led { background:#c0c4cc; }
- @keyframes hubPulse { 50% { opacity:.45; } }
- .hub-pop { display:none; position:absolute; right:0; top:36px; width:360px; background:#fff; border:1px solid #e4e7ed;
- border-radius:8px; box-shadow:0 6px 24px rgba(31,45,61,.16); z-index:50; overflow:hidden; }
- .hub-pop.show { display:block; }
- .hub-pop .hp-head { padding:10px 14px; border-bottom:1px solid #f2f4f7; font-size:12.5px; display:flex; align-items:center; gap:8px; }
- .hub-pop .hp-head .st-green { color:#16a34a; } .hub-pop .hp-head .st-red { color:#dc2626; } .hub-pop .hp-head .st-gray { color:#909399; }
- .hub-pop .hp-head .btn-ok { margin-left:auto; height:24px; padding:0 10px; line-height:22px; border-radius:4px;
- border:1px solid #fdba74; background:#fff; color:#b45309; cursor:pointer; font-size:11.5px; white-space:nowrap; }
- .hub-pop ul { list-style:none; max-height:240px; overflow-y:auto; }
- .hub-pop li { padding:8px 14px; border-bottom:1px solid #f7f8fa; font-size:12px; line-height:1.6; }
- .hub-pop li .u { color:#2563eb; font-weight:600; }
- .hub-pop li .t { color:#c0c4cc; font-size:11px; margin-left:6px; }
- .hub-pop li.pending { background:#fff7ed; }
- .hub-pop .hp-empty { padding:18px 14px; color:#909399; font-size:12px; text-align:center; }
- .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="topbar">
- <b>原型门户</b>
- <span class="sub" id="subTitle"></span>
- <input id="kw" placeholder="搜索页面名称/状态…">
- <span class="hub-wrap">
- <span class="hub-dot s-gray" id="hubDot" title="协同状态,点击查看详情">
- <span class="led"></span><span id="hubLabel">协同…</span>
- </span>
- <div class="hub-pop" id="hubPop">
- <div class="hp-head"><span id="hubState"></span>
- <button class="btn-ok" id="hubAck" onclick="ackSync()">✔ 我已同步(proto_sync)</button>
- </div>
- <ul id="hubList"></ul>
- </div>
- </span>
- <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><!-- _meta.js 由 _meta.json 自动生成(wedo 维护),勿手改 -->
- <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;
- if (M.live.account) {
- liveBtn.title = "账号:" + M.live.account + " 密码:" + (M.live.password || "-") + "\n(点击打开登录页,同时复制账号密码到剪贴板)";
- liveBtn.onclick = function () {
- try { navigator.clipboard.writeText("账号:" + M.live.account + "\n密码:" + (M.live.password || "-")); } catch (e) {}
- };
- }
- } else { liveBtn.title = M.live.note; liveBtn.style.color = "#c0c4cc"; liveBtn.onclick = function () { alert("线上系统地址待登记:编辑 _meta.json 的 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.json</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.json 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();
- /* ── 协同状态灯(常驻):绿=已最新 红=有待同步 灰=hub未连通;点击弹详情面板,同步动作交给AI/MCP ── */
- (function () {
- var H = window.PROTO_META.hub;
- var dot = document.getElementById("hubDot"), pop = document.getElementById("hubPop");
- if (!H || !H.url) { dot.classList.add("s-gray"); document.getElementById("hubLabel").textContent = "协同未配置"; return; }
- var LS = "wedo_lastSynced_" + (H.repo || "default");
- var lastEvs = []; /* 最近一次轮询到的事件(详情面板渲染用) */
- 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 fmtTs(ts) {
- var t = new Date(ts);
- return ("0" + t.getHours()).slice(-2) + ":" + ("0" + t.getMinutes()).slice(-2);
- }
- function setState(st, label) { /* st: green|red|gray */
- dot.classList.remove("s-green", "s-red", "s-gray");
- dot.classList.add("s-" + st);
- document.getElementById("hubLabel").textContent = label;
- var head = document.getElementById("hubState");
- head.className = "st-" + st;
- head.textContent = st === "green" ? "✓ 已是最新,无待同步改动"
- : st === "red" ? "🔔 有待同步的原型更新(下方橙色条目)" : "⚠ hub 未连通(检查网络/服务)";
- document.getElementById("hubAck").style.display = st === "red" ? "" : "none";
- }
- function renderPop(pendingTs) {
- var ul = document.getElementById("hubList");
- if (!lastEvs.length) { ul.innerHTML = '<div class="hp-empty">暂无协同事件</div>'; return; }
- ul.innerHTML = lastEvs.slice(-8).reverse().map(function (e) {
- return '<li class="' + (e.ts > pendingTs ? "pending" : "") + '"><span class="u">' + e.user + '</span><span class="t">' + fmtTs(e.ts) + '</span><br>' + e.message + "</li>";
- }).join("");
- }
- function check() {
- fetchAll().then(function (d) {
- lastEvs = (d && d.events) || [];
- if (!lastEvs.length) { setState("green", "协同·无事件"); renderPop(Infinity); return; }
- var last = lastEvs[lastEvs.length - 1];
- var mine = localStorage.getItem(LS);
- if (mine === null) { localStorage.setItem(LS, String(last.ts)); mine = String(last.ts); } /* 首访以最新为基线,不误报 */
- if (last.ts > Number(mine)) { setState("red", "有更新待同步"); renderPop(Number(mine)); }
- else { setState("green", "协同·已最新"); renderPop(Infinity); }
- }).catch(function () { setState("gray", "协同·未连通"); });
- }
- dot.addEventListener("click", function (e) {
- e.stopPropagation();
- pop.classList.toggle("show");
- });
- document.addEventListener("click", function (e) {
- if (!e.target.closest(".hub-wrap")) pop.classList.remove("show");
- });
- window.ackSync = function () {
- fetchAll().then(function (d) {
- var evs = (d && d.events) || [];
- if (evs.length) localStorage.setItem(LS, String(evs[evs.length - 1].ts));
- setState("green", "协同·已最新"); renderPop(Infinity);
- }).catch(function () { setState("gray", "协同·未连通"); });
- };
- check();
- setInterval(check, 2 * 60 * 1000);
- })();
- </script>
- </body>
- </html>
|