index.vue 24 KB

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