diff --git a/.codebuddy/plans/ai-essay-correction_fbf012fb.md b/.codebuddy/plans/ai-essay-correction_fbf012fb.md new file mode 100644 index 0000000..fe5100f --- /dev/null +++ b/.codebuddy/plans/ai-essay-correction_fbf012fb.md @@ -0,0 +1,160 @@ +--- +name: ai-essay-correction +overview: 新增 AI 作文原图批改页面(EssayCorrection.vue),用户上传英语作文图片,调用批改 API,将返回的批改结果图片渲染到页面上,并在首页卡片中接入路由。 +design: + architecture: + framework: vue + styleKeywords: + - Glassmorphism + - 深色背景 + - 粉色渐变主题 + - 卡片式布局 + - 微动画 + - 对比展示 + fontSystem: + fontFamily: PingFang SC + heading: + size: 1.5rem + weight: 600 + subheading: + size: 1rem + weight: 500 + body: + size: 0.95rem + weight: 400 + colorSystem: + primary: + - "#ec4899" + - "#db2777" + background: + - rgba(255,255,255,0.03) + - rgba(255,255,255,0.06) + text: + - "#f8fafc" + - "#94a3b8" + functional: + - "#ef4444" + - "#22c55e" + - rgba(236,72,153,0.3) +todos: + - id: create-essay-correction-page + content: 新建 src/views/EssayCorrection.vue,实现图片上传、Base64转换、API调用、结果对比展示及状态管理 + status: completed + - id: wire-router-and-homepage + content: 修改 src/router/index.js 新增路由,并更新 HomePage.vue 中 card-3 的 route 为 '/essay-correction' + status: completed + dependencies: + - create-essay-correction-page +--- + +## 用户需求 + +新增一个"AI作文原图批改"功能页面,用户上传英语作文图片后,系统调用指定 API 对图片进行智能批改,并将批改后的结果图片展示在页面上。 + +## 产品概述 + +在现有 AI 英语学习辅助平台中,新增作文批改页面(路由 `/essay-correction`),与首页卡片联动。用户上传手写英语作文图片,系统将图片转为 Base64 后调用批改 API,等待返回批改后的图片 URL,最终在页面上对比展示原图与批改结果图。 + +## 核心功能 + +- **图片上传**:支持点击选择或拖拽上传图片文件(JPG/PNG),上传后预览原图 +- **API 调用**:将图片转为 Base64,携带固定提示词调用 `POST https://grsai.dakka.com.cn/v1/draw/nano-banana` 接口 +- **批改结果展示**:接口返回后,将批改结果图片渲染到页面,支持与原图对比查看 +- **状态反馈**:上传中、批改中、批改完成、批改失败等状态的加载动画与提示 +- **重新批改**:支持清空结果、重新上传图片进行新一轮批改 +- **返回首页**:顶部导航栏提供返回按钮,风格与 Speaking.vue 保持一致 + +## 技术栈 + +- **框架**:Vue 3 (Composition API ` + + + + diff --git a/src/views/HomePage.vue b/src/views/HomePage.vue index 20e5fe0..cbfa97d 100644 --- a/src/views/HomePage.vue +++ b/src/views/HomePage.vue @@ -26,7 +26,7 @@ const features = ref([ desc: '一键上传手写作文图片,AI智能OCR识别并提供词汇、语法深度批改。', class: 'card-3', icon: 'edit', - route: null + route: '/essay-correction' }, { id: 4,