index.vue 24 KB

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