Files
memind/templates/health-p0-admin.html
T
john f96fdcb3b9 feat(health): add P0 health channel kernel and encrypted health zone.
Lock health recording behind confirm-only state machines, reject public publishes for the health category, and ship the 14-day experiment Page Data templates with tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 18:04:26 +08:00

51 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>MeMind Health P0 研究者后台</title>
<style>
body { font-family: sans-serif; margin: 1.5rem; color: #111827; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td { border: 1px solid #d1d5db; padding: 0.35rem 0.5rem; text-align: left; }
input { padding: 0.4rem; }
button { margin-left: 0.5rem; padding: 0.4rem 0.8rem; }
</style>
</head>
<body>
<h1>P0 实验记录</h1>
<p>仅研究者使用。口令访问,禁止公开。</p>
<form id="auth-form">
<label for="password">口令</label>
<input id="password" name="password" type="password" minlength="6" required />
<button type="submit">查看</button>
</form>
<p id="status"></p>
<div id="table-wrap"></div>
<script src="/assets/page-data-client.js"></script>
<script>
const form = document.getElementById('auth-form');
const statusEl = document.getElementById('status');
const tableWrap = document.getElementById('table-wrap');
form.addEventListener('submit', async (event) => {
event.preventDefault();
const password = document.getElementById('password').value;
const client = MindSpacePageData.createClient({ apiBase: '/api' });
try {
await client.authenticate(password);
const { rows } = await client.listRows('health_p0_daily_log', { limit: 200 });
statusEl.textContent = `${rows.length}`;
const keys = rows[0] ? Object.keys(rows[0]) : [];
tableWrap.innerHTML = rows.length
? `<table><thead><tr>${keys.map((key) => `<th>${key}</th>`).join('')}</tr></thead><tbody>${
rows.map((row) => `<tr>${keys.map((key) => `<td>${row[key] ?? ''}</td>`).join('')}</tr>`).join('')
}</tbody></table>`
: '<p>暂无数据</p>';
} catch (error) {
statusEl.textContent = error instanceof Error ? error.message : '读取失败';
}
});
</script>
</body>
</html>