index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <template>
  2. <view class="container">
  3. <view v-if="!isLoggedIn">
  4. <!-- 品牌定位语 -->
  5. <view class="brand-strap"><text class="brand-strap-text">看见改变正在发生</text></view>
  6. <!-- 理念卡 -->
  7. <view class="concept-card">
  8. <text class="concept-quote">记录不是目的,看见改变才是。</text>
  9. <text class="concept-desc">每一份饮食、运动、心情的记录,都在为成长提供依据。</text>
  10. </view>
  11. <!-- 示例案例 -->
  12. <view class="case-card">
  13. <view class="case-header">
  14. <text class="case-label">📖 真实案例(脱敏)</text>
  15. </view>
  16. <view class="case-body">
  17. <text class="case-name">小明(10岁,体校生)</text>
  18. <text class="case-change">3个月干预前后:</text>
  19. <view class="case-metrics">
  20. <view class="metric-item">
  21. <text class="metric-up">↑ 5分</text>
  22. <text class="metric-label">身维度</text>
  23. </view>
  24. <view class="metric-item">
  25. <text class="metric-up">↑ 3分</text>
  26. <text class="metric-label">智维度</text>
  27. </view>
  28. <view class="metric-item">
  29. <text class="metric-up">↑ 8天</text>
  30. <text class="metric-label">连续打卡</text>
  31. </view>
  32. </view>
  33. <text class="case-note">通过饮食记录 + 睡眠打卡,免疫力显著提升</text>
  34. </view>
  35. </view>
  36. <!-- 功能预览 -->
  37. <view class="guest-features">
  38. <view class="feat-card" @click="handleGuestFeatureTap">
  39. <text class="feat-icon">✅</text>
  40. <text class="feat-title">每日打卡</text>
  41. <text class="feat-desc">饮食·运动·睡眠·心情</text>
  42. </view>
  43. <view class="feat-card" @click="handleGuestFeatureTap">
  44. <text class="feat-icon">🏆</text>
  45. <text class="feat-title">里程碑</text>
  46. <text class="feat-desc">连续打卡·挑战完成</text>
  47. </view>
  48. <view class="feat-card" @click="handleGuestFeatureTap">
  49. <text class="feat-icon">🎯</text>
  50. <text class="feat-title">家庭挑战</text>
  51. <text class="feat-desc">全家参与的互动任务</text>
  52. </view>
  53. <view class="feat-card" @click="handleGuestFeatureTap">
  54. <text class="feat-icon">📋</text>
  55. <text class="feat-title">任务中心</text>
  56. <text class="feat-desc">执行任务·完成挑战</text>
  57. </view>
  58. </view>
  59. <!-- 五维健康体系 -->
  60. <view class="wuxing-section">
  61. <view class="wuxing-title">身·心·智·行·富 · 可执行的成长闭环</view>
  62. <view class="wuxing-desc">五行相生相克,动起来、坚持做,让成长真正发生</view>
  63. <view class="wuxing-relations">
  64. <view class="rel-group">
  65. <text class="rel-title">相生 → 系统前进</text>
  66. <view class="rel-chain">
  67. <text class="rel-item">🌏 身</text><text class="rel-arrow">→</text>
  68. <text class="rel-item">⚡ 智</text><text class="rel-arrow">→</text>
  69. <text class="rel-item">💧 富</text><text class="rel-arrow">→</text>
  70. <text class="rel-item">🌿 行</text><text class="rel-arrow">→</text>
  71. <text class="rel-item">🔥 心</text><text class="rel-arrow">→</text>
  72. <text class="rel-item">🌏 身</text>
  73. </view>
  74. <text class="rel-hint">身勤则强,智勤则开,富勤则聚,行勤则和,心勤则安</text>
  75. </view>
  76. <view class="rel-group">
  77. <text class="rel-title">相克 → 系统平衡</text>
  78. <view class="rel-chain">
  79. <text class="rel-item">🌏 身</text><text class="rel-op">克</text><text class="rel-item">💧 富</text><text class="rel-dot">·</text>
  80. <text class="rel-item">⚡ 智</text><text class="rel-op">克</text><text class="rel-item">🌿 行</text><text class="rel-dot">·</text>
  81. <text class="rel-item">💧 富</text><text class="rel-op">克</text><text class="rel-item">🔥 心</text><text class="rel-dot">·</text>
  82. <text class="rel-item">🌿 行</text><text class="rel-op">克</text><text class="rel-item">🌏 身</text><text class="rel-dot">·</text>
  83. <text class="rel-item">🔥 心</text><text class="rel-op">克</text><text class="rel-item">⚡ 智</text>
  84. </view>
  85. <text class="rel-hint">不拿身体换快钱,不算计关系得失,财富服务家庭,关爱有度、不溺爱越界</text>
  86. </view>
  87. </view>
  88. <view class="wuxing-cards">
  89. <view class="wc-card wc-body" @click="goPage('/pages/body-detail/index')">
  90. <text class="wc-icon">🌏</text>
  91. <view class="wc-info">
  92. <text class="wc-name">身 · 主动健康</text>
  93. <text class="wc-text">每天动一动、睡得香,身体状态看得见地变好</text>
  94. </view>
  95. </view>
  96. <view class="wc-card wc-wisdom" @click="goPage('/pages/wisdom-detail/index')">
  97. <text class="wc-icon">⚡</text>
  98. <view class="wc-info">
  99. <text class="wc-name">智 · 赋能未来</text>
  100. <text class="wc-text">每天读几页、练一会专注,智慧是练出来的</text>
  101. </view>
  102. </view>
  103. <view class="wc-card wc-wealth" @click="goPage('/pages/wealth/index')">
  104. <text class="wc-icon">💧</text>
  105. <view class="wc-info">
  106. <text class="wc-name">富 · 利他创富</text>
  107. <text class="wc-text">坚持分享与积累,把第二收入曲线做出来</text>
  108. </view>
  109. </view>
  110. <view class="wc-card wc-action" @click="goPage('/pages/action-detail/member-action-detail')">
  111. <text class="wc-icon">🌿</text>
  112. <view class="wc-info">
  113. <text class="wc-name">行 · 人际和谐</text>
  114. <text class="wc-text">从一次倾听开始,让家庭关系每天升温</text>
  115. </view>
  116. </view>
  117. <view class="wc-card wc-mind" @click="goPage('/pages/mind-detail/index')">
  118. <text class="wc-icon">🔥</text>
  119. <view class="wc-info">
  120. <text class="wc-name">心 · 大爱相随</text>
  121. <text class="wc-text">每天留 10 分钟说说话,把家人的心事接住</text>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. <!-- 登录引导 -->
  127. <view class="login-guide-section">
  128. <LoginGuideCard
  129. title="解锁完整成长档案"
  130. :items="[
  131. '查看干预进度与追踪记录',
  132. '完成每日打卡累积连续记录',
  133. '参与家庭挑战获得里程碑奖励'
  134. ]" />
  135. </view>
  136. </view>
  137. <view v-else>
  138. <view class="reminder-bar" v-if="hasIncomplete">
  139. <text class="reminder-text">⚠ 今日还有 {{ incompleteCount }} 项未记录</text>
  140. <text class="reminder-close" @click="dismissReminder">✕</text>
  141. </view>
  142. <!-- 里程碑(最上) -->
  143. <view class="section">
  144. <view class="milestone-card">
  145. <text class="section-title-row">🏆 里程碑</text>
  146. <view class="milestone-grid">
  147. <view class="milestone-item">
  148. <text class="milestone-icon">🔥</text>
  149. <text class="milestone-value">{{ streakDays }}天</text>
  150. <text class="milestone-label">连续打卡</text>
  151. </view>
  152. <view class="milestone-item">
  153. <text class="milestone-icon">🎯</text>
  154. <text class="milestone-value">{{ activeChallenges }}</text>
  155. <text class="milestone-label">进行中挑战</text>
  156. </view>
  157. <view class="milestone-item">
  158. <text class="milestone-icon">📈</text>
  159. <text class="milestone-value">{{ completeness }}%</text>
  160. <text class="milestone-label">档案完整度</text>
  161. </view>
  162. </view>
  163. </view>
  164. </view>
  165. <!-- 健康报告状态卡片 -->
  166. <view class="section" v-if="reportStatus.hasReport">
  167. <view class="report-card" @click="goToReport">
  168. <view class="report-left">
  169. <text class="report-icon">📋</text>
  170. <view class="report-info">
  171. <text class="report-title">已有健康报告</text>
  172. <text class="report-desc" v-if="reportStatus.reportType === 'gut_flora'">肠道菌群检测 · {{ reportStatus.reportDate }}</text>
  173. <text class="report-desc" v-else-if="reportStatus.reportType === 'physical_exam'">体检报告 · {{ reportStatus.reportDate }}</text>
  174. <text class="report-desc" v-else>健康报告 · {{ reportStatus.reportDate }}</text>
  175. <text class="report-score" v-if="reportStatus.overallScore">综合评分:{{ reportStatus.overallScore }}分</text>
  176. </view>
  177. </view>
  178. <text class="report-arrow">›</text>
  179. </view>
  180. </view>
  181. <view class="section" v-else>
  182. <view class="report-upload-card" @click="goToUploadReport">
  183. <view class="report-upload-left">
  184. <text class="report-upload-icon">📷</text>
  185. <view class="report-upload-info">
  186. <text class="report-upload-title">上传健康报告</text>
  187. <text class="report-upload-desc">上传体检或菌群检测报告,获取个性化营养方案</text>
  188. </view>
  189. </view>
  190. <text class="report-upload-arrow">›</text>
  191. </view>
  192. </view>
  193. <!-- 今日成长 -->
  194. <view class="section">
  195. <view class="progress-card">
  196. <view class="progress-header">
  197. <text class="progress-title">今日成长</text>
  198. <text class="progress-date">{{ todayDate }}</text>
  199. </view>
  200. <view class="progress-grid" v-if="progressItems.length > 0">
  201. <view class="progress-grid-item" v-for="(item, idx) in progressItems" :key="getProgressKey(item)" @click="handleProgressClick(item)">
  202. <text class="progress-grid-icon">{{ item.icon }}</text>
  203. <text class="progress-grid-label">{{ item.label }}</text>
  204. <text class="progress-grid-status" :class="item.done ? 'status-done' : 'status-pending'">{{ item.done ? '✔' : (item.actionText || '去记录') }}</text>
  205. </view>
  206. </view>
  207. <view class="progress-footer">
  208. <text class="footer-text">今日完成 {{ doneCount }}/{{ totalCount }}</text>
  209. <text class="footer-streak" v-if="streakDays > 0">🔥 连续打卡 {{ streakDays }} 天</text>
  210. </view>
  211. </view>
  212. </view>
  213. <view class="section" v-if="cautionCount > 0">
  214. <view class="action-card" @click="goToCaution">
  215. <text class="action-icon">⚠️</text>
  216. <view class="action-info">
  217. <text class="action-title">食材戒备匹配</text>
  218. <text class="action-desc">{{ cautionCount }} 种食材需关注,点击查看戒备详情</text>
  219. </view>
  220. <text class="action-arrow">›</text>
  221. </view>
  222. </view>
  223. <!-- 饮食推荐 -->
  224. <view class="section">
  225. <view class="action-card" @click="goToFoods">
  226. <text class="action-icon">🍽️</text>
  227. <view class="action-info">
  228. <text class="action-title">饮食推荐</text>
  229. <text class="action-desc">基于菌群报告的个性化食材建议</text>
  230. </view>
  231. <text class="action-arrow">›</text>
  232. </view>
  233. </view>
  234. <!-- 任务中心 -->
  235. <view class="section">
  236. <view class="action-card" @click="goToTasks">
  237. <text class="action-icon">📋</text>
  238. <view class="action-info">
  239. <text class="action-title">任务中心</text>
  240. <text class="action-desc">查看今日待办任务,完成挑战获取奖励</text>
  241. </view>
  242. <text class="action-arrow">›</text>
  243. </view>
  244. </view>
  245. <DimensionActivities :isLoggedIn="true" @activityClick="goActivityDetail" @moreActivities="goMoreActivities" style="margin-bottom:60rpx" />
  246. <!-- 今日任务 -->
  247. <DailyTaskCard v-if="isLoggedIn" />
  248. <!-- 报告上传 -->
  249. <view class="section">
  250. <view class="action-card" @click="goToUploadReport">
  251. <text class="action-icon">📷</text>
  252. <view class="action-info">
  253. <text class="action-title">上传报告</text>
  254. <text class="action-desc">体检报告 · 菌群检测 · 认知测评 · 心理测评 · 情绪打卡</text>
  255. </view>
  256. <text class="action-arrow">›</text>
  257. </view>
  258. </view>
  259. <!-- 推荐阅读 -->
  260. <view class="section" v-if="recommendArticles.length > 0">
  261. <view class="section-header">
  262. <text class="section-title">📖 推荐阅读</text>
  263. <text class="section-more" @click="goMoreArticles">更多 ›</text>
  264. </view>
  265. <ArticleBookshelf :articles="recommendArticles" :isLoggedIn="true" @articleClick="goToArticle" />
  266. </view>
  267. <!-- 推荐商品(放最底部) -->
  268. <view class="section">
  269. <view class="section-header">
  270. <text class="section-title">🛍️ 推荐商品</text>
  271. <text class="section-more" @click="goMoreProducts">更多 ›</text>
  272. </view>
  273. <DimensionProducts :isLoggedIn="true" :showMore="false" @productClick="goToProduct" />
  274. </view>
  275. <view class="bottom-spacer" style="height: 40rpx;"></view>
  276. </view>
  277. </view>
  278. </template>
  279. <script>
  280. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  281. import DimensionActivities from '../../components/DimensionActivities.vue'
  282. import DimensionProducts from '../../components/DimensionProducts.vue'
  283. import ArticleBookshelf from '../../components/ArticleBookshelf.vue'
  284. import DailyTaskCard from '../../components/daily-task-card.vue'
  285. import { healthCheckinList, getHealthMealList, getFoodCautionList, getGrowthRecommendations, getExerciseRecords, getSleepRecords, getEmotionCheckinList, getCheckinList, getLatestHealthReport } from '../../utils/api.js'
  286. import { parseDate } from '../../utils/format.js'
  287. export default {
  288. components: { LoginGuideCard, DimensionActivities, DimensionProducts, ArticleBookshelf, DailyTaskCard },
  289. data() { return { memberId: '', todayDate: '', hasIncomplete: false, incompleteCount: 0, progressItems: [], streakDays: 0, activeChallenges: 0, completeness: 0, cautionCount: 0,
  290. healthArticles: [],
  291. growthArticles: [],
  292. isLoggedIn: false,
  293. reportStatus: { hasReport: false, reportId: null, reportType: '', reportDate: '', overallScore: null } } },
  294. computed: {
  295. doneCount: function() { var c = 0; for (var i = 0; i < this.progressItems.length; i++) if (this.progressItems[i] && this.progressItems[i].done) c++; return c },
  296. totalCount: function() { return this.progressItems.length },
  297. recommendArticles: function() {
  298. var arr = []
  299. if (this.healthArticles && this.healthArticles.length > 0) arr = arr.concat(this.healthArticles)
  300. if (this.growthArticles && this.growthArticles.length > 0) arr = arr.concat(this.growthArticles)
  301. return arr
  302. }
  303. },
  304. onShow() {
  305. this.isLoggedIn = !!uni.getStorageSync('token')
  306. if (this.isLoggedIn) {
  307. this.memberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || uni.getStorageSync('userId') || ''
  308. var now = new Date()
  309. this.todayDate = now.getFullYear() + '-' + this.pad(now.getMonth() + 1) + '-' + this.pad(now.getDate())
  310. this.loadAllData()
  311. }
  312. },
  313. methods: {
  314. pad: function(n) { return n < 10 ? '0' + n : '' + n },
  315. getProgressKey: function(item) { return item && item.label ? item.label : 'p-' + Math.random() },
  316. dismissReminder: function() { this.hasIncomplete = false },
  317. handleProgressClick: function(item) {
  318. if (!item || !item.key) return
  319. var m = { diet: '/pages/growth/diet-checkin', exercise: '/pages/growth/exercise-checkin', sleep: '/pages/growth/sleep-checkin', emotion: '/pages/growth/growth-emotion-checkin', checkin: '/pages/wealth-sub/checkin' }
  320. var url = m[item.key]
  321. if (url) uni.navigateTo({ url: url })
  322. },
  323. goToReport: function() {
  324. if (this.reportStatus.reportId) uni.navigateTo({ url: '/pages/health/report-detail?id=' + this.reportStatus.reportId })
  325. },
  326. goToUploadReport: function() {
  327. var id = this.memberId || ''
  328. uni.navigateTo({ url: '/pages/health/report-upload?memberId=' + id + '&from=growth' })
  329. },
  330. goActivityDetail: function(act) { uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id }) },
  331. goMoreActivities: function() { uni.navigateTo({ url: '/pages/activity/index' }) },
  332. goToTasks: function() { uni.navigateTo({ url: '/pages/child/tasks' }) },
  333. handleGuestFeatureTap: function() { uni.showToast({ title: '登录后即可体验该功能', icon: 'none' }) },
  334. goToCaution: function() { uni.navigateTo({ url: '/pages/growth/caution-detail' }) },
  335. goToFoods: function() { uni.navigateTo({ url: '/pages/growth/foods-detail' }) },
  336. goToArticle: function(article) { var id = article && article.id ? article.id : article; if (!id) return; uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id }) },
  337. goToProduct: function(prod) { var id = prod && prod.id ? prod.id : prod; if (!id) return; uni.navigateTo({ url: '/pages/shop/detail/detail?id=' + id }) },
  338. goMoreProducts: function() { uni.navigateTo({ url: '/pages/shop/index/index' }) },
  339. goMoreArticles: function() { uni.navigateTo({ url: '/pages/article-center/index?dimension=action' }) },
  340. goPage: function(url) { uni.navigateTo({ url: url }) },
  341. formatDateKey: function(dateVal) {
  342. if (!dateVal) return ''
  343. var d = parseDate(dateVal)
  344. if (!d) return ''
  345. return d.getFullYear() + '-' + this.pad(d.getMonth() + 1) + '-' + this.pad(d.getDate())
  346. },
  347. formatRecordDate: function(dateVal) {
  348. if (!dateVal) return ''
  349. var d = parseDate(dateVal)
  350. if (!d) return ''
  351. return this.pad(d.getMonth() + 1) + '-' + this.pad(d.getDate())
  352. },
  353. mealTypeLabel: function(type) {
  354. var m = { breakfast: '早餐', lunch: '午餐', dinner: '晚餐', snack: '加餐', extra: '零食' }
  355. return m[type] || type || '饮食'
  356. },
  357. async loadAllData() {
  358. var self = this
  359. try { await self.loadReportStatus() } catch(e) {}
  360. try { await self.loadProgressItems() } catch(e) {}
  361. try { await self.loadCautionData() } catch(e) {}
  362. try { await self.loadGrowthRecommendations() } catch(e) {}
  363. try { await self.loadMilestones() } catch(e) {}
  364. },
  365. async loadReportStatus() {
  366. var self = this
  367. if (!self.memberId) return
  368. try {
  369. var res = await getLatestHealthReport(self.memberId)
  370. if (res.code === 200 && res.data) {
  371. var r = res.data
  372. self.reportStatus = {
  373. hasReport: true,
  374. reportId: r.id,
  375. reportType: r.reportType || '',
  376. reportDate: r.reportDate ? r.reportDate.substring(0, 10) : '',
  377. overallScore: r.overallScore || null
  378. }
  379. } else {
  380. self.reportStatus = { hasReport: false, reportId: null, reportType: '', reportDate: '', overallScore: null }
  381. }
  382. } catch(e) {
  383. self.reportStatus = { hasReport: false, reportId: null, reportType: '', reportDate: '', overallScore: null }
  384. }
  385. },
  386. async loadProgressItems() {
  387. var self = this
  388. var items = []
  389. var dietDone = false
  390. try {
  391. var dParams = self.memberId ? { memberId: self.memberId } : {}
  392. var dRes = await getHealthMealList(dParams)
  393. var dList = (dRes.code === 200 && dRes.data) ? dRes.data : []
  394. for (var di = 0; di < dList.length; di++) {
  395. var dr = dList[di]
  396. if (!dr) continue
  397. if (self.formatDateKey(dr.createdAt || dr.recordDate) === self.todayDate) dietDone = true
  398. }
  399. } catch(e) {}
  400. items.push({ key: 'diet', icon: '🍽️', label: '饮食记录', done: dietDone, actionText: '补录' })
  401. var exerciseDone = false
  402. try {
  403. var eParams = self.memberId ? { memberId: self.memberId } : {}
  404. var eRes = await getExerciseRecords(eParams)
  405. var eList = (eRes.code === 200 && eRes.data) ? eRes.data : []
  406. for (var ei = 0; ei < eList.length; ei++) {
  407. var er = eList[ei]
  408. if (!er) continue
  409. if (self.formatDateKey(er.startTime || er.createdAt) === self.todayDate) exerciseDone = true
  410. }
  411. } catch(e) {}
  412. items.push({ key: 'exercise', icon: '🏃', label: '运动记录', done: exerciseDone, actionText: '记录' })
  413. var sleepDone = false
  414. try {
  415. var sParams = self.memberId ? { memberId: self.memberId } : {}
  416. var sRes = await getSleepRecords(sParams)
  417. var sList = (sRes.code === 200 && sRes.data) ? sRes.data : []
  418. for (var si = 0; si < sList.length; si++) {
  419. var sr = sList[si]
  420. if (!sr) continue
  421. if (self.formatDateKey(sr.sleepTime || sr.createdAt) === self.todayDate) sleepDone = true
  422. }
  423. } catch(e) {}
  424. items.push({ key: 'sleep', icon: '😴', label: '睡眠记录', done: sleepDone, actionText: '记录' })
  425. var emotionDone = false
  426. try {
  427. var mParams = { page: 1, size: 10 }
  428. if (self.memberId) mParams.memberId = self.memberId
  429. var mRes = await getEmotionCheckinList(mParams)
  430. var mList = (mRes.code === 200 && mRes.data) ? mRes.data : []
  431. for (var mi = 0; mi < mList.length; mi++) {
  432. var mr = mList[mi]
  433. if (!mr) continue
  434. if (self.formatDateKey(mr.checkinDate || mr.createdAt) === self.todayDate) emotionDone = true
  435. }
  436. } catch(e) {}
  437. items.push({ key: 'emotion', icon: '😊', label: '心情记录', done: emotionDone, actionText: '记录' })
  438. var checkinDone = false
  439. try {
  440. var cParams = self.memberId ? { memberId: self.memberId } : {}
  441. var cRes = await getCheckinList(cParams)
  442. var cList = (cRes.code === 200 && cRes.data) ? cRes.data : []
  443. for (var ci = 0; ci < cList.length; ci++) {
  444. if (cList[ci] && cList[ci].checkinDate && cList[ci].checkinDate.indexOf(self.todayDate) === 0) {
  445. checkinDone = true
  446. break
  447. }
  448. }
  449. } catch(e) {}
  450. items.push({ key: 'checkin', icon: '💰', label: '记账打卡', done: checkinDone, actionText: '去打卡' })
  451. self.progressItems = items.filter(function(it) { return it && it.key })
  452. self.incompleteCount = 0
  453. for (var pi = 0; pi < items.length; pi++) if (items[pi] && !items[pi].done) self.incompleteCount++
  454. self.hasIncomplete = self.incompleteCount > 0
  455. },
  456. async loadGrowthRecommendations() {
  457. var self = this
  458. try {
  459. var res = await getGrowthRecommendations('health', 6)
  460. if (res && res.code === 200 && res.data) {
  461. var arts = res.data.articles || []
  462. self.healthArticles = arts.filter(function(a){ return a.growthCategory === 'health' })
  463. self.growthArticles = arts.filter(function(a){ return a.growthCategory === 'growth' })
  464. }
  465. } catch(e) {}
  466. },
  467. async loadCautionData() {
  468. var self = this
  469. try {
  470. var res = await getFoodCautionList()
  471. if (res && res.code === 200) self.cautionCount = (res.data || []).length
  472. } catch(e) {}
  473. },
  474. async loadMilestones() {
  475. var self = this
  476. try {
  477. var ciRes = await healthCheckinList({})
  478. if (ciRes.code === 200 && ciRes.data) self.streakDays = Math.min(ciRes.data.length, 30)
  479. } catch(e) {}
  480. self.activeChallenges = 0
  481. self.completeness = self.streakDays > 0 ? Math.min(100, Math.round(self.streakDays * 10)) : 0
  482. }
  483. }
  484. }
  485. </script>
  486. <style scoped>
  487. .container{background:#FFF7ED;min-height:100vh;padding-bottom:calc(160rpx + env(safe-area-inset-bottom))}
  488. .section{margin:16rpx 24rpx}
  489. /* 游客态 */
  490. .brand-strap{margin:0 24rpx 16rpx;background:linear-gradient(135deg,#F0FFF4,rgba(16,185,129,0.1));border-radius:16rpx;padding:20rpx 24rpx}
  491. .brand-strap-text{font-size:26rpx;color:#10B981;font-weight:600}
  492. .concept-card{margin:0 24rpx 16rpx;background:#fff;border-radius:20rpx;padding:28rpx;border-left:6rpx solid #10B981;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
  493. .concept-quote{font-size:30rpx;font-weight:bold;color:#333;display:block;margin-bottom:8rpx}
  494. .concept-desc{font-size:24rpx;color:#888;display:block;line-height:1.6}
  495. .case-card{margin:0 24rpx 16rpx;background:#fff;border-radius:20rpx;padding:24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
  496. .case-header{margin-bottom:12rpx}
  497. .case-label{font-size:24rpx;color:#10B981;font-weight:bold}
  498. .case-body{padding:8rpx 0}
  499. .case-name{font-size:26rpx;color:#333;font-weight:600;display:block;margin-bottom:6rpx}
  500. .case-change{font-size:24rpx;color:#666;display:block;margin-bottom:12rpx}
  501. .case-metrics{display:flex;gap:16rpx;margin-bottom:12rpx}
  502. .metric-item{display:flex;flex-direction:column;align-items:center;flex:1;background:#F0FFF4;border-radius:12rpx;padding:12rpx 8rpx}
  503. .metric-up{font-size:26rpx;font-weight:bold;color:#10B981}
  504. .metric-label{font-size:20rpx;color:#999;margin-top:4rpx}
  505. .case-note{font-size:22rpx;color:#888;display:block}
  506. .guest-features{display:flex;flex-wrap:wrap;justify-content:space-between;margin:0 24rpx 16rpx}
  507. .feat-card{width:calc(50% - 8rpx);box-sizing:border-box;background:#fff;border-radius:20rpx;padding:24rpx;margin-bottom:16rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
  508. .feat-icon{font-size:40rpx;display:block;margin-bottom:8rpx}
  509. .feat-title{font-size:26rpx;font-weight:600;color:#333;display:block;margin-bottom:4rpx}
  510. .feat-desc{font-size:22rpx;color:#999;display:block}
  511. .login-guide-section{margin:0 24rpx 24rpx}
  512. /* 成长行动卡片 */
  513. .action-card{display:flex;align-items:center;padding:24rpx 28rpx;background:#fff;border-radius:16rpx;margin:0 24rpx 16rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
  514. .action-card:active{opacity:0.85}
  515. .action-icon{font-size:44rpx;margin-right:20rpx}
  516. .action-info{flex:1}
  517. .action-title{font-size:28rpx;font-weight:600;color:#333;display:block}
  518. .action-desc{font-size:22rpx;color:#888;margin-top:4rpx;display:block}
  519. .action-arrow{font-size:32rpx;color:#ccc}
  520. /* section-header 组件通用样式 */
  521. .section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12rpx}
  522. .section-title{font-size:28rpx;font-weight:600;color:#333}
  523. .section-more{font-size:24rpx;color:#F97316}
  524. /* 登录后 */
  525. .reminder-bar{margin:12rpx 24rpx;background:#FFF3E0;border:1rpx solid #FFB74D;border-radius:12rpx;padding:14rpx 20rpx;display:flex;align-items:center;justify-content:space-between}
  526. .reminder-text{font-size:24rpx;color:#E65100}
  527. .reminder-close{font-size:28rpx;color:#999}
  528. /* 里程碑 */
  529. .milestone-card{background:#fff;border-radius:20rpx;padding:24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
  530. .section-title-row{font-size:26rpx;font-weight:bold;color:#333;margin-bottom:16rpx;display:block}
  531. .milestone-grid{display:flex;justify-content:space-between}
  532. .milestone-item{display:flex;flex-direction:column;align-items:center;flex:1}
  533. .milestone-icon{font-size:40rpx;margin-bottom:4rpx}
  534. .milestone-value{font-size:28rpx;font-weight:bold;color:#F97316;margin-bottom:2rpx}
  535. .milestone-label{font-size:22rpx;color:#999}
  536. /* 今日成长 */
  537. .progress-card{background:#fff;border-radius:20rpx;padding:24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
  538. .progress-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16rpx}
  539. .progress-title{font-size:28rpx;font-weight:bold;color:#333}
  540. .progress-date{font-size:22rpx;color:#999}
  541. .progress-grid{display:flex;justify-content:space-between}
  542. .progress-grid-item{flex:1;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20rpx 8rpx;background:#FFF7ED;border-radius:16rpx;margin-right:12rpx}
  543. .progress-grid-item:last-child{margin-right:0}
  544. .progress-grid-item:active{opacity:0.85;background:#FFEDD5}
  545. .progress-grid-icon{font-size:40rpx;margin-bottom:8rpx}
  546. .progress-grid-label{font-size:24rpx;color:#333;margin-bottom:8rpx;text-align:center}
  547. .progress-grid-status{font-size:20rpx;flex-shrink:0}
  548. .status-done{color:#10B981}
  549. .status-pending{color:#ccc}
  550. .progress-footer{display:flex;justify-content:space-between;align-items:center;margin-top:16rpx;padding-top:16rpx;border-top:1rpx solid #f5f5f5}
  551. .footer-text{font-size:24rpx;color:#666;font-weight:bold}
  552. .footer-streak{font-size:24rpx;color:#F97316;font-weight:bold}
  553. /* 报告状态卡片 */
  554. .report-card{background:#fff;border-radius:16rpx;padding:20rpx 24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06);display:flex;align-items:center;cursor:pointer}
  555. .report-card:active{opacity:0.85}
  556. .report-left{display:flex;align-items:center;flex:1;min-width:0}
  557. .report-icon{font-size:40rpx;margin-right:16rpx;flex-shrink:0}
  558. .report-info{flex:1;min-width:0}
  559. .report-title{font-size:28rpx;font-weight:600;color:#333;display:block}
  560. .report-desc{font-size:22rpx;color:#888;display:block;margin-top:4rpx;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  561. .report-score{font-size:22rpx;color:#10B981;font-weight:bold;display:block;margin-top:2rpx}
  562. .report-arrow{font-size:32rpx;color:#ccc;flex-shrink:0}
  563. /* 报告上传提示卡 */
  564. .report-upload-card{background:linear-gradient(135deg,#FF8C42,#F97316);border-radius:16rpx;padding:20rpx 24rpx;box-shadow:0 4rpx 16rpx rgba(249,115,22,0.25);display:flex;align-items:center}
  565. .report-upload-card:active{opacity:0.9}
  566. .report-upload-left{display:flex;align-items:center;flex:1;min-width:0}
  567. .report-upload-icon{font-size:44rpx;margin-right:16rpx;flex-shrink:0}
  568. .report-upload-info{flex:1;min-width:0}
  569. .report-upload-title{font-size:28rpx;font-weight:600;color:#fff;display:block}
  570. .report-upload-desc{font-size:22rpx;color:rgba(255,255,255,0.85);display:block;margin-top:4rpx}
  571. .report-upload-arrow{font-size:32rpx;color:rgba(255,255,255,0.7);flex-shrink:0}
  572. /* ===== 五维闭环体系样式 ===== */
  573. .wuxing-section { margin: 0 24rpx 16rpx; background: #fff; border-radius: 20rpx; padding: 24rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  574. .wuxing-title { font-size: 30rpx; font-weight: bold; color: #333; text-align: center; margin-bottom: 6rpx; }
  575. .wuxing-desc { font-size: 22rpx; color: #999; text-align: center; margin-bottom: 20rpx; }
  576. .wuxing-relations { margin-top: 8rpx; }
  577. .rel-group { margin-bottom: 16rpx; }
  578. .rel-title { font-size: 24rpx; font-weight: bold; color: #333; margin-bottom: 8rpx; display: block; }
  579. .rel-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4rpx; margin-bottom: 6rpx; }
  580. .rel-item { font-size: 22rpx; padding: 4rpx 10rpx; border-radius: 8rpx; background: #f7f7f7; color: #555; }
  581. .rel-arrow { font-size: 20rpx; color: #10B981; font-weight: bold; }
  582. .rel-op { font-size: 20rpx; color: #f56c6c; font-weight: bold; }
  583. .rel-dot { font-size: 20rpx; color: #ccc; }
  584. .rel-hint { font-size: 20rpx; color: #999; line-height: 1.5; display: block; }
  585. .wuxing-cards { display: flex; flex-direction: column; gap: 10rpx; margin-top: 16rpx; }
  586. .wc-card { display: flex; align-items: center; padding: 16rpx 20rpx; border-radius: 16rpx; border: 2rpx solid #f0f0f0; }
  587. .wc-card:active { opacity: 0.85; }
  588. .wc-icon { font-size: 36rpx; margin-right: 16rpx; flex-shrink: 0; }
  589. .wc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  590. .wc-name { font-size: 24rpx; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  591. .wc-text { font-size: 20rpx; color: #999; display: block; margin-top: 4rpx; white-space: normal; }
  592. .wc-body { border-color: rgba(255,140,66,0.3); background: rgba(255,140,66,0.04); border-left: 8rpx solid #FF8C42; }
  593. .wc-body .wc-name { color: #FF8C42; }
  594. .wc-wisdom { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.04); border-left: 8rpx solid #6366F1; }
  595. .wc-wisdom .wc-name { color: #6366F1; }
  596. .wc-wealth { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.04); border-left: 8rpx solid #F59E0B; }
  597. .wc-wealth .wc-name { color: #F59E0B; }
  598. .wc-action { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.04); border-left: 8rpx solid #10B981; }
  599. .wc-action .wc-name { color: #10B981; }
  600. .wc-mind { border-color: rgba(255,107,157,0.3); background: rgba(255,107,157,0.04); border-left: 8rpx solid #FF6B9D; }
  601. .wc-mind .wc-name { color: #FF6B9D; }
  602. </style>