Files
digital-psychology/CLAUDE.md
T
jackyu66gitandClaude 573095325f feat: 新增愈心解码整合页面 + 公共代码重构
- 新增 common.js: 从 shuzi.html/yangsheng.html 提取共享引擎(数字三角计算、八字五行、体质判别等纯函数+数据字典)
- 新增 jiema.html: 愈心解码统一入口,整合数字性格+五行体质+今日锦囊,含付费墙(模拟支付)、分享卡片、契合度测算
- shuzi.html: 引用 common.js,删重复代码,新增返回链接+URL参数预填
- yangsheng.html: 引用 common.js,删重复代码,新增返回链接+URL参数预填
- yuxingu.html: Hero下方新增愈心解码入口卡片(含生日输入+生成按钮)
- index.html: 新增愈心解码导航卡片
- CLAUDE.md: 补充项目文档和架构说明

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-13 12:59:06 +08:00

65 lines
4.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project overview
愈心谷 (YuXinGu) — a digital mental health platform. The codebase is a collection of standalone, mobile-first HTML pages with no build step, no framework, no package.json, and no JavaScript dependencies.
The product vision is detailed in `立项文档.md` (Chinese): combine digital psychology (numerology-based personality analysis) with TCM constitution theory (中医体质) to create a "test → report → subscribe → consult" funnel. Target audience is Chinese-speaking; all UI text is Chinese (zh-CN).
## Running the app
```bash
python3 server.py [port] # default port 8001
```
The server serves static files from the project root and exposes two JSON API endpoints:
- `GET /load` — returns mindmap data from `mindmap_data.json`
- `POST /save` — persists mindmap data to `mindmap_data.json` (validates JSON before writing)
There are no tests, no linters, and no build pipeline. To verify changes, run the server and open the relevant HTML file in a browser.
## File map
| File | Purpose |
|---|---|
| `index.html` | Landing page linking to all sections |
| `yuxingu.html` | Main app shell — hero, service cards, activity center, bottom nav |
| `shuzi.html` | Digital psychology calculator — life-number triangle, bagua, liuren, zodiac, wuxing modules |
| `mindmap.html` | Canvas-based mind-map editor with multi-map management |
| `yangsheng.html` | AI Eastern wellness — bazi/wuxing constitution analysis, weekly/daily reports |
| `manual.html` | Static "life manual" poster with pyramid triangle charts rendered via inline SVG |
| `yuxingu_v1.html` | Earlier iteration of the main page (kept for reference, not linked from index) |
| `server.py` | Minimal HTTP server (Python stdlib, no dependencies) |
| `立项文档.md` | Product requirements doc — market analysis, business model, pricing, MVP scope |
### Unrelated files
These files are not part of the 愈心谷 app — they belong to a separate crypto trading visualization project that happens to share the repo:
- `link_regime_chart.html` — LINK token HMM regime K-line chart
- `l2_LINK_*.json` (3 files) — market data and signals for the above
## Architecture notes
- **Every HTML file is self-contained.** All CSS and JS are embedded in `<style>` / `<script>` tags. There are no shared `.js` or `.css` files.
- **Mobile-first design** with `max-width: 430px500px` containers, `user-scalable=no`, and `env(safe-area-inset-bottom)` for notched phones.
- **CSS custom properties** define the brand palette: `--pri: #E54D42` (primary red), with per-page accent colors (gold, blue, green, orange).
- **Emoji are deliberately avoided** in the main UI — icons use CSS shapes, Unicode text symbols (△, ☯, ◈), or inline SVG.
- **Google Analytics** (`G-LVVXH3TL04`) is embedded in every HTML page via a `<script>` block in `<head>`.
- **Static assets**: `logo.png`, `logo.jpg`, `cube.jpg`. The logo is referenced from multiple pages but lives at the project root.
### Page-specific details
**`mindmap.html`** — Uses `<canvas>` for rendering with hand-rolled hit-testing, drag-to-pan, and inline text editing. Dual persistence: primary store is `localStorage` (key `yuxingu_maps`), with secondary server sync via `POST /save` and `GET /load`. The sidebar lists multiple named maps; each map is a tree with colored nodes. Data format is an array of `{name, tree: {id, text, color, children}}` objects.
**`shuzi.html`** — Full numerology engine in embedded JS: digit reduction, triangle calculation, joint codes, missing-number detection. Includes a custom base64-embedded font (`TriangleDigits`) for styled number rendering. Tabbed panels for 梅花易数, 小六壬, 大六壬, 奇门遁甲, 星座, and 五行八卦 with content rendered dynamically. Also includes a 3D bagua scene rendered on canvas.
**`yangsheng.html`** — Computes bazi (八字), five elements (五行), organ-meridian mapping, and wuyun-liuqi (五运六气) from a birth date. Weekly/daily panels use the current date to generate time-appropriate health advice. Builds on the same numerological engine concepts as `shuzi.html` but oriented toward TCM wellness rather than personality analysis.
**`manual.html`** — A static reference poster. Uses inline SVG to draw pyramid triangle charts for life-number interpretation. Different aesthetic (serif fonts, paper-like colors) from the rest of the app.
**`server.py`** — Thin wrapper around `http.server.SimpleHTTPRequestHandler`. Disables caching for HTML and JSON responses. Adds `/save` + `/load` routes. No database, no auth. Single-threaded with a 30-second socket timeout. Binds to `127.0.0.1` only (no external network access).