index.vue 25 KB

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