diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 19a1f86..040276a 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -12,7 +12,8 @@ "Bash(ls -la 'E:\\\\code\\\\智柜宝\\\\wx\\\\src\\\\pages\\\\me')", "Bash(mkdir -p 'E:\\\\code\\\\智柜宝\\\\wx\\\\src\\\\pages\\\\me')", "Bash(ls -la 'E:\\\\code\\\\智柜宝\\\\wx\\\\static')", - "Bash(ls -la 'E:\\\\code\\\\智柜宝\\\\wx\\\\src\\\\static')" + "Bash(ls -la 'E:\\\\code\\\\智柜宝\\\\wx\\\\src\\\\static')", + "Bash(tree -L 3 -I 'node_modules|dist' /E/code/智柜宝/wx)" ], "deny": [], "ask": [] diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..95a3558 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,136 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +WeChat Mini Program built with **Uni-App + Vue 3** for smart cabinet management + e-commerce. Supports WeChat, H5, and App platforms. + +**Requirements**: Node.js >= 22, pnpm >= 9 + +## Common Commands + +### Development +```bash +pnpm dev:mp-weixin # WeChat Mini Program (primary) +pnpm dev:h5 # H5 +pnpm dev:app # App +pnpm dev:mp:test # Test environment +``` + +### Building +```bash +pnpm build:mp-weixin # Build for WeChat +pnpm build:h5 # Build for H5 +pnpm build:app # Build for App +``` + +### Code Quality +```bash +pnpm type-check # TypeScript check +pnpm lint # ESLint +pnpm lint:fix # Fix ESLint issues +``` + +## Project Structure + +``` +src/ +├── api/ # Business APIs (ab98/, cabinet/, shop/, users/, etc.) +├── components/ # Reusable components +├── config/ # App configuration +├── hooks/ # Custom Vue hooks (useRequest.ts, useUpload.ts) +├── http/ # HTTP client (http.ts, interceptor.ts) +├── layouts/ # Layout components +├── pages/ # Feature-based pages (index/, login/, me/, etc.) +├── pages-sub/ # Mini-program sub-packages +├── pinia/ # State management (stores/wx.ts, ab98-user.ts) +├── router/ # Routing config +├── static/ # Static assets +├── style/ # Global styles +├── tabbar/ # Native tabbar (2 tabs) +├── types/ # TypeScript definitions +└── utils/ # Utility functions +``` + +## Architecture + +**Layered**: API → HTTP → State (Pinia) → Components → Pages + +**HTTP**: Alova wrapper around `uni.request` with interceptors (see `src/http/`) + +**State**: Pinia stores with persisted state (`src/pinia/`) + +**Routing**: Uni-app built-in routing + interceptors (`src/router/`) + +**Authentication**: Dual mode (WeChat + Enterprise WeChat), auto token refresh + +## Key Config Files + +- **`vite.config.ts`**: Uni plugins, platform builds, H5 proxy +- **`tsconfig.json`**: Path aliases `@/*` → `src/*` +- **`uno.config.ts`**: UnoCSS preset + Carbon icons +- **`manifest.json`**: App config (name, appid, platform settings) + +## Environment Variables + +Located in `/env`: +- `.env`, `.env.development`, `.env.production`, `.env.test` + +**Key vars**: +- `VITE_SERVER_BASEURL`: API base URL +- `VITE_WX_APPID`: WeChat AppID +- `VITE_APP_PROXY_ENABLE`: H5 proxy toggle +- `VITE_AUTH_MODE`: Auth mode (single/dual token) + +## Development Guidelines + +**Full Standards**: See `/doc/代码编写规范.md` + +**Key Points**: +- **Vue 3**: `