Prechádzať zdrojové kódy

feat(doa): 前端API封装+页面注册+挑战页双tab入口

Sisyphus 1 mesiac pred
rodič
commit
d022406875

+ 24 - 0
cfc-frontend/pages.json

@@ -952,6 +952,30 @@
             "navigationBarTitleText": "家庭挑战"
           }
         },
+        {
+          "path": "doa-index",
+          "style": {
+            "navigationBarTitleText": "个人目标"
+          }
+        },
+        {
+          "path": "doa-stage-create",
+          "style": {
+            "navigationBarTitleText": "创建阶段"
+          }
+        },
+        {
+          "path": "doa-stage-detail",
+          "style": {
+            "navigationBarTitleText": "阶段详情"
+          }
+        },
+        {
+          "path": "doa-week-edit",
+          "style": {
+            "navigationBarTitleText": "周计划与复盘"
+          }
+        },
         {
           "path": "water-index",
           "style": {

+ 33 - 0
cfc-frontend/pages/health/challenge-manage.vue

@@ -2,6 +2,12 @@
   <view class="page">
     <BaseLoading :loading="loading" text="加载中..." />
 
+    <!-- 顶部双 Tab:共同挑战 / 个人目标 -->
+    <view class="page-tabs">
+      <view class="page-tab active-tab" @click="goToDoa">🎯 共同挑战</view>
+      <view class="page-tab" @click="goToDoaIndex">📋 个人目标</view>
+    </view>
+
     <view v-if="!loading" class="content">
       <!-- 首页挑战状态概览 -->
       <view class="overview-card" v-if="activeChallenges.length > 0">
@@ -262,6 +268,12 @@ export default {
     }
   },
   methods: {
+    goToDoa() {
+      // 当前即共同挑战页
+    },
+    goToDoaIndex() {
+      uni.navigateTo({ url: '/pages/health/doa-index' })
+    },
     async loadData() {
       this.loading = true
       try {
@@ -468,6 +480,27 @@ export default {
 </script>
 
 <style scoped>
+.page-tabs {
+  display: flex;
+  background: #fff;
+  border-radius: 16rpx;
+  margin-bottom: 20rpx;
+  overflow: hidden;
+  border: 2rpx solid #E2E8F0;
+}
+.page-tab {
+  flex: 1;
+  text-align: center;
+  padding: 20rpx 0;
+  font-size: 28rpx;
+  font-weight: 600;
+  color: #64748B;
+  background: #fff;
+}
+.active-tab {
+  background: #10B981;
+  color: #fff;
+}
 .page {
   min-height: 100vh;
   background: #F5F7FA;

+ 9 - 0
cfc-frontend/utils/api.js

@@ -2035,6 +2035,15 @@ export const deleteChallenge = (id) => request('/api/health/challenge/delete/' +
 export const getChallengeTemplates = () => request('/api/health/challenge/templates', 'POST', {})
 export const sendLike = (data) => request('/api/health/interact/like', 'POST', data)
 
+// ===== DOA 个人目标(家庭打卡个人目标模块) =====
+export const createDoaStage = (data) => request('/api/doa/stage/create', 'POST', data)
+export const getDoaOverview = () => request('/api/doa/overview', 'POST', {})
+export const getDoaStageDetail = (stageId) => request('/api/doa/stage/detail', 'POST', { stageId: stageId })
+export const cancelDoaStage = (stageId) => request('/api/doa/stage/cancel', 'POST', { stageId: stageId })
+export const submitDoaWeekPlan = (weekId, plan) => request('/api/doa/week/plan', 'POST', { weekId: weekId, plan: plan })
+export const submitDoaWeekReview = (data) => request('/api/doa/week/review', 'POST', data)
+export const getDoaWeekList = (stageId) => request('/api/doa/week/list', 'POST', { stageId: stageId })
+
 // ===== 健康社区扩散(P3 健康圈/排行/分享) =====
 export const getCircleList = (data) => request('/api/health/circle/list', 'POST', data)
 export const createCircle = (data) => request('/api/health/circle/create', 'POST', data)