Explorar o código

feat(checkin): 补全饮水打卡 + 综合健康打卡页面 + 管理后台打卡管理

E2E Test Bot hai 3 meses
pai
achega
af621f141f

+ 12 - 0
cfc-frontend/pages.json

@@ -845,6 +845,18 @@
           "style": {
             "navigationBarTitleText": "家庭挑战"
           }
+        },
+        {
+          "path": "water-index",
+          "style": {
+            "navigationBarTitleText": "饮水"
+          }
+        },
+        {
+          "path": "daily-checkin",
+          "style": {
+            "navigationBarTitleText": "健康打卡"
+          }
         }
       ]
     },

+ 249 - 0
cfc-frontend/pages/health/daily-checkin.vue

@@ -0,0 +1,249 @@
+<template>
+  <view class="page">
+    <view class="nav-bar">
+      <view class="nav-back" @tap="goBack">
+        <text class="back-text">‹ 返回</text>
+      </view>
+      <text class="nav-title">健康打卡</text>
+    </view>
+
+    <scroll-view class="content" scroll-y>
+      <view class="card">
+        <view class="card-accent"></view>
+        <view class="card-body">
+          <text class="card-title">今日综合打卡</text>
+          <text class="card-subtitle">为你的一天各项健康指标打分吧</text>
+
+          <view class="score-group">
+            <text class="score-label">饮食评分</text>
+            <view class="score-row">
+              <text class="score-min">差</text>
+              <slider min="1" max="10" :value="form.dietScore" @change="function(e){form.dietScore=e.detail.value}" block-size="20" activeColor="#FF8C42" />
+              <text class="score-val">{{ form.dietScore }}</text>
+            </view>
+          </view>
+
+          <view class="score-group">
+            <text class="score-label">运动评分</text>
+            <view class="score-row">
+              <text class="score-min">差</text>
+              <slider min="1" max="10" :value="form.exerciseScore" @change="function(e){form.exerciseScore=e.detail.value}" block-size="20" activeColor="#FF8C42" />
+              <text class="score-val">{{ form.exerciseScore }}</text>
+            </view>
+          </view>
+
+          <view class="score-group">
+            <text class="score-label">睡眠评分</text>
+            <view class="score-row">
+              <text class="score-min">差</text>
+              <slider min="1" max="10" :value="form.sleepScore" @change="function(e){form.sleepScore=e.detail.value}" block-size="20" activeColor="#FF8C42" />
+              <text class="score-val">{{ form.sleepScore }}</text>
+            </view>
+          </view>
+
+          <view class="score-group">
+            <text class="score-label">饮水评分</text>
+            <view class="score-row">
+              <text class="score-min">差</text>
+              <slider min="1" max="10" :value="form.waterScore" @change="function(e){form.waterScore=e.detail.value}" block-size="20" activeColor="#FF8C42" />
+              <text class="score-val">{{ form.waterScore }}</text>
+            </view>
+          </view>
+
+          <view class="score-group">
+            <text class="score-label">心情评分</text>
+            <view class="score-row">
+              <text class="score-min">差</text>
+              <slider min="1" max="10" :value="form.moodScore" @change="function(e){form.moodScore=e.detail.value}" block-size="20" activeColor="#FF8C42" />
+              <text class="score-val">{{ form.moodScore }}</text>
+            </view>
+          </view>
+
+          <view class="form-group">
+            <text class="form-label">备注(选填)</text>
+            <input class="form-input" v-model="form.remark" placeholder="今天的感受..." />
+          </view>
+
+          <view class="submit-btn" @tap="doCheckin">
+            <text>{{ submitting ? '提交中...' : '提交打卡' }}</text>
+          </view>
+        </view>
+      </view>
+
+      <!-- 历史记录 -->
+      <view class="card">
+        <view class="card-accent"></view>
+        <view class="card-body">
+          <text class="card-title">打卡记录</text>
+          <view class="history-list" v-if="history.length > 0">
+            <view class="history-item" v-for="item in history" :key="item.id">
+              <view class="history-left">
+                <text class="history-type">{{ formatDate(item.checkinDate || item.createdAt) }}</text>
+                <text class="history-duration">
+                  饮食{{ item.dietScore || '-' }} 运动{{ item.exerciseScore || '-' }}
+                  睡眠{{ item.sleepScore || '-' }} 饮水{{ item.waterIntake || '-' }}
+                  心情{{ item.moodScore || '-' }}
+                </text>
+              </view>
+              <view class="history-right">
+                <text class="history-date">{{ item.remark || '' }}</text>
+              </view>
+            </view>
+          </view>
+          <view class="empty-state" v-else>
+            <text>还没有打卡记录</text>
+          </view>
+        </view>
+      </view>
+    </scroll-view>
+  </view>
+</template>
+
+<script>
+import config from '@/config.js'
+
+export default {
+  data() {
+    return {
+      memberId: null,
+      submitting: false,
+      history: [],
+      form: {
+        dietScore: 7,
+        exerciseScore: 7,
+        sleepScore: 7,
+        waterScore: 7,
+        moodScore: 7,
+        remark: ''
+      }
+    }
+  },
+  onLoad: function() {
+    this.memberId = uni.getStorageSync('currentChildId') || null
+    this.loadHistory()
+  },
+  methods: {
+    goBack: function() {
+      uni.navigateBack()
+    },
+    formatDate: function(dateStr) {
+      if (!dateStr) return ''
+      var d = new Date(dateStr)
+      var m = (d.getMonth() + 1).toString().padStart(2, '0')
+      var day = d.getDate().toString().padStart(2, '0')
+      return m + '-' + day
+    },
+    loadHistory: function() {
+      var self = this
+      var token = uni.getStorageSync('token')
+      if (!token || !self.memberId) return
+      uni.request({
+        url: config.API_BASE_URL + '/api/daily/checkin/list',
+        method: 'POST',
+        data: { memberId: self.memberId },
+        header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
+        success: function(res) {
+          if (res.data && res.data.code === 200 && res.data.data) {
+            self.history = res.data.data.slice(0, 10)
+          }
+        }
+      })
+    },
+    doCheckin: function() {
+      var self = this
+      if (!self.memberId) {
+        uni.showToast({ title: '孩子ID无效', icon: 'none' })
+        return
+      }
+      self.submitting = true
+      var token = uni.getStorageSync('token')
+      uni.request({
+        url: config.API_BASE_URL + '/api/daily/checkin/create',
+        method: 'POST',
+        data: {
+          memberId: self.memberId,
+          dietScore: self.form.dietScore,
+          exerciseScore: self.form.exerciseScore,
+          sleepScore: self.form.sleepScore,
+          waterIntake: self.form.waterScore,
+          moodScore: self.form.moodScore,
+          remark: self.form.remark || ''
+        },
+        header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
+        success: function(res) {
+          self.submitting = false
+          if (res.data && res.data.code === 200) {
+            uni.showToast({ title: '打卡成功', icon: 'success' })
+            self.form.remark = ''
+            self.loadHistory()
+          } else {
+            var msg = (res.data && res.data.message) || '打卡失败'
+            uni.showToast({ title: msg, icon: 'none' })
+          }
+        },
+        fail: function() {
+          self.submitting = false
+          uni.showToast({ title: '网络错误', icon: 'none' })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.page {
+  min-height: 100vh;
+  background-color: #F5F7FA;
+  display: flex;
+  flex-direction: column;
+}
+.nav-bar {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 88rpx;
+  padding-top: var(--status-bar-height, 0);
+  background-color: #FFFFFF;
+  position: relative;
+  border-bottom: 1rpx solid #f0f0f0;
+}
+.nav-back { position: absolute; left: 30rpx; top: 50%; transform: translateY(-50%); padding: 10rpx; }
+.back-text { font-size: 28rpx; color: #333; }
+.nav-title { font-size: 32rpx; font-weight: 600; color: #333; }
+.content { flex: 1; padding: 30rpx; }
+.card {
+  display: flex; background-color: #FFFFFF; border-radius: 20rpx; margin-bottom: 30rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06); overflow: hidden;
+}
+.card-accent { width: 8rpx; background-color: #FF8C42; flex-shrink: 0; }
+.card-body { flex: 1; padding: 30rpx; }
+.card-title { font-size: 30rpx; font-weight: 600; color: #333; margin-bottom: 8rpx; display: block; }
+.card-subtitle { font-size: 24rpx; color: #999; margin-bottom: 30rpx; display: block; }
+.score-group { margin-bottom: 20rpx; }
+.score-label { font-size: 26rpx; color: #333; font-weight: 500; margin-bottom: 8rpx; display: block; }
+.score-row { display: flex; align-items: center; gap: 16rpx; }
+.score-min { font-size: 22rpx; color: #999; flex-shrink: 0; }
+.score-val { font-size: 24rpx; color: #FF8C42; font-weight: 500; width: 40rpx; text-align: center; }
+.form-group { margin-bottom: 24rpx; }
+.form-label { font-size: 26rpx; color: #333; font-weight: 500; margin-bottom: 12rpx; display: block; }
+.form-input {
+  border: 1rpx solid #ddd; border-radius: 12rpx; padding: 16rpx 20rpx;
+  font-size: 26rpx; background-color: #FAFAFA; width: auto;
+}
+.submit-btn {
+  background-color: #FF8C42; color: #FFFFFF; text-align: center; padding: 22rpx 0;
+  border-radius: 16rpx; font-size: 28rpx; font-weight: 500; margin-top: 10rpx;
+}
+.history-list { display: flex; flex-direction: column; gap: 16rpx; }
+.history-item {
+  display: flex; justify-content: space-between; align-items: center; padding: 16rpx 0;
+  border-bottom: 1rpx solid #f0f0f0;
+}
+.history-left { display: flex; flex-direction: column; gap: 4rpx; }
+.history-type { font-size: 26rpx; font-weight: 500; color: #333; }
+.history-duration { font-size: 22rpx; color: #999; }
+.history-right { text-align: right; max-width: 40%; }
+.history-date { font-size: 22rpx; color: #999; }
+.empty-state { text-align: center; padding: 40rpx 0; font-size: 26rpx; color: #999; }
+</style>

+ 284 - 0
cfc-frontend/pages/health/water-index.vue

@@ -0,0 +1,284 @@
+<template>
+  <view class="page">
+    <view class="nav-bar">
+      <view class="nav-back" @tap="goBack">
+        <text class="back-text">‹ 返回</text>
+      </view>
+      <text class="nav-title">饮水</text>
+    </view>
+
+    <scroll-view class="content" scroll-y>
+      <view class="card">
+        <view class="card-accent"></view>
+        <view class="card-body">
+          <text class="card-title">每日饮水建议</text>
+          <view class="info-list">
+            <view class="info-item">
+              <text class="info-age">3-6 岁</text>
+              <text class="info-desc">每天 600-800ml,少量多次,以白开水为主,避免含糖饮料。</text>
+            </view>
+            <view class="info-item">
+              <text class="info-age">7-12 岁</text>
+              <text class="info-desc">每天 800-1200ml,运动后适当增加,养成定时饮水习惯。</text>
+            </view>
+            <view class="info-item">
+              <text class="info-age">13-18 岁</text>
+              <text class="info-desc">每天 1200-1500ml,根据活动量和季节调整,保持尿液呈淡黄色。</text>
+            </view>
+          </view>
+        </view>
+      </view>
+
+      <view class="card">
+        <view class="card-accent"></view>
+        <view class="card-body">
+          <text class="card-title">科学饮水提示</text>
+          <view class="info-list">
+            <view class="info-item">
+              <text class="info-age">晨起一杯水</text>
+              <text class="info-desc">起床后喝一杯温水(约200ml),补充夜间水分流失,促进肠胃蠕动。</text>
+            </view>
+            <view class="info-item">
+              <text class="info-age">餐前半小时</text>
+              <text class="info-desc">餐前喝少量水增加饱腹感,餐后1小时再喝水,避免稀释胃液影响消化。</text>
+            </view>
+            <view class="info-item">
+              <text class="info-age">运动前后</text>
+              <text class="info-desc">运动前喝200ml,运动中每15-20分钟补充100-150ml,运动后逐步补充。</text>
+            </view>
+          </view>
+        </view>
+      </view>
+
+      <!-- 记录饮水表单 -->
+      <view class="card">
+        <view class="card-accent"></view>
+        <view class="card-body">
+          <text class="card-title">记录饮水</text>
+          <view class="form-group">
+            <text class="form-label">饮水量(毫升)*</text>
+            <view class="amount-row">
+              <view class="amount-btn" v-for="a in quickAmounts" :key="a.ml"
+                :class="form.amountMl === a.ml ? 'amount-active' : ''"
+                @tap="form.amountMl = a.ml">
+                <text class="amount-num">{{ a.ml }}</text>
+                <text class="amount-unit">ml</text>
+              </view>
+            </view>
+            <input class="form-input" type="number" v-model="form.amountMl" placeholder="或手动输入毫升数" />
+          </view>
+          <view class="form-group">
+            <text class="form-label">饮水类型</text>
+            <view class="tag-row">
+              <view class="tag-btn" v-for="t in waterTypes" :key="t.value"
+                :class="form.waterType === t.value ? 'tag-active' : ''"
+                @tap="form.waterType = t.value">
+                <text>{{ t.label }}</text>
+              </view>
+            </view>
+          </view>
+          <view class="submit-btn" @tap="doCheckin">
+            <text>{{ submitting ? '提交中...' : '提交打卡' }}</text>
+          </view>
+        </view>
+      </view>
+
+      <!-- 历史记录 -->
+      <view class="card">
+        <view class="card-accent"></view>
+        <view class="card-body">
+          <text class="card-title">饮水记录</text>
+          <view class="history-list" v-if="history.length > 0">
+            <view class="history-item" v-for="item in history" :key="item.id">
+              <view class="history-left">
+                <text class="history-type">{{ item.amountMl || 0 }}ml</text>
+                <text class="history-duration">{{ item.waterType || '白水' }}</text>
+              </view>
+              <view class="history-right">
+                <text class="history-date">{{ formatDate(item.createdAt) }}</text>
+              </view>
+            </view>
+          </view>
+          <view class="empty-state" v-else>
+            <text>还没有饮水记录</text>
+          </view>
+        </view>
+      </view>
+    </scroll-view>
+  </view>
+</template>
+
+<script>
+import config from '@/config.js'
+
+export default {
+  data() {
+    return {
+      memberId: null,
+      submitting: false,
+      history: [],
+      quickAmounts: [
+        { ml: 100 }, { ml: 200 }, { ml: 300 }, { ml: 500 }
+      ],
+      waterTypes: [
+        { label: '白开水', value: 'plain' },
+        { label: '矿泉水', value: 'sparkling' },
+        { label: '茶水', value: 'tea' },
+        { label: '其他', value: 'other' }
+      ],
+      form: {
+        amountMl: 200,
+        waterType: 'plain'
+      }
+    }
+  },
+  onLoad: function() {
+    this.memberId = uni.getStorageSync('currentChildId') || null
+    this.loadHistory()
+  },
+  methods: {
+    goBack: function() {
+      uni.navigateBack()
+    },
+    formatDate: function(dateStr) {
+      if (!dateStr) return ''
+      var d = new Date(dateStr)
+      var m = (d.getMonth() + 1).toString().padStart(2, '0')
+      var day = d.getDate().toString().padStart(2, '0')
+      return m + '-' + day
+    },
+    loadHistory: function() {
+      var self = this
+      var token = uni.getStorageSync('token')
+      if (!token || !self.memberId) return
+      uni.request({
+        url: config.API_BASE_URL + '/api/health/water/list',
+        method: 'POST',
+        data: { memberId: self.memberId },
+        header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
+        success: function(res) {
+          if (res.data && res.data.code === 200 && res.data.data) {
+            self.history = res.data.data.slice(0, 10)
+          }
+        }
+      })
+    },
+    doCheckin: function() {
+      var self = this
+      var amount = parseInt(self.form.amountMl)
+      if (!amount || amount <= 0) {
+        uni.showToast({ title: '请输入有效饮水量', icon: 'none' })
+        return
+      }
+      if (!self.memberId) {
+        uni.showToast({ title: '孩子ID无效', icon: 'none' })
+        return
+      }
+      self.submitting = true
+      var token = uni.getStorageSync('token')
+      uni.request({
+        url: config.API_BASE_URL + '/api/health/water/create',
+        method: 'POST',
+        data: {
+          memberId: self.memberId,
+          amountMl: amount,
+          waterType: self.form.waterType || 'plain'
+        },
+        header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
+        success: function(res) {
+          self.submitting = false
+          if (res.data && res.data.code === 200) {
+            uni.showToast({ title: '打卡成功', icon: 'success' })
+            self.form.amountMl = 200
+            self.form.waterType = 'plain'
+            self.loadHistory()
+          } else {
+            var msg = (res.data && res.data.message) || '打卡失败'
+            uni.showToast({ title: msg, icon: 'none' })
+          }
+        },
+        fail: function() {
+          self.submitting = false
+          uni.showToast({ title: '网络错误', icon: 'none' })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.page {
+  min-height: 100vh;
+  background-color: #F5F7FA;
+  display: flex;
+  flex-direction: column;
+}
+.nav-bar {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 88rpx;
+  padding-top: var(--status-bar-height, 0);
+  background-color: #FFFFFF;
+  position: relative;
+  border-bottom: 1rpx solid #f0f0f0;
+}
+.nav-back {
+  position: absolute;
+  left: 30rpx;
+  top: 50%;
+  transform: translateY(-50%);
+  padding: 10rpx;
+}
+.back-text { font-size: 28rpx; color: #333; }
+.nav-title { font-size: 32rpx; font-weight: 600; color: #333; }
+.content { flex: 1; padding: 30rpx; }
+.card {
+  display: flex;
+  background-color: #FFFFFF;
+  border-radius: 20rpx;
+  margin-bottom: 30rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
+  overflow: hidden;
+}
+.card-accent { width: 8rpx; background-color: #FF8C42; flex-shrink: 0; }
+.card-body { flex: 1; padding: 30rpx; }
+.card-title { font-size: 30rpx; font-weight: 600; color: #333; margin-bottom: 24rpx; display: block; }
+.info-list { display: flex; flex-direction: column; gap: 20rpx; }
+.info-item { display: flex; flex-direction: column; gap: 6rpx; }
+.info-age { font-size: 26rpx; font-weight: 500; color: #FF8C42; display: block; }
+.info-desc { font-size: 24rpx; color: #666; line-height: 1.6; display: block; }
+.form-group { margin-bottom: 24rpx; }
+.form-label { font-size: 26rpx; color: #333; font-weight: 500; margin-bottom: 12rpx; display: block; }
+.form-input { border: 1rpx solid #ddd; border-radius: 12rpx; padding: 16rpx 20rpx; font-size: 26rpx; background-color: #FAFAFA; width: auto; }
+.amount-row { display: flex; gap: 16rpx; margin-bottom: 16rpx; }
+.amount-btn {
+  flex: 1; text-align: center; padding: 16rpx 0; border: 1rpx solid #ddd; border-radius: 12rpx;
+  background-color: #FAFAFA;
+}
+.amount-active { border-color: #FF8C42; color: #FF8C42; background-color: #FFF5EB; }
+.amount-num { font-size: 28rpx; font-weight: 600; display: block; }
+.amount-unit { font-size: 20rpx; color: #999; display: block; }
+.tag-row { display: flex; flex-wrap: wrap; gap: 16rpx; }
+.tag-btn {
+  padding: 12rpx 24rpx; border: 1rpx solid #ddd; border-radius: 30rpx;
+  font-size: 24rpx; color: #666; background-color: #FAFAFA;
+}
+.tag-active { border-color: #FF8C42; color: #FF8C42; background-color: #FFF5EB; }
+.submit-btn {
+  background-color: #FF8C42; color: #FFFFFF; text-align: center; padding: 22rpx 0;
+  border-radius: 16rpx; font-size: 28rpx; font-weight: 500; margin-top: 10rpx;
+}
+.history-list { display: flex; flex-direction: column; gap: 16rpx; }
+.history-item {
+  display: flex; justify-content: space-between; align-items: center; padding: 16rpx 0;
+  border-bottom: 1rpx solid #f0f0f0;
+}
+.history-left { display: flex; flex-direction: column; gap: 4rpx; }
+.history-type { font-size: 26rpx; font-weight: 500; color: #333; }
+.history-duration { font-size: 22rpx; color: #999; }
+.history-right { text-align: right; }
+.history-date { font-size: 22rpx; color: #999; }
+.empty-state { text-align: center; padding: 40rpx 0; font-size: 26rpx; color: #999; }
+</style>

+ 3 - 3
cfc-web/src/router/index.js

@@ -497,9 +497,9 @@ const routes = [
       },
       {
         path: 'health-checkins',
-        name: 'HealthCheckins',
-        component: () => import('@/views/nutritionist/HealthCheckins.vue'),
-        meta: { title: '健康打卡', perm: 'health:checkins' }
+        name: 'HealthCheckinManage',
+        component: () => import('@/views/admin/HealthCheckinManage.vue'),
+        meta: { title: '健康打卡管理', perm: 'health:checkins' }
       },
       {
         path: 'emotion-alert',

+ 124 - 0
cfc-web/src/views/admin/HealthCheckinManage.vue

@@ -0,0 +1,124 @@
+<template>
+  <div class="health-checkins admin-page">
+    <el-card>
+      <div slot="header" class="admin-page-header">
+        <span class="admin-page-title">健康打卡管理</span>
+        <div class="filter-bar">
+          <el-input
+            v-model="keyword"
+            placeholder="搜索孩子名..."
+            prefix-icon="el-icon-search"
+            clearable
+            style="width: 200px; margin-right: 10px;"
+            @keyup.enter.native="loadList"
+            @clear="loadList"
+          />
+          <el-select v-model="moodFilter" placeholder="心情" clearable @change="loadList" style="width: 120px; margin-right: 10px;">
+            <el-option label="全部心情" value="" />
+            <el-option label="开心" value="happy" />
+            <el-option label="平静" value="normal" />
+            <el-option label="低落" value="sad" />
+            <el-option label="烦躁" value="angry" />
+            <el-option label="不适" value="sick" />
+          </el-select>
+          <el-button type="primary" icon="el-icon-refresh" @click="loadList">刷新</el-button>
+        </div>
+      </div>
+
+      <el-table :data="list" v-loading="loading" border stripe empty-text="暂无打卡记录" :max-height="tableHeight">
+        <el-table-column prop="id" label="ID" width="70" />
+        <el-table-column label="孩子" width="100">
+          <template slot-scope="{ row }">{{ row.childName || '-' }}</template>
+        </el-table-column>
+        <el-table-column label="打卡日期" width="110">
+          <template slot-scope="{ row }">{{ formatDate(row.checkinDate) }}</template>
+        </el-table-column>
+        <el-table-column label="心情" width="80">
+          <template slot-scope="{ row }">
+            <el-tag :type="moodTagType(row.mood)" size="mini">{{ moodLabel(row.mood) }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="行为" min-width="200" show-overflow-tooltip>
+          <template slot-scope="{ row }">{{ row.behaviors || '-' }}</template>
+        </el-table-column>
+        <el-table-column label="能量" width="70" prop="earnedEnergy" />
+        <el-table-column label="备注" min-width="160" show-overflow-tooltip prop="note" />
+        <el-table-column label="打卡时间" width="160">
+          <template slot-scope="{ row }">{{ formatTime(row.createdAt) }}</template>
+        </el-table-column>
+      </el-table>
+    </el-card>
+  </div>
+</template>
+
+<script>
+import axios from 'axios'
+
+export default {
+  name: 'HealthCheckinManage',
+  data() {
+    return {
+      loading: false,
+      list: [],
+      keyword: '',
+      moodFilter: ''
+    }
+  },
+  computed: {
+    tableHeight() {
+      return window.innerHeight - 280
+    }
+  },
+  created() {
+    this.loadList()
+  },
+  methods: {
+    formatDate(d) {
+      if (!d) return '-'
+      var date = new Date(d)
+      return date.getFullYear() + '-' + (date.getMonth() + 1).toString().padStart(2, '0') + '-' + date.getDate().toString().padStart(2, '0')
+    },
+    formatTime(d) {
+      if (!d) return '-'
+      var date = new Date(d)
+      return date.getFullYear() + '-' + (date.getMonth() + 1).toString().padStart(2, '0') + '-' + date.getDate().toString().padStart(2, '0') + ' ' + date.getHours().toString().padStart(2, '0') + ':' + date.getMinutes().toString().padStart(2, '0')
+    },
+    moodLabel(m) {
+      var map = { happy: '开心', normal: '平静', sad: '低落', angry: '烦躁', sick: '不适' }
+      return map[m] || m || '-'
+    },
+    moodTagType(m) {
+      var map = { happy: 'success', normal: 'info', sad: 'warning', angry: 'danger', sick: 'danger' }
+      return map[m] || 'info'
+    },
+    async loadList() {
+      this.loading = true
+      try {
+        var baseURL = process.env.VUE_APP_BASE_API || ''
+        var token = localStorage.getItem('token')
+        var res = await axios.post(baseURL + '/api/health/checkin/list', {
+          keyword: this.keyword,
+          mood: this.moodFilter
+        }, {
+          headers: { Authorization: 'Bearer ' + token }
+        })
+        this.list = (res.data && res.data.data) || []
+      } catch (e) {
+        this.$message.error('加载健康打卡记录失败')
+      } finally {
+        this.loading = false
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.health-checkins {
+  padding: 20px;
+}
+.filter-bar {
+  display: flex;
+  align-items: center;
+}
+</style>