From cb3c5e672455de0367bfa413588df005c944e5ec Mon Sep 17 00:00:00 2001 From: Peanut Date: Wed, 10 Jun 2026 20:45:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BA=BA=E7=94=9F?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E8=AF=A6=E6=83=85=E9=A1=B5=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E4=B8=8E=E9=A1=B6=E9=83=A8=E5=AE=89=E5=85=A8=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 合并事件标题卡与描述卡为统一的 event-content-card - 移除顶部悬浮导航,避免与小程序原生胶囊按钮重叠 - 添加顶部安全区占位(参考 profile/index.vue 等页面) - 调整按钮布局:收藏、分析、分享、编辑、收起放入内容区域 - 底部只保留居中的'聊聊'主按钮 - 使用 Markdown 组件渲染事件描述 - 添加 scrollToAnalysis 滚动定位功能 - 更新 AGENTS.md 添加操作系统命令执行规则 - 更新 CLAUDE.md 添加操作系统命令执行规则 --- AGENTS.md | 379 +++++++++++++++++++ mini-program/src/pages/life-event/detail.vue | 334 +++++++++------- 2 files changed, 572 insertions(+), 141 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..08368ec --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,379 @@ +# AGENTS.md + +This file provides guidance to Codex (Codex.ai/code) when working with code in this repository. + +--- + +## 项目概述 + +情绪博物馆 (Emotion Museum) 是一款基于 AI 技术的心理健康应用,通过智能对话、情绪分析、个性化成长方案等功能,帮助用户建立健康的情绪管理习惯。 + +**生产环境地址**: `lifescript.happylifeos.com` +- 用户前端:https://lifescript.happylifeos.com/ +- 管理后台:https://lifescript.happylifeos.com/emotion-museum-admin/ +- 后端 API:https://lifescript.happylifeos.com/api +- WebSocket:wss://lifescript.happylifeos.com/ws + +--- + +## 项目结构 + +``` +. +├── backend-single/ # Spring Boot 单体后端服务 +├── web/ # 用户前端 (Vue3 + TS + Vite) +├── web-admin/ # 管理后台 (Vue3 + TS + Element Plus) +├── UniApp/ # 跨平台移动应用 (微信小程序/H5) +├── mini-program/ # 小程序项目 +├── course-web/ # 课程 Web 项目 +├── life-script/ # 生活脚本工具 +└── tools/ # 工具脚本 +``` + +--- + +## 常用命令 + +### 后端 (backend-single) + +```bash +# 进入后端目录 +cd backend-single + +# 编译打包 +mvn clean package -DskipTests + +# 本地运行 +mvn spring-boot:run + +# 或直接运行 JAR +java -jar target/backend-single-1.0.0.jar + +# 运行测试 +mvn test + +# 运行单个测试类 +mvn test -Dtest=ClassNameTest +``` + +### 用户前端 (web) + +```bash +# 进入前端目录 +cd web + +# 安装依赖 +npm install + +# 启动开发服务器 (端口 5173) +npm run dev + +# 类型检查 +npm run type-check + +# 代码检查 +npm run lint + +# 构建生产版本 +npm run build + +# 运行测试 +npm run test + +# E2E 测试 +npm run test:e2e +``` + +### 管理后台 (web-admin) + +```bash +# 进入目录 +cd web-admin + +# 安装依赖 +npm install + +# 启动开发服务器 (端口 5174) +npm run dev + +# 类型检查 +npm run type-check + +# 代码检查 +npm run lint + +# 构建生产版本 +npm run build +``` + +### UniApp/小程序 + +```bash +# 进入目录 +cd UniApp + +# 开发微信小程序 +npm run dev:mp-weixin + +# 构建微信小程序 +npm run build:mp-weixin + +# 开发 H5 +npm run dev:h5 + +# 构建 H5 +npm run build:h5 +``` + +### mini-program(推荐开发模式) + +**H5 开发模式**(日常开发,推荐): +```bash +cd mini-program +# 或使用启动脚本 +start-h5-dev.bat +``` +访问 `http://localhost:5173`,登录态保留,支持热更新。 + +**微信小程序开发模式**(仅用于小程序特性验证): +```bash +cd mini-program +npm run dev:mp-weixin +``` +在微信开发者工具中打开 `unpackage/dist/dev/mp-weixin`。 + +**开发工作流说明**:详见 [小程序开发工作流程设计](docs/superpowers/specs/2026-04-07-mini-program-dev-workflow-design.md) + +### 一键部署 + +```bash +# 部署所有服务(后端 + 前端 + 管理后台)到生产服务器 +bash deploy-all.sh + +# 仅部署后端 +bash deploy-all.sh backend + +# 仅部署前端 +bash deploy-all.sh frontend + +# 仅部署管理后台 +bash deploy-all.sh admin +``` + +--- + +## 技术栈 + +### 后端 +- **框架**: Spring Boot 2.7.18 +- **ORM**: MyBatis-Plus 3.5.3.1 +- **数据库**: MySQL 8.0.33 +- **缓存**: Redis 7.0+ +- **JWT**: io.jsonwebtoken 0.11.5 +- **构建**: Maven 3.6+ +- **JDK**: 17 + +### 前端 +- **框架**: Vue 3.4.x + TypeScript 5.x +- **构建**: Vite 5.x +- **UI**: Element Plus 2.4.x +- **样式**: Tailwind CSS 3.4.x +- **状态管理**: Pinia 2.1.x +- **路由**: Vue Router 4.2.x +- **HTTP**: Axios 1.6.x +- **实时通信**: @stomp/stompjs + SockJS +- **图表**: ECharts 5.4.x +- **包管理**: npm 9+ + +### 移动端 +- **框架**: UniApp (Vue 3) +- **平台**: 微信小程序、H5 + +--- + +## 架构规范 + +### 后端分层架构 +- **Controller 层**: 接口定义,参数校验,禁止业务逻辑 +- **Service 层**: 业务逻辑实现 +- **Mapper 层**: 数据访问层 +- **Entity 层**: 数据实体 +- **Request/Response 层**: 入参出参封装 +- **Config 层**: 配置类 + +### 接口设计规范 +- Controller 层路由禁止添加 `/api` 前缀 +- 使用 `@RequestParam` 传递路径参数,禁止使用 `@PathVariable` +- 接口方法参数不超过两个,超出时使用 Request/DTO 对象封装 +- 使用项目已有的 `Result` 作为统一接口返回 +- 禁止使用枚举类型作为接口入参 + +### 前端架构 +- 使用 Vue 3 Composition API (`