index.vue 24 KB

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