From 525266afafab72cbd5fd76840ac86a6524a938ae Mon Sep 17 00:00:00 2001
From: nepiedg <806669289@qq.com>
Date: Fri, 13 Mar 2026 15:08:57 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=88=92=E7=83=9F?=
=?UTF-8?q?=E8=AE=A1=E5=88=92=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增 pages/quit-plan/index.vue 戒烟计划页面
- 展示30天戒烟计划总览和进度
- 显示当前阶段(记录期/减量期/巩固期)
- 展示每日目标和建议
- 支持生成计划和重置计划功能
- 在 api/smoke.js 添加相关 API 调用
- 在 pages.json 注册路由
---
api/smoke.js | 17 +
pages.json | 6 +
pages/quit-plan/index.vue | 823 ++++++++++++++++++++++++++++++++++++++
3 files changed, 846 insertions(+)
create mode 100644 pages/quit-plan/index.vue
diff --git a/api/smoke.js b/api/smoke.js
index 5b4ebf7..fec1364 100644
--- a/api/smoke.js
+++ b/api/smoke.js
@@ -63,3 +63,20 @@ export function getShareData(shareToken, params = {}) {
export function revokeShare(shareToken) {
return request.post(`/smoke/share/${shareToken}/revoke`)
}
+
+// 戒烟计划 API
+export function generateQuitPlan() {
+ return request.post('/smoke/quit-plan/generate')
+}
+
+export function getQuitPlan(params = {}) {
+ return request.get('/smoke/quit-plan', params)
+}
+
+export function getQuitPlanDays(planId) {
+ return request.get('/smoke/quit-plan/days', { plan_id: planId })
+}
+
+export function resetQuitPlan() {
+ return request.post('/smoke/quit-plan/reset')
+}
diff --git a/pages.json b/pages.json
index e3d3b51..58dc371 100644
--- a/pages.json
+++ b/pages.json
@@ -42,6 +42,12 @@
"navigationBarTitleText": "个人中心"
}
},
+ {
+ "path": "pages/quit-plan/index",
+ "style": {
+ "navigationBarTitleText": "戒烟计划"
+ }
+ },
{
"path": "pages/onboarding/index",
"style": {
diff --git a/pages/quit-plan/index.vue b/pages/quit-plan/index.vue
new file mode 100644
index 0000000..0c27687
--- /dev/null
+++ b/pages/quit-plan/index.vue
@@ -0,0 +1,823 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 📋
+ 暂无戒烟计划
+ 生成专属30天戒烟计划,按阶段轻松戒烟
+
+ 生成戒烟计划
+
+
+
+
+
+
+
+ 第 {{ currentDay }}/30 天
+ 戒烟计划进度
+ {{ stageName }}
+ {{ stageDesc }}
+
+ 计划进度
+ {{ Math.round(planProgress * 100) }}%
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+ 记录期
+ 记录每日吸烟情况,了解习惯
+
+
+
+
+ 2
+
+ 减量期
+ 逐步减少吸烟数量
+
+
+
+
+ 3
+
+ 巩固期
+ 保持成果,彻底戒烟
+
+
+
+
+
+
+
+
+
+ 今日建议
+ {{ dailyTip }}
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+
+
+ 目标:
+ {{ day.target_cigs }} 支
+
+
+ {{ day.tip }}
+
+
+
+
+ 暂无计划详情
+
+
+
+
+
+
+ 重置计划
+
+
+
+
+
+
+
+
+
+
+
+
+ 目标吸烟量
+ {{ selectedDay.target_cigs }} 支
+
+
+ 建议
+ {{ selectedDay.tip }}
+
+
+
+
+
+
+
+
+
+