index.vue 24 KB

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