index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  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. ]
  183. }
  184. },
  185. computed: {
  186. energyMapForGraph: function() {
  187. var map = {}
  188. if (this.sandboxData && this.sandboxData.members) {
  189. for (var i = 0; i < this.sandboxData.members.length; i++) {
  190. var m = this.sandboxData.members[i]
  191. map[m.memberId || m.id] = {
  192. bodyScore: m.bodyScore || 0,
  193. mindScore: m.mindScore || 0,
  194. actionScore: m.actionScore || 0
  195. }
  196. }
  197. }
  198. return map
  199. },
  200. intimacyMapForGraph: function() {
  201. return {}
  202. },
  203. /** 七维雷达图:维度标签(遵守 AGENTS.md 禁止模板内方法调用,使用 computed 缓存) */
  204. radarDimensions: function() {
  205. var dims = this.dimensionData && this.dimensionData.dimensions
  206. if (!dims) return []
  207. var result = []
  208. for (var i = 0; i < dims.length; i++) {
  209. var d = dims[i]
  210. if (!d) continue
  211. result.push({ label: d.label || '', key: d.dimension || '' })
  212. }
  213. return result
  214. },
  215. /** 七维雷达图:分值(对 null/NaN 做归一化,避免 Canvas 计算 NaN 静默失败) */
  216. radarScores: function() {
  217. var dims = this.dimensionData && this.dimensionData.dimensions
  218. if (!dims) return []
  219. var result = []
  220. for (var i = 0; i < dims.length; i++) {
  221. var d = dims[i]
  222. if (!d) { result.push(0); continue }
  223. var s = d.score
  224. if (typeof s !== 'number' || isNaN(s) || s === null) s = 0
  225. result.push(s)
  226. }
  227. return result
  228. }
  229. },
  230. onShow() {
  231. this.showTabTransition = true
  232. var token = uni.getStorageSync('token')
  233. this.isLoggedIn = !!token
  234. if (this.isLoggedIn) {
  235. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  236. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  237. }
  238. this.loadSectionConfig()
  239. if (this.isLoggedIn) {
  240. this.loadChildren()
  241. this.loadFamilyMembersVisible()
  242. }
  243. // 游客也能浏览活动和商品
  244. this.loadDimensionActivities()
  245. this.loadDimensionProducts()
  246. // 游客也能浏览文章
  247. this.loadFeaturedArticles()
  248. this._watchPageReady()
  249. },
  250. methods: {
  251. loadSectionConfig: function() {
  252. var baseSections = ['func_entries']
  253. if (!uni.getStorageSync('token')) {
  254. this.visibleSections = baseSections
  255. return
  256. }
  257. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  258. var self = this
  259. getVisibleSections({ pageKey: 'body', role: role }).then(function(res) {
  260. if (res.code === 200 && res.data) {
  261. var keys = res.data.map(function(s) { return s.sectionKey })
  262. var merged = baseSections.slice()
  263. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  264. self.visibleSections = merged
  265. }
  266. }).catch(function(e) {
  267. self.visibleSections = ['func_entries']
  268. })
  269. },
  270. loadChildren: function() {
  271. var self = this
  272. getChildren().then(function(res) {
  273. if (res.code === 200 && res.data) {
  274. self.children = res.data
  275. var savedChildId = uni.getStorageSync('currentChildId')
  276. var found = false
  277. for (var i = 0; i < self.children.length; i++) {
  278. if (self.children[i].childId === savedChildId) {
  279. self.activeChildId = savedChildId
  280. self.activeChildName = self.children[i].name || self.children[i].nickname || '孩子'
  281. found = true
  282. break
  283. }
  284. }
  285. if (!found && self.children.length > 0) {
  286. self.activeChildId = self.children[0].childId
  287. self.activeChildName = self.children[0].name || self.children[0].nickname || '孩子'
  288. uni.setStorageSync('currentChildId', self.activeChildId)
  289. }
  290. if (self.activeChildId) {
  291. self.loadDashboardData()
  292. }
  293. }
  294. }).catch(function(e) {
  295. console.log('获取孩子列表失败', e)
  296. })
  297. },
  298. loadDashboardData: function() {
  299. if (!this.activeChildId) return
  300. this.loadEnergyData()
  301. this.loadDimensionTasks()
  302. this.loadDimensionActivities()
  303. this.loadDimensionProducts()
  304. this.loadSandboxData()
  305. this.loadHealthDimensions()
  306. },
  307. loadHealthDimensions: function() {
  308. var memberId = this.activeChildId || (this.userInfo && this.userInfo.userId)
  309. if (!memberId) {
  310. console.log('[body] loadHealthDimensions skipped: no memberId')
  311. return
  312. }
  313. var self = this
  314. getDimensionOverview({ memberId: memberId }).then(function(res) {
  315. if (res && res.data) {
  316. self.dimensionData = res.data
  317. console.log('[body] dimensionData loaded:', res.data.dimensions ? res.data.dimensions.length : 0, 'dimensions')
  318. } else if (res) {
  319. console.warn('[body] dimension API error:', res.message || res.code)
  320. }
  321. }).catch(function(e) {
  322. console.error('[body] loadHealthDimensions failed', e)
  323. })
  324. },
  325. loadSandboxData: function() {
  326. var self = this
  327. getFamilyEnergySandbox().then(function(res) {
  328. if (res && res.data) {
  329. self.sandboxData = res.data
  330. }
  331. }).catch(function(e) {
  332. console.log('获取沙盘数据失败', e)
  333. })
  334. },
  335. loadEnergyData: function() {
  336. var self = this
  337. getEnergyOverview(this.activeChildId).then(function(res) {
  338. if (res && res.data) {
  339. var dims = res.data.dimensions
  340. if (dims && dims.length > 0) {
  341. for (var i = 0; i < dims.length; i++) {
  342. if (dims[i].code === 'body') {
  343. self.dualDimension = dims[i]
  344. break
  345. }
  346. }
  347. }
  348. }
  349. }).catch(function(e) {
  350. console.log('获取能量概览失败', e)
  351. })
  352. },
  353. loadDimensionTasks: function() {
  354. var self = this
  355. if (!this.activeChildId) return
  356. getTodayTasksByCategory(this.activeChildId, 'body').then(function(res) {
  357. if (res && res.data) {
  358. self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
  359. }
  360. }).catch(function() { self.dimensionTasks = [] })
  361. },
  362. loadDimensionActivities: function() {
  363. var self = this
  364. getActivityList({ dimensionCode: 'body', page: 1, size: 3 }).then(function(res) {
  365. if (res && res.data) {
  366. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  367. self.dimensionActivities = list.slice(0, 3)
  368. }
  369. }).catch(function() { self.dimensionActivities = [] })
  370. },
  371. loadDimensionProducts: function() {
  372. var self = this
  373. getProductsByDomain('body', 1, 4).then(function(res) {
  374. if (res && res.data) {
  375. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  376. self.dimensionProducts = list.slice(0, 4)
  377. }
  378. }).catch(function() { self.dimensionProducts = [] })
  379. },
  380. loadFeaturedArticles: function() {
  381. var self = this
  382. getFeaturedArticles({ size: 5 }).then(function(res) {
  383. if (res.code === 200 && res.data) {
  384. var gradientColors = [
  385. 'linear-gradient(135deg, #FF8C42, #FFB074)',
  386. 'linear-gradient(135deg, #FF6B9D, #FF9DBD)',
  387. 'linear-gradient(135deg, #6366F1, #818CF8)',
  388. 'linear-gradient(135deg, #10B981, #34D399)',
  389. 'linear-gradient(135deg, #F59E0B, #FBBF24)'
  390. ]
  391. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  392. self.bodyArticles = list.map(function(item, index) {
  393. return {
  394. id: item.id,
  395. category: item.categoryName || '身体健康',
  396. categoryColor: gradientColors[index % gradientColors.length],
  397. title: item.title || '',
  398. summary: item.summary || '',
  399. views: item.viewCount ? String(item.viewCount) : '0',
  400. date: item.publishedAt ? item.publishedAt.slice(0, 10) : ''
  401. }
  402. })
  403. }
  404. }.bind(this)).catch(function() {})
  405. },
  406. onFamilyMemberSelect: function(member) {
  407. this.selectedMemberId = member.id
  408. },
  409. onChildChanged: function(child) {
  410. this.activeChildId = child.childId
  411. this.activeChildName = child.name || child.nickname || '孩子'
  412. this.loadDashboardData()
  413. },
  414. loadFamilyMembersVisible: function() {
  415. var self = this
  416. getVisibleFamilyMembers().then(function(res) {
  417. self.familyMembersVisible = res.data || []
  418. }).catch(function(e) {
  419. console.log('获取可见家庭成员失败', e)
  420. self.familyMembersVisible = []
  421. })
  422. },
  423. scrollToSection: function(section) {
  424. uni.pageScrollTo({ selector: '#' + section, duration: 300 })
  425. },
  426. onTaskClick: function(task) {
  427. uni.navigateTo({ url: '/pages/tasks/tasks' })
  428. },
  429. goActivityDetail: function(act) {
  430. if (!act || !act.id) return
  431. uni.navigateTo({ url: '/pages/discover-detail/activity-detail/activity-detail?id=' + act.id })
  432. },
  433. goMoreActivities: function() {
  434. uni.navigateTo({ url: '/pages/activity/index' })
  435. },
  436. goProductDetail: function(prod) {
  437. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  438. },
  439. goMoreProducts: function() {
  440. uni.navigateTo({ url: '/pages/shop/index' })
  441. },
  442. goArticleDetail: function(article) {
  443. var id = article.id || article
  444. uni.navigateTo({ url: '/pages/mind-detail/article-detail?id=' + id })
  445. },
  446. goMoreArticles: function() {
  447. uni.navigateTo({ url: '/pages/article-center/index?dimension=body' })
  448. },
  449. goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  450. goMemberDetail: function(member) {
  451. if (!member || !member.memberId) return
  452. uni.navigateTo({
  453. url: '/pages/member-detail/member-detail?memberId=' + member.memberId + '&memberType=' + (member.memberType || 'child') + '&entrySource=relation-graph&dimensionCode=body'
  454. })
  455. },
  456. goFamilyMembers: function() {
  457. uni.navigateTo({ url: '/pages/profile/family-members' })
  458. },
  459. sectionVisible: function(key) {
  460. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  461. },
  462. onFuncClick: function(item) {
  463. if (item.needLogin && !this.isLoggedIn) {
  464. uni.showModal({
  465. title: '提示',
  466. content: '请先登录后使用此功能',
  467. success: function(res) {
  468. if (res.confirm) uni.navigateTo({ url: '/pages/login/login' })
  469. }
  470. })
  471. return
  472. }
  473. if (item.page === 'health-dimensions') {
  474. if (!this.activeChildId) {
  475. uni.showToast({ title: '请先选择孩子', icon: 'none' })
  476. return
  477. }
  478. uni.navigateTo({ url: '/pages/body-detail/health-dimensions?childId=' + this.activeChildId })
  479. return
  480. }
  481. if (item.page) uni.navigateTo({ url: item.page })
  482. },
  483. goDimensionDetail: function(dimKey) {
  484. uni.navigateTo({ url: '/pages/body/dimension-detail?dimension=' + dimKey + '&childId=' + this.activeChildId })
  485. },
  486. goToCheckin: function() {
  487. var id = this.activeChildId || uni.getStorageSync('currentChildId')
  488. if (!id) {
  489. uni.showToast({ title: '请先选择成员', icon: 'none' })
  490. return
  491. }
  492. uni.navigateTo({ url: '/pages/body-detail/checkin?childId=' + id })
  493. },
  494. goToNutritionProfile: function() {
  495. var id = this.activeChildId || uni.getStorageSync('currentChildId')
  496. if (!id) {
  497. uni.showToast({ title: '请先选择成员', icon: 'none' })
  498. return
  499. }
  500. uni.navigateTo({ url: '/pages/health/nutrition-profile?childId=' + id })
  501. },
  502. goToUploadReport: function() {
  503. var id = this.activeChildId || uni.getStorageSync('currentChildId') || ''
  504. uni.navigateTo({ url: '/pages/health/report-upload?childId=' + id + '&from=body' })
  505. },
  506. _watchPageReady() {
  507. var self = this
  508. var unwatch = this.$watch(function() {
  509. if (self.isLoggedIn) {
  510. return !!(self.dualDimension || self.sandboxData || (self.dimensionTasks && self.dimensionTasks.length > 0))
  511. }
  512. return !!(self.dimensionActivities && self.dimensionActivities.length > 0) ||
  513. !!(self.dimensionProducts && self.dimensionProducts.length > 0)
  514. }, function(val) {
  515. if (val) {
  516. if (unwatch) unwatch()
  517. self.showTabTransition = false
  518. }
  519. })
  520. setTimeout(function() {
  521. if (unwatch) unwatch()
  522. self.showTabTransition = false
  523. }, 5000)
  524. }
  525. }
  526. }
  527. </script>
  528. <style scoped>
  529. .body-container {
  530. min-height: 100vh;
  531. background: #f5f7fa;
  532. padding-bottom: 120rpx;
  533. }
  534. /* ===== 功能入口 ===== */
  535. .func-section {
  536. margin: 20rpx 30rpx;
  537. }
  538. .func-grid {
  539. display: flex;
  540. flex-direction: row;
  541. justify-content: space-between;
  542. background: #fff;
  543. border-radius: 20rpx;
  544. padding: 24rpx 16rpx;
  545. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  546. }
  547. .func-item {
  548. display: flex;
  549. flex-direction: column;
  550. align-items: center;
  551. flex: 1;
  552. }
  553. .func-icon-wrap {
  554. width: 80rpx;
  555. height: 80rpx;
  556. border-radius: 40rpx;
  557. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  558. display: flex;
  559. align-items: center;
  560. justify-content: center;
  561. margin-bottom: 10rpx;
  562. }
  563. .func-icon {
  564. font-size: 40rpx;
  565. }
  566. .func-label {
  567. font-size: 22rpx;
  568. color: #666;
  569. font-weight: 500;
  570. }
  571. /* ===== 通用区块 ===== */
  572. .section {
  573. margin: 20rpx 30rpx;
  574. }
  575. .section-header {
  576. display: flex;
  577. flex-direction: row;
  578. align-items: center;
  579. justify-content: space-between;
  580. margin-bottom: 16rpx;
  581. }
  582. .section-title {
  583. font-size: 30rpx;
  584. font-weight: bold;
  585. color: #333;
  586. }
  587. .avg-badge {
  588. font-size: 20rpx;
  589. color: #F97316;
  590. background: #FFF7ED;
  591. padding: 4rpx 12rpx;
  592. border-radius: 20rpx;
  593. margin-left: 12rpx;
  594. }
  595. /* ===== 快捷操作 ===== */
  596. .quick-actions {
  597. display: flex;
  598. flex-direction: row;
  599. margin-top: 30rpx;
  600. }
  601. .action-btn {
  602. flex: 1;
  603. background: #fff;
  604. border-radius: 16rpx;
  605. padding: 24rpx;
  606. display: flex;
  607. flex-direction: column;
  608. align-items: center;
  609. margin-right: 20rpx;
  610. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  611. }
  612. .action-btn:last-child {
  613. margin-right: 0;
  614. }
  615. .action-icon {
  616. font-size: 48rpx;
  617. margin-bottom: 8rpx;
  618. }
  619. .action-text {
  620. font-size: 26rpx;
  621. color: #666;
  622. }
  623. /* ===== 底部 ===== */
  624. .bottom-spacer {
  625. height: 120rpx;
  626. }
  627. .func-item:active, .action-btn:active {
  628. opacity: 0.7;
  629. }
  630. /* ===== 精准营养 ===== */
  631. .nutrition-section {
  632. margin-top: 20rpx;
  633. }
  634. .nutrition-report-card {
  635. display: flex;
  636. flex-direction: row;
  637. align-items: center;
  638. background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
  639. border-radius: 20rpx;
  640. padding: 28rpx 24rpx;
  641. margin-bottom: 20rpx;
  642. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  643. }
  644. .nutrition-report-left {
  645. width: 100rpx;
  646. height: 100rpx;
  647. background: rgba(255,255,255,0.7);
  648. border-radius: 20rpx;
  649. display: flex;
  650. align-items: center;
  651. justify-content: center;
  652. margin-right: 20rpx;
  653. flex-shrink: 0;
  654. }
  655. .nutrition-icon-large {
  656. font-size: 52rpx;
  657. }
  658. .nutrition-report-right {
  659. flex: 1;
  660. }
  661. .nutrition-title {
  662. font-size: 30rpx;
  663. font-weight: bold;
  664. color: #2E7D32;
  665. display: block;
  666. margin-bottom: 6rpx;
  667. }
  668. .nutrition-desc {
  669. font-size: 22rpx;
  670. color: #558B2F;
  671. line-height: 1.5;
  672. display: block;
  673. margin-bottom: 10rpx;
  674. }
  675. .nutrition-report-tags {
  676. display: flex;
  677. flex-direction: row;
  678. gap: 10rpx;
  679. }
  680. .nutrition-report-tags .tag {
  681. font-size: 20rpx;
  682. color: #33691E;
  683. background: rgba(255,255,255,0.6);
  684. padding: 4rpx 14rpx;
  685. border-radius: 20rpx;
  686. }
  687. .nutrition-arrow {
  688. font-size: 40rpx;
  689. color: #A5D6A7;
  690. margin-left: 12rpx;
  691. }
  692. .nutrition-links {
  693. margin-bottom: 20rpx;
  694. }
  695. .links-label {
  696. font-size: 26rpx;
  697. font-weight: bold;
  698. color: #333;
  699. display: block;
  700. margin-bottom: 12rpx;
  701. }
  702. .links-row {
  703. display: flex;
  704. flex-direction: row;
  705. gap: 16rpx;
  706. }
  707. .link-item {
  708. flex: 1;
  709. display: flex;
  710. flex-direction: row;
  711. align-items: center;
  712. background: #fff;
  713. border-radius: 16rpx;
  714. padding: 20rpx 18rpx;
  715. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  716. gap: 12rpx;
  717. }
  718. .link-item:active {
  719. opacity: 0.7;
  720. }
  721. .link-icon {
  722. font-size: 36rpx;
  723. flex-shrink: 0;
  724. }
  725. .link-texts {
  726. flex: 1;
  727. }
  728. .link-name {
  729. font-size: 24rpx;
  730. font-weight: 500;
  731. color: #333;
  732. display: block;
  733. margin-bottom: 4rpx;
  734. }
  735. .link-desc {
  736. font-size: 20rpx;
  737. color: #999;
  738. display: block;
  739. }
  740. .link-arrow {
  741. font-size: 32rpx;
  742. color: #CCC;
  743. flex-shrink: 0;
  744. }
  745. /* ===== 推荐阅读 ===== */
  746. .article-list {
  747. display: flex;
  748. flex-direction: column;
  749. gap: 16rpx;
  750. }
  751. .article-card {
  752. background: #fff;
  753. border-radius: 16rpx;
  754. padding: 24rpx;
  755. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  756. }
  757. .article-card:active {
  758. opacity: 0.8;
  759. }
  760. .article-category {
  761. display: inline-block;
  762. padding: 4rpx 14rpx;
  763. border-radius: 8rpx;
  764. margin-bottom: 10rpx;
  765. }
  766. .article-category-text {
  767. font-size: 20rpx;
  768. color: #fff;
  769. }
  770. .article-title {
  771. display: block;
  772. font-size: 28rpx;
  773. font-weight: bold;
  774. color: #333;
  775. margin-bottom: 8rpx;
  776. line-height: 1.4;
  777. }
  778. .article-summary {
  779. display: block;
  780. font-size: 24rpx;
  781. color: #888;
  782. line-height: 1.5;
  783. margin-bottom: 12rpx;
  784. overflow: hidden;
  785. text-overflow: ellipsis;
  786. display: -webkit-box;
  787. -webkit-line-clamp: 2;
  788. -webkit-box-orient: vertical;
  789. }
  790. .article-meta {
  791. display: flex;
  792. align-items: center;
  793. gap: 16rpx;
  794. }
  795. .meta-item {
  796. display: flex;
  797. align-items: center;
  798. gap: 4rpx;
  799. }
  800. .meta-icon {
  801. font-size: 24rpx;
  802. }
  803. .meta-text {
  804. font-size: 22rpx;
  805. color: #999;
  806. }
  807. .article-date {
  808. font-size: 22rpx;
  809. color: #bbb;
  810. }
  811. </style>