index.vue 25 KB

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