index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. <template>
  2. <view class="body-container">
  3. <!-- Tabbar 切换过渡页 -->
  4. <tab-transition v-if="showTabTransition" dimCode="body" ref="tabTransition" @close="showTabTransition = false" />
  5. <!-- 品牌头部 -->
  6. <PageBanner theme="body"
  7. tagline="科学管理全家健康"
  8. quote="身体健康是幸福的基础" />
  9. <!-- 雷达图(始终显示,无用户数据时仅显示人群平均值) -->
  10. <view class="section">
  11. <view class="section-header">
  12. <text class="section-title">七维健康图</text>
  13. <text class="avg-badge" v-if="!dimensionData">同龄同性平均值 · 上传报告后显示个人数据</text>
  14. </view>
  15. <RadarChart
  16. v-if="radarDimensions && radarDimensions.length >= 3"
  17. :dimensions="radarDimensions"
  18. :scores="radarScores"
  19. :avg-scores="radarAvgScores"
  20. fillColor="#FF8C42"
  21. gridColor="#FED7AA"
  22. labelColor="#9A3412"
  23. :width="580"
  24. :height="580"
  25. @dimensionClick="goDimensionDetail" />
  26. </view>
  27. <!-- 家庭成员选择条 -->
  28. <FamilyMemberStrip
  29. v-if="isLoggedIn"
  30. :members="familyMembersVisible"
  31. :selectedMemberId="selectedMemberId"
  32. @select="onFamilyMemberSelect"
  33. @removed="loadFamilyMembersVisible" />
  34. <!-- 游客专属区块 -->
  35. <template v-if="!isLoggedIn">
  36. <LoginGuideCard
  37. title="登录后查看全家健康数据"
  38. :items="[
  39. '查看全家身体能量数据和健康报告',
  40. '记录每日健康打卡,获取身体能量',
  41. '查看专属健康商品和活动价格'
  42. ]" />
  43. <HealthTips dimension="body" />
  44. </template>
  45. <!-- 登录后:五维能量条 -->
  46. <view v-if="hasFamily">
  47. <FamilyEnergyBar
  48. v-if="isLoggedIn"
  49. dimensionCode="body"
  50. :sandboxData="sandboxData"
  51. :dualDimension="dualDimension" />
  52. <!-- 功能入口 -->
  53. <view class="func-section" v-if="sectionVisible('func_entries')">
  54. <view class="func-grid">
  55. <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
  56. <view class="func-icon-wrap">
  57. <text class="func-icon">{{ item.icon }}</text>
  58. </view>
  59. <text class="func-label">{{ item.label }}</text>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- ===== 精准营养(上传报告+产品+文章) ===== -->
  64. <view class="section nutrition-section" v-if="isLoggedIn">
  65. <view class="section-header">
  66. <text class="section-title">🥗 精准营养</text>
  67. </view>
  68. <!-- 上传报告入口 -->
  69. <view class="nutrition-report-card" @click="goToUploadReport">
  70. <view class="nutrition-report-left">
  71. <text class="nutrition-icon-large">📋</text>
  72. </view>
  73. <view class="nutrition-report-right">
  74. <text class="nutrition-title">上传健康报告</text>
  75. <text class="nutrition-desc">上传体检报告或肠道检测报告,AI智能解读分析,获取个性化营养方案</text>
  76. <view class="nutrition-report-tags">
  77. <text class="tag">体检报告</text>
  78. <text class="tag">肠道检测</text>
  79. <text class="tag">AI解读</text>
  80. </view>
  81. </view>
  82. <text class="nutrition-arrow">›</text>
  83. </view>
  84. </view>
  85. <!-- 维度任务 -->
  86. <DimensionTasks
  87. v-if="isLoggedIn"
  88. dimensionCode="body"
  89. :tasks="dimensionTasks"
  90. @taskClick="onTaskClick"
  91. @moreTasks="goTasks" />
  92. <!-- 维度活动 -->
  93. <DimensionActivities
  94. dimensionCode="body"
  95. :activities="dimensionActivities"
  96. :isLoggedIn="isLoggedIn"
  97. @activityClick="goActivityDetail"
  98. @moreActivities="goMoreActivities" />
  99. <!-- 商品推荐 -->
  100. <DimensionProducts
  101. dimensionCode="body"
  102. :familyId="activeChildId"
  103. :products="dimensionProducts"
  104. title="推荐商品"
  105. @productClick="goProductDetail"
  106. @moreProducts="goMoreProducts" />
  107. <!-- 推荐阅读 -->
  108. <ArticleBookshelf
  109. :articles="bodyArticles"
  110. :isLoggedIn="isLoggedIn"
  111. @articleClick="goArticleDetail"
  112. @moreArticles="goMoreArticles" />
  113. <!-- 底部占位 -->
  114. <view class="bottom-spacer"></view>
  115. <AIFloatingAvatar />
  116. </view>
  117. <view v-else>
  118. <FamilyEmptyState type="card" />
  119. </view>
  120. </view>
  121. </template>
  122. <script>
  123. import TabTransition from '../../components/tab-transition.vue'
  124. import PageBanner from '../../components/PageBanner.vue'
  125. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  126. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  127. import DimensionTasks from '../../components/DimensionTasks.vue'
  128. import DimensionActivities from '../../components/DimensionActivities.vue'
  129. import DimensionProducts from '../../components/DimensionProducts.vue'
  130. import ArticleBookshelf from '../../components/ArticleBookshelf.vue'
  131. import RadarChart from '../../components/RadarChart.vue'
  132. import AIFloatingAvatar from '../../components/AIFloatingAvatar.vue'
  133. import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
  134. import { getVisibleSections, getEnergyOverview, getChildren, getTodayTasksByCategory, getActivityList, getProductsByDomain, getFamilyEnergySandbox, getVisibleFamilyMembers, getDimensionOverview, getFeaturedArticles } from '../../utils/api.js'
  135. export default {
  136. components: { TabTransition, PageBanner, LoginGuideCard, FamilyEnergyBar, DimensionTasks, DimensionActivities, DimensionProducts, ArticleBookshelf, RadarChart, AIFloatingAvatar, FamilyMemberStrip },
  137. data() {
  138. return {
  139. isLoggedIn: false,
  140. role: null,
  141. showTabTransition: true,
  142. activeChildId: null,
  143. selectedMemberId: null,
  144. activeChildName: '',
  145. userName: '',
  146. children: [],
  147. familyMembersVisible: [],
  148. // 接口数据是否已检查(用于 hasFamily 判断,替代已失效的 store.familyId)
  149. childrenChecked: false,
  150. membersChecked: false,
  151. sandboxData: null,
  152. dualDimension: null,
  153. visibleSections: [],
  154. dimensionTasks: [],
  155. dimensionActivities: [],
  156. dimensionProducts: [],
  157. bodyArticles: [],
  158. dimensionData: null,
  159. /** Mock 平均值(7维):生长发育/睡眠质量/视力健康/免疫力/营养均衡/肠胃健康/运动活力 */
  160. radarAvgScores: [72, 68, 75, 70, 73, 69, 71],
  161. funcList: [
  162. { icon: '\u{1F3C3}', label: '运动', needLogin: true, page: '/pages/body/exercise-record' },
  163. { icon: '\u{1F957}', label: '饮食', needLogin: true, page: '/pages/body/meal-record' },
  164. { icon: '\u{1F634}', label: '作息', needLogin: true, page: '/pages/body/sleep-record' },
  165. { icon: '\u{1F9D8}', label: '冥想', needLogin: true, page: '/pages/health/meditation-index' },
  166. { icon: '\u{1F4CA}', label: '舌诊', needLogin: true, page: '/pages/health/report-upload?reportType=tongue' },
  167. // AI问答功能已屏蔽: { icon: '\u{1F3E5}', label: '健康管家', needLogin: true, page: '/pages/ai/chat?mode=butler&fromPage=pages/body/index' },
  168. { icon: '\u{1F9EC}', label: '健康维度', needLogin: true, page: 'health-dimensions' }
  169. ]
  170. }
  171. },
  172. computed: {
  173. hasFamily: function() {
  174. // 应急修复(2026-08-07):store.familyId 在 familyId 后端派生改造后不再被写入,
  175. // hasFamily 恒为 false 导致内容区被 v-else 空态吞掉。改为基于接口数据判断:
  176. // 有孩子成员或可见家庭成员即认为有家庭。
  177. if (!this.isLoggedIn) {
  178. return false
  179. }
  180. // 接口未返回前乐观显示内容区,避免"暂无数据"闪烁
  181. if (!this.childrenChecked || !this.membersChecked) {
  182. return true
  183. }
  184. return (this.children && this.children.length > 0) ||
  185. (this.familyMembersVisible && this.familyMembersVisible.length > 0)
  186. },
  187. /** 七维雷达图:维度标签(API无数据时使用默认标签) */
  188. radarDimensions: function() {
  189. var dims = this.dimensionData && this.dimensionData.dimensions
  190. if (dims && dims.length > 0) {
  191. var result = []
  192. for (var i = 0; i < dims.length; i++) {
  193. var d = dims[i]
  194. if (!d) continue
  195. result.push({ label: d.label || '', key: d.dimension || '' })
  196. }
  197. return result
  198. }
  199. // 无数据时使用默认七维标签
  200. return [
  201. { label: '生长发育', key: 'growth' },
  202. { label: '睡眠质量', key: 'sleep' },
  203. { label: '视力健康', key: 'vision' },
  204. { label: '免疫力', key: 'immunity' },
  205. { label: '营养均衡', key: 'nutrition' },
  206. { label: '肠胃健康', key: 'gut' },
  207. { label: '运动活力', key: 'exercise' }
  208. ]
  209. },
  210. /** 七维雷达图:分值(无数据时返回空数组,仅显示平均值) */
  211. radarScores: function() {
  212. var dims = this.dimensionData && this.dimensionData.dimensions
  213. if (!dims) return []
  214. var result = []
  215. for (var i = 0; i < dims.length; i++) {
  216. var d = dims[i]
  217. if (!d) { result.push(0); continue }
  218. var s = d.score
  219. if (typeof s !== 'number' || isNaN(s) || s === null) s = 0
  220. result.push(s)
  221. }
  222. return result
  223. }
  224. },
  225. onShow() {
  226. this.showTabTransition = true
  227. var token = uni.getStorageSync('token')
  228. this.isLoggedIn = !!token
  229. if (this.isLoggedIn) {
  230. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  231. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  232. }
  233. this.loadSectionConfig()
  234. if (this.isLoggedIn) {
  235. this.loadChildren()
  236. this.loadFamilyMembersVisible()
  237. }
  238. // 游客也能浏览活动和商品
  239. this.loadDimensionActivities()
  240. this.loadDimensionProducts()
  241. // 游客也能浏览文章
  242. this.loadFeaturedArticles()
  243. this._watchPageReady()
  244. },
  245. methods: {
  246. loadSectionConfig: function() {
  247. var baseSections = ['func_entries']
  248. if (!uni.getStorageSync('token')) {
  249. this.visibleSections = baseSections
  250. return
  251. }
  252. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  253. var self = this
  254. getVisibleSections({ pageKey: 'body', role: role }).then(function(res) {
  255. if (res.code === 200 && res.data) {
  256. var keys = res.data.map(function(s) { return s.sectionKey })
  257. var merged = baseSections.slice()
  258. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  259. self.visibleSections = merged
  260. }
  261. }).catch(function(e) {
  262. self.visibleSections = ['func_entries']
  263. })
  264. },
  265. loadChildren: function() {
  266. var self = this
  267. getChildren().then(function(res) {
  268. if (res.code === 200 && res.data) {
  269. self.children = res.data
  270. var savedChildId = uni.getStorageSync('currentChildId')
  271. var found = false
  272. for (var i = 0; i < self.children.length; i++) {
  273. if (self.children[i].memberId === savedChildId) {
  274. self.activeChildId = savedChildId
  275. self.activeChildName = self.children[i].name || self.children[i].nickname || '孩子'
  276. found = true
  277. break
  278. }
  279. }
  280. if (!found && self.children.length > 0) {
  281. self.activeChildId = self.children[0].memberId
  282. self.activeChildName = self.children[0].name || self.children[0].nickname || '孩子'
  283. uni.setStorageSync('currentChildId', self.activeChildId)
  284. }
  285. if (self.activeChildId) {
  286. self.loadDashboardData()
  287. }
  288. }
  289. self.childrenChecked = true
  290. }).catch(function(e) {
  291. console.log('获取孩子列表失败', e)
  292. self.childrenChecked = true
  293. })
  294. },
  295. loadDashboardData: function() {
  296. if (!this.activeChildId) return
  297. this.loadEnergyData()
  298. this.loadDimensionTasks()
  299. this.loadDimensionActivities()
  300. this.loadDimensionProducts()
  301. this.loadSandboxData()
  302. this.loadHealthDimensions()
  303. },
  304. goProductDetail: function(prod) {
  305. if (!prod || !prod.id) return
  306. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  307. },
  308. goMoreProducts: function() {
  309. uni.navigateTo({ url: '/pages/shop/index/index' })
  310. },
  311. loadHealthDimensions: function() {
  312. var memberId = this.activeChildId || (this.userInfo && this.userInfo.userId)
  313. if (!memberId) {
  314. console.log('[body] loadHealthDimensions skipped: no memberId')
  315. return
  316. }
  317. var self = this
  318. getDimensionOverview({ memberId: memberId }).then(function(res) {
  319. if (res && res.data) {
  320. self.dimensionData = res.data
  321. console.log('[body] dimensionData loaded:', res.data.dimensions ? res.data.dimensions.length : 0, 'dimensions')
  322. } else if (res) {
  323. console.warn('[body] dimension API error:', res.message || res.code)
  324. }
  325. }).catch(function(e) {
  326. console.error('[body] loadHealthDimensions failed', e)
  327. })
  328. },
  329. loadSandboxData: function() {
  330. var self = this
  331. getFamilyEnergySandbox().then(function(res) {
  332. if (res && res.data) {
  333. self.sandboxData = res.data
  334. }
  335. }).catch(function(e) {
  336. console.log('获取沙盘数据失败', e)
  337. })
  338. },
  339. loadEnergyData: function() {
  340. var self = this
  341. getEnergyOverview(this.activeChildId).then(function(res) {
  342. if (res && res.data) {
  343. var dims = res.data.dimensions
  344. if (dims && dims.length > 0) {
  345. for (var i = 0; i < dims.length; i++) {
  346. if (dims[i].code === 'body') {
  347. self.dualDimension = dims[i]
  348. break
  349. }
  350. }
  351. }
  352. }
  353. }).catch(function(e) {
  354. console.log('获取能量概览失败', e)
  355. })
  356. },
  357. loadDimensionTasks: function() {
  358. var self = this
  359. if (!this.activeChildId) return
  360. getTodayTasksByCategory(this.activeChildId, 'body').then(function(res) {
  361. if (res && res.data) {
  362. self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
  363. }
  364. }).catch(function() { self.dimensionTasks = [] })
  365. },
  366. loadDimensionActivities: function() {
  367. var self = this
  368. getActivityList({ dimensionCode: 'body', page: 1, size: 3 }).then(function(res) {
  369. if (res && res.data) {
  370. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  371. self.dimensionActivities = list.slice(0, 3)
  372. }
  373. }).catch(function() { self.dimensionActivities = [] })
  374. },
  375. loadDimensionProducts: function() {
  376. var self = this
  377. getProductsByDomain('body', 1, 4).then(function(res) {
  378. if (res && res.data) {
  379. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  380. self.dimensionProducts = list.slice(0, 4)
  381. }
  382. }).catch(function() { self.dimensionProducts = [] })
  383. },
  384. loadFeaturedArticles: function() {
  385. var self = this
  386. getFeaturedArticles({ size: 5, dimensionCode: 'body' }).then(function(res) {
  387. if (res.code === 200 && res.data) {
  388. var gradientColors = [
  389. 'linear-gradient(135deg, #FF8C42, #FFB074)',
  390. 'linear-gradient(135deg, #FF6B9D, #FF9DBD)',
  391. 'linear-gradient(135deg, #6366F1, #818CF8)',
  392. 'linear-gradient(135deg, #10B981, #34D399)',
  393. 'linear-gradient(135deg, #F59E0B, #FBBF24)'
  394. ]
  395. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  396. self.bodyArticles = list.map(function(item, index) {
  397. return {
  398. id: item.id,
  399. category: item.categoryName || '身体健康',
  400. categoryColor: gradientColors[index % gradientColors.length],
  401. title: item.title || '',
  402. summary: item.summary || '',
  403. views: item.viewCount ? String(item.viewCount) : '0',
  404. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  405. relatedDimensions: item.relatedDimensions,
  406. coverImage: item.coverImage,
  407. author: item.author
  408. }
  409. })
  410. }
  411. }.bind(this)).catch(function() {})
  412. },
  413. onFamilyMemberSelect: function(member) {
  414. this.selectedMemberId = member.id
  415. },
  416. onChildChanged: function(child) {
  417. this.activeChildId = child.memberId
  418. this.activeChildName = child.name || child.nickname || '孩子'
  419. this.loadDashboardData()
  420. },
  421. loadFamilyMembersVisible: function() {
  422. var self = this
  423. getVisibleFamilyMembers().then(function(res) {
  424. self.familyMembersVisible = res.data || []
  425. self.membersChecked = true
  426. }).catch(function(e) {
  427. console.log('获取可见家庭成员失败', e)
  428. self.familyMembersVisible = []
  429. self.membersChecked = true
  430. })
  431. },
  432. scrollToSection: function(section) {
  433. uni.pageScrollTo({ selector: '#' + section, duration: 300 })
  434. },
  435. onTaskClick: function(task) {
  436. uni.navigateTo({ url: '/pages/tasks/tasks' })
  437. },
  438. goActivityDetail: function(act) {
  439. if (!act || !act.id) return
  440. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
  441. },
  442. goMoreActivities: function() {
  443. uni.navigateTo({ url: '/pages/activity/index' })
  444. },
  445. goArticleDetail: function(article) {
  446. var id = article.id || article
  447. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  448. },
  449. goMoreArticles: function() {
  450. uni.navigateTo({ url: '/pages/article-center/index?dimension=body' })
  451. },
  452. goTasks: function() { uni.navigateTo({ url: '/pages/tasks/tasks' }) },
  453. goFamilyMembers: function() {
  454. uni.navigateTo({ url: '/pages/profile/family-members' })
  455. },
  456. sectionVisible: function(key) {
  457. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  458. },
  459. onFuncClick: function(item) {
  460. if (item.needLogin && !this.isLoggedIn) {
  461. uni.showModal({
  462. title: '提示',
  463. content: '请先登录后使用此功能',
  464. success: function(res) {
  465. if (res.confirm) uni.navigateTo({ url: '/pages/login/login' })
  466. }
  467. })
  468. return
  469. }
  470. if (item.page === 'health-dimensions') {
  471. if (!this.activeChildId) {
  472. uni.showToast({ title: '请先选择孩子', icon: 'none' })
  473. return
  474. }
  475. uni.navigateTo({ url: '/pages/body-detail/health-dimensions?memberId=' + this.activeChildId })
  476. return
  477. }
  478. if (item.page) uni.navigateTo({ url: item.page })
  479. },
  480. goDimensionDetail: function(dimKey) {
  481. uni.navigateTo({ url: '/pages/body-detail/dimension-detail?dimension=' + dimKey + '&memberId=' + this.activeChildId })
  482. },
  483. goToCheckin: function() {
  484. var id = this.activeChildId || uni.getStorageSync('currentChildId')
  485. if (!id) {
  486. uni.showToast({ title: '请先选择成员', icon: 'none' })
  487. return
  488. }
  489. uni.navigateTo({ url: '/pages/body-detail/checkin?memberId=' + id })
  490. },
  491. goToNutritionProfile: function() {
  492. var id = this.activeChildId || uni.getStorageSync('currentChildId')
  493. if (!id) {
  494. uni.showToast({ title: '请先选择成员', icon: 'none' })
  495. return
  496. }
  497. uni.navigateTo({ url: '/pages/health/nutrition-profile?memberId=' + id })
  498. },
  499. goToUploadReport: function() {
  500. var id = this.activeChildId || uni.getStorageSync('currentChildId') || ''
  501. uni.navigateTo({ url: '/pages/health/report-upload?memberId=' + id + '&from=body' })
  502. },
  503. _watchPageReady() {
  504. var self = this
  505. var unwatch = this.$watch(function() {
  506. if (self.isLoggedIn) {
  507. return !!(self.dualDimension || self.sandboxData || (self.dimensionTasks && self.dimensionTasks.length > 0))
  508. }
  509. return !!(self.dimensionActivities && self.dimensionActivities.length > 0) ||
  510. !!(self.dimensionProducts && self.dimensionProducts.length > 0)
  511. }, function(val) {
  512. if (val) {
  513. if (unwatch) unwatch()
  514. if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
  515. }
  516. })
  517. }
  518. }
  519. }
  520. </script>
  521. <style scoped>
  522. .body-container {
  523. min-height: 100vh;
  524. background: #f5f7fa;
  525. padding-bottom: 120rpx;
  526. }
  527. /* ===== 功能入口 ===== */
  528. .func-section {
  529. margin: 20rpx 30rpx;
  530. }
  531. .func-grid {
  532. display: flex;
  533. flex-direction: row;
  534. justify-content: space-between;
  535. background: #fff;
  536. border-radius: 20rpx;
  537. padding: 24rpx 16rpx;
  538. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  539. }
  540. .func-item {
  541. display: flex;
  542. flex-direction: column;
  543. align-items: center;
  544. flex: 1;
  545. }
  546. .func-icon-wrap {
  547. width: 80rpx;
  548. height: 80rpx;
  549. border-radius: 40rpx;
  550. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  551. display: flex;
  552. align-items: center;
  553. justify-content: center;
  554. margin-bottom: 10rpx;
  555. }
  556. .func-icon {
  557. font-size: 40rpx;
  558. }
  559. .func-label {
  560. font-size: 22rpx;
  561. color: #666;
  562. font-weight: 500;
  563. }
  564. /* ===== 通用区块 ===== */
  565. .section {
  566. margin: 20rpx 30rpx;
  567. }
  568. .section-header {
  569. display: flex;
  570. flex-direction: row;
  571. align-items: center;
  572. justify-content: space-between;
  573. margin-bottom: 16rpx;
  574. }
  575. .section-title {
  576. font-size: 30rpx;
  577. font-weight: bold;
  578. color: #333;
  579. }
  580. .avg-badge {
  581. font-size: 20rpx;
  582. color: #F97316;
  583. background: #FFF7ED;
  584. padding: 4rpx 12rpx;
  585. border-radius: 20rpx;
  586. margin-left: 12rpx;
  587. }
  588. /* ===== 快捷操作 ===== */
  589. .quick-actions {
  590. display: flex;
  591. flex-direction: row;
  592. margin-top: 30rpx;
  593. }
  594. .action-btn {
  595. flex: 1;
  596. background: #fff;
  597. border-radius: 16rpx;
  598. padding: 24rpx;
  599. display: flex;
  600. flex-direction: column;
  601. align-items: center;
  602. margin-right: 20rpx;
  603. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  604. }
  605. .action-btn:last-child {
  606. margin-right: 0;
  607. }
  608. .action-icon {
  609. font-size: 48rpx;
  610. margin-bottom: 8rpx;
  611. }
  612. .action-text {
  613. font-size: 26rpx;
  614. color: #666;
  615. }
  616. /* ===== 底部 ===== */
  617. .bottom-spacer {
  618. height: 120rpx;
  619. }
  620. .func-item:active, .action-btn:active {
  621. opacity: 0.7;
  622. }
  623. /* ===== 精准营养 ===== */
  624. .nutrition-section {
  625. margin-top: 20rpx;
  626. }
  627. .nutrition-report-card {
  628. display: flex;
  629. flex-direction: row;
  630. align-items: center;
  631. background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
  632. border-radius: 20rpx;
  633. padding: 28rpx 24rpx;
  634. margin-bottom: 20rpx;
  635. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  636. }
  637. .nutrition-report-left {
  638. width: 100rpx;
  639. height: 100rpx;
  640. background: rgba(255,255,255,0.7);
  641. border-radius: 20rpx;
  642. display: flex;
  643. align-items: center;
  644. justify-content: center;
  645. margin-right: 20rpx;
  646. flex-shrink: 0;
  647. }
  648. .nutrition-icon-large {
  649. font-size: 52rpx;
  650. }
  651. .nutrition-report-right {
  652. flex: 1;
  653. }
  654. .nutrition-title {
  655. font-size: 30rpx;
  656. font-weight: bold;
  657. color: #2E7D32;
  658. display: block;
  659. margin-bottom: 6rpx;
  660. }
  661. .nutrition-desc {
  662. font-size: 22rpx;
  663. color: #558B2F;
  664. line-height: 1.5;
  665. display: block;
  666. margin-bottom: 10rpx;
  667. }
  668. .nutrition-report-tags {
  669. display: flex;
  670. flex-direction: row;
  671. gap: 10rpx;
  672. }
  673. .nutrition-report-tags .tag {
  674. font-size: 20rpx;
  675. color: #33691E;
  676. background: rgba(255,255,255,0.6);
  677. padding: 4rpx 14rpx;
  678. border-radius: 20rpx;
  679. }
  680. .nutrition-arrow {
  681. font-size: 40rpx;
  682. color: #A5D6A7;
  683. margin-left: 12rpx;
  684. }
  685. .nutrition-links {
  686. margin-bottom: 20rpx;
  687. }
  688. .links-label {
  689. font-size: 26rpx;
  690. font-weight: bold;
  691. color: #333;
  692. display: block;
  693. margin-bottom: 12rpx;
  694. }
  695. .links-row {
  696. display: flex;
  697. flex-direction: row;
  698. gap: 16rpx;
  699. }
  700. .link-item {
  701. flex: 1;
  702. display: flex;
  703. flex-direction: row;
  704. align-items: center;
  705. background: #fff;
  706. border-radius: 16rpx;
  707. padding: 20rpx 18rpx;
  708. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  709. gap: 12rpx;
  710. }
  711. .link-item:active {
  712. opacity: 0.7;
  713. }
  714. .link-icon {
  715. font-size: 36rpx;
  716. flex-shrink: 0;
  717. }
  718. .link-texts {
  719. flex: 1;
  720. }
  721. .link-name {
  722. font-size: 24rpx;
  723. font-weight: 500;
  724. color: #333;
  725. display: block;
  726. margin-bottom: 4rpx;
  727. }
  728. .link-desc {
  729. font-size: 20rpx;
  730. color: #999;
  731. display: block;
  732. }
  733. .link-arrow {
  734. font-size: 32rpx;
  735. color: #CCC;
  736. flex-shrink: 0;
  737. }
  738. /* ===== 推荐阅读 ===== */
  739. .article-list {
  740. display: flex;
  741. flex-direction: column;
  742. gap: 16rpx;
  743. }
  744. .article-card {
  745. background: #fff;
  746. border-radius: 16rpx;
  747. padding: 24rpx;
  748. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  749. }
  750. .article-card:active {
  751. opacity: 0.8;
  752. }
  753. .article-category {
  754. display: inline-block;
  755. padding: 4rpx 14rpx;
  756. border-radius: 8rpx;
  757. margin-bottom: 10rpx;
  758. }
  759. .article-category-text {
  760. font-size: 20rpx;
  761. color: #fff;
  762. }
  763. .article-title {
  764. display: block;
  765. font-size: 28rpx;
  766. font-weight: bold;
  767. color: #333;
  768. margin-bottom: 8rpx;
  769. line-height: 1.4;
  770. }
  771. .article-summary {
  772. display: block;
  773. font-size: 24rpx;
  774. color: #888;
  775. line-height: 1.5;
  776. margin-bottom: 12rpx;
  777. overflow: hidden;
  778. text-overflow: ellipsis;
  779. display: -webkit-box;
  780. -webkit-line-clamp: 2;
  781. -webkit-box-orient: vertical;
  782. }
  783. .article-meta {
  784. display: flex;
  785. align-items: center;
  786. gap: 16rpx;
  787. }
  788. .meta-item {
  789. display: flex;
  790. align-items: center;
  791. gap: 4rpx;
  792. }
  793. .meta-icon {
  794. font-size: 24rpx;
  795. }
  796. .meta-text {
  797. font-size: 22rpx;
  798. color: #999;
  799. }
  800. .article-date {
  801. font-size: 22rpx;
  802. color: #bbb;
  803. }
  804. </style>