feat: scaffold gold_monitor web hub, API, PM2 deploy and docs
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
:root {
|
||||
--bg: #0a0a10;
|
||||
--panel: #12121a;
|
||||
--panel2: #1a1a29;
|
||||
--border: #242435;
|
||||
--text: #f0f0f5;
|
||||
--muted: #9a9ab0;
|
||||
--accent: #4cc2ff;
|
||||
--accent2: #7b42ff;
|
||||
--green: #0ecb81;
|
||||
--red: #f6465d;
|
||||
--warn: #e6a23c;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
min-height: 100vh;
|
||||
}
|
||||
a { color: var(--accent); text-decoration: none; }
|
||||
a:hover { text-decoration: underline; }
|
||||
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18px;
|
||||
padding: 12px 20px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: #0d0d16;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20;
|
||||
}
|
||||
.brand {
|
||||
font-weight: 700;
|
||||
background: linear-gradient(90deg, var(--accent), var(--accent2));
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.nav a {
|
||||
color: var(--muted);
|
||||
margin-right: 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.nav a.active, .nav a:hover { color: var(--text); text-decoration: none; }
|
||||
.topbar .right { margin-left: auto; color: var(--muted); font-size: 13px; }
|
||||
|
||||
.wrap { max-width: 1200px; margin: 0 auto; padding: 20px; }
|
||||
.grid { display: grid; gap: 14px; }
|
||||
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
|
||||
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
|
||||
@media (max-width: 900px) {
|
||||
.grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
padding: 16px 18px;
|
||||
box-shadow: 0 8px 24px rgba(0,0,0,.25);
|
||||
}
|
||||
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; }
|
||||
.muted { color: var(--muted); font-size: 13px; }
|
||||
.stat { font-size: 28px; font-weight: 700; }
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
border: 0;
|
||||
border-radius: 10px;
|
||||
padding: 10px 14px;
|
||||
background: linear-gradient(90deg, #3aa8e0, #6a3ad8);
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn.secondary { background: #2a2a3d; }
|
||||
.btn.danger { background: #8b2e3c; }
|
||||
.btn:hover { filter: brightness(1.08); }
|
||||
|
||||
input, select, textarea {
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #2e2e45;
|
||||
background: var(--panel2);
|
||||
color: var(--text);
|
||||
outline: none;
|
||||
}
|
||||
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
|
||||
label { display: block; margin: 0 0 6px; color: #a9a9ff; font-size: 13px; }
|
||||
.form-row { margin-bottom: 12px; }
|
||||
|
||||
table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
|
||||
th { color: var(--muted); font-weight: 600; }
|
||||
.tag {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
background: #222235;
|
||||
}
|
||||
.tag.green { color: var(--green); background: rgba(14,203,129,.12); }
|
||||
.tag.red { color: var(--red); background: rgba(246,70,93,.12); }
|
||||
.tag.gray { color: var(--muted); }
|
||||
|
||||
.flash {
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.flash.ok { background: rgba(14,203,129,.12); color: var(--green); }
|
||||
.flash.error { background: rgba(246,70,93,.12); color: var(--red); }
|
||||
|
||||
.chart-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
.chart-box {
|
||||
background: #0e0e18;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
padding: 10px;
|
||||
min-height: 220px;
|
||||
}
|
||||
.chart-box h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
|
||||
.chart-canvas { width: 100%; height: 180px; display: block; }
|
||||
.empty-chart {
|
||||
height: 180px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/** 轻量蜡烛图(无外部依赖),用于复盘四周期预览 */
|
||||
(function () {
|
||||
function drawCandleChart(canvas, bars) {
|
||||
if (!canvas || !bars || !bars.length) return;
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
const cssW = canvas.clientWidth || 400;
|
||||
const cssH = canvas.clientHeight || 180;
|
||||
canvas.width = cssW * dpr;
|
||||
canvas.height = cssH * dpr;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.scale(dpr, dpr);
|
||||
|
||||
const pad = 8;
|
||||
let min = Infinity, max = -Infinity;
|
||||
bars.forEach((b) => {
|
||||
min = Math.min(min, b.low);
|
||||
max = Math.max(max, b.high);
|
||||
});
|
||||
if (!(max > min)) {
|
||||
max = min + 1;
|
||||
}
|
||||
const w = cssW - pad * 2;
|
||||
const h = cssH - pad * 2;
|
||||
const n = bars.length;
|
||||
const slot = w / n;
|
||||
|
||||
ctx.clearRect(0, 0, cssW, cssH);
|
||||
ctx.fillStyle = "#0e0e18";
|
||||
ctx.fillRect(0, 0, cssW, cssH);
|
||||
|
||||
const yOf = (p) => pad + ((max - p) / (max - min)) * h;
|
||||
|
||||
bars.forEach((b, i) => {
|
||||
const x = pad + i * slot + slot * 0.5;
|
||||
const up = b.close >= b.open;
|
||||
ctx.strokeStyle = up ? "#0ecb81" : "#f6465d";
|
||||
ctx.fillStyle = ctx.strokeStyle;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, yOf(b.high));
|
||||
ctx.lineTo(x, yOf(b.low));
|
||||
ctx.stroke();
|
||||
const y1 = yOf(b.open);
|
||||
const y2 = yOf(b.close);
|
||||
const top = Math.min(y1, y2);
|
||||
const bh = Math.max(1, Math.abs(y2 - y1));
|
||||
ctx.fillRect(x - Math.max(1, slot * 0.3), top, Math.max(2, slot * 0.6), bh);
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelectorAll("canvas.chart-canvas").forEach((el) => {
|
||||
try {
|
||||
const bars = JSON.parse(el.dataset.bars || "[]");
|
||||
drawCandleChart(el, bars);
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
}
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user