health-report.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. <template>
  2. <view class="report-container">
  3. <!-- 顶部导航 -->
  4. <view class="nav-bar">
  5. <text class="nav-back" @click="goBack">‹ 返回</text>
  6. <text class="nav-title">健康报告详情</text>
  7. <view class="nav-placeholder"></view>
  8. </view>
  9. <!-- 报告头部 -->
  10. <view class="report-header" v-if="report">
  11. <view class="report-type-tag">{{ reportTypeLabel }}</view>
  12. <view class="report-scores">
  13. <view class="score-item">
  14. <view class="score-circle-lg">
  15. <text class="score-num">{{ report.overallScore || '--' }}</text>
  16. <text class="score-unit">分</text>
  17. </view>
  18. <text class="score-label">综合评分</text>
  19. </view>
  20. <view class="score-item" v-if="report.gutHealthScore">
  21. <view class="score-circle-lg score-circle-green">
  22. <text class="score-num">{{ report.gutHealthScore }}</text>
  23. <text class="score-unit">分</text>
  24. </view>
  25. <text class="score-label">肠道健康</text>
  26. </view>
  27. </view>
  28. <view class="report-info-row" v-if="report.gutAge || report.gutType">
  29. <text class="info-chip" v-if="report.gutAge">肠道年龄:{{ report.gutAge }}</text>
  30. <text class="info-chip" v-if="report.gutType">肠道分型:{{ report.gutType }}</text>
  31. </view>
  32. <text class="report-date">报告日期:{{ formatDate(report.reportDate) }}</text>
  33. </view>
  34. <!-- ===== 评分可视化面板 (仅菌群报告) ===== -->
  35. <view class="score-dashboard" v-if="report && report.reportType === 'gut_flora'">
  36. <view class="main-scores">
  37. <view class="main-score-item" v-for="item in mainScores" :key="item.key">
  38. <view class="score-ring-wrap">
  39. <svg width="140" height="140" viewBox="0 0 120 120">
  40. <circle cx="60" cy="60" r="50" fill="none" stroke="#EEEEEE" stroke-width="8"/>
  41. <circle cx="60" cy="60" r="50" fill="none" v-bind:stroke="item.color" stroke-width="8" v-bind:stroke-dasharray="item.circumference" v-bind:stroke-dashoffset="item.offset" stroke-linecap="round" transform="rotate(-90 60 60)"/>
  42. <text x="60" y="52" text-anchor="middle" font-size="32" font-weight="bold" fill="#333">{{ item.score }}</text>
  43. <text x="60" y="72" text-anchor="middle" font-size="14" fill="#999">分</text>
  44. </svg>
  45. </view>
  46. <text class="main-score-label">{{ item.label }}</text>
  47. </view>
  48. </view>
  49. <view class="flora-score-row" v-if="hasFloraScores">
  50. <view class="flora-score-item" v-for="item in floraScores" :key="item.key">
  51. <view class="flora-score-circle" v-bind:style="{ background: item.color }">
  52. <text class="flora-score-num">{{ item.score }}</text>
  53. </view>
  54. <text class="flora-score-label">{{ item.label }}</text>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 指标列表 -->
  59. <view class="section">
  60. <view class="section-title">
  61. <text>指标明细</text>
  62. <text class="section-sub">共 {{ indicators.length }} 项</text>
  63. </view>
  64. <!-- 按分类分组 -->
  65. <view class="category-group" v-for="group in groupedIndicators" :key="group.name">
  66. <view class="category-header">
  67. <text class="category-name">{{ group.name }}</text>
  68. <text class="category-count">{{ group.items.length }}项</text>
  69. </view>
  70. <view class="indicator-card" v-for="ind in group.items" :key="ind._idx">
  71. <view class="ind-header">
  72. <text class="ind-name">{{ ind.indicatorName }}</text>
  73. <view class="ind-status" :class="ind._cls">
  74. <text>{{ ind._label }}</text>
  75. </view>
  76. </view>
  77. <view class="ind-body">
  78. <view class="ind-value-wrap">
  79. <text class="ind-value">{{ ind.indicatorValue || '--' }}</text>
  80. <text class="ind-unit">{{ ind.unit || '' }}</text>
  81. </view>
  82. <text class="ind-ref">参考值:{{ ind.refRange || '暂无' }}</text>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="empty-indicators" v-if="indicators.length === 0 && !loading">
  87. <text>暂无指标数据</text>
  88. </view>
  89. </view>
  90. <!-- ===== 营养缺乏分析 ===== -->
  91. <view class="section" v-if="deficiencyRecords && deficiencyRecords.length > 0">
  92. <view class="section-title">
  93. <text>🔬 营养缺乏分析</text>
  94. <text class="section-sub">{{ deficiencyRecords.length }}项</text>
  95. </view>
  96. <view class="deficiency-list">
  97. <view class="deficiency-card" v-for="dr in deficiencyRecords" :key="dr.nutrient">
  98. <view class="deficiency-header">
  99. <text class="deficiency-nutrient">{{ dr.nutrient }}</text>
  100. <view class="deficiency-type-tag" :class="'dtype-' + dr.deficiencyType">
  101. <text>{{ getDeficiencyTypeLabel(dr.deficiencyType) }}</text>
  102. </view>
  103. </view>
  104. <view class="deficiency-severity-row">
  105. <view class="severity-bar">
  106. <view class="severity-fill" :style="{ width: (dr.severity * 100) + '%', background: getSeverityColor(dr.severity) }"></view>
  107. </view>
  108. <text class="severity-val">{{ dr.severity }}</text>
  109. </view>
  110. <view class="deficiency-meta" v-if="dr.indicatorName">
  111. <text class="meta-label">关联指标:</text>
  112. <text class="meta-value">{{ dr.indicatorName }} ({{ dr.indicatorValue }})</text>
  113. </view>
  114. <view class="deficiency-foods" v-if="dr.foodSuggestions">
  115. <text class="foods-label">推荐食物:</text>
  116. <text class="foods-value">{{ dr.foodSuggestions }}</text>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <!-- ===== 五维雷达图 (菌群报告) ===== -->
  122. <view class="section" v-if="report && report.reportType === 'gut_flora' && radarDimensions.length > 0">
  123. <view class="section-title">
  124. <text>五维雷达图</text>
  125. </view>
  126. <view class="radar-wrap">
  127. <canvas canvas-id="radarCanvas" id="radarCanvas" class="radar-canvas" @touchstart.prevent></canvas>
  128. </view>
  129. </view>
  130. <!-- 底部占位 -->
  131. <view class="bottom-spacer"></view>
  132. <!-- 营养分析入口按钮 -->
  133. <view class="nutrition-fab" @click="goNutritionChat" v-if="report">
  134. <text class="fab-icon">🥗</text>
  135. <text class="fab-text">精准营养分析</text>
  136. </view>
  137. </view>
  138. </template>
  139. <script>
  140. import config from '@/config.js'
  141. import { getDeficiencyAnalysis } from '@/utils/api.js'
  142. const healthRequest = function(url, data) {
  143. var token = uni.getStorageSync('token')
  144. return new Promise(function(resolve, reject) {
  145. uni.request({
  146. url: config.API_BASE_URL + url,
  147. method: 'POST',
  148. data: data,
  149. header: {
  150. 'Content-Type': 'application/json',
  151. 'Authorization': token ? 'Bearer ' + token : ''
  152. },
  153. success: function(res) {
  154. if (res.data.code === 200) {
  155. resolve(res.data)
  156. } else {
  157. reject(res.data)
  158. }
  159. },
  160. fail: function(err) {
  161. reject(err)
  162. }
  163. })
  164. })
  165. }
  166. export default {
  167. data() {
  168. return {
  169. childId: null,
  170. reportId: null,
  171. report: null,
  172. reportDetail: null,
  173. indicators: [],
  174. deficiencyRecords: [],
  175. loading: false
  176. }
  177. },
  178. computed: {
  179. reportTypeLabel: function() {
  180. if (!this.report) return ''
  181. return this.report.reportType === 'gut_flora' ? '肠道检测报告' : '体检报告'
  182. },
  183. // 预计算分组,每个指标附加 _cls (CSS类) 和 _label (显示标签)
  184. groupedIndicators: function() {
  185. var result = []
  186. var groupMap = {}
  187. var idx = 0
  188. for (var i = 0; i < this.indicators.length; i++) {
  189. var ind = this.indicators[i]
  190. var cat = ind.category || '其他'
  191. // Compute status css class
  192. var cls = 'status-normal'
  193. var label = '正常'
  194. var status = ind.status || ''
  195. var s = status.toLowerCase()
  196. if (s.indexOf('偏高') !== -1 || s.indexOf('过高') !== -1 || s.indexOf('concern') !== -1) {
  197. cls = 'status-warning'
  198. label = '偏高'
  199. } else if (s.indexOf('偏低') !== -1 || s.indexOf('过低') !== -1 || s.indexOf('注意') !== -1 || s.indexOf('warning') !== -1) {
  200. cls = 'status-warn'
  201. label = '偏低'
  202. } else if (s.indexOf('正常') !== -1 || s.indexOf('normal') !== -1 || s.indexOf('低风险') !== -1) {
  203. cls = 'status-normal'
  204. label = '正常'
  205. } else if (status) {
  206. label = status
  207. }
  208. ind._cls = cls
  209. ind._label = label
  210. ind._idx = idx
  211. idx++
  212. // Group
  213. if (!groupMap[cat]) {
  214. groupMap[cat] = { name: cat, items: [] }
  215. result.push(groupMap[cat])
  216. }
  217. groupMap[cat].items.push(ind)
  218. }
  219. return result
  220. },
  221. circumference: function() {
  222. return Math.round(2 * Math.PI * 50)
  223. },
  224. mainScores: function() {
  225. if (!this.report) return []
  226. var items = []
  227. var r = this.report
  228. var pairs = [
  229. {key:'overall', label:'综合评分', score: r.overallScore, color:'#5B9BD5'},
  230. {key:'gut', label:'肠道健康', score: r.gutHealthScore, color:'#4CAF50'},
  231. {key:'chronic', label:'慢病控制', score: r.chronicDiseaseScore, color:'#FF9800'},
  232. {key:'nutrition', label:'营养均衡', score: r.nutritionScore, color:'#2196F3'}
  233. ]
  234. var circ = Math.round(2 * Math.PI * 50)
  235. for (var i = 0; i < pairs.length; i++) {
  236. var p = pairs[i]
  237. var s = p.score || 0
  238. items.push({key: p.key, label: p.label, score: s, color: p.color, circumference: circ, offset: Math.round(circ - (s / 100) * circ)})
  239. }
  240. return items
  241. },
  242. hasFloraScores: function() {
  243. if (!this.report) return false
  244. var r = this.report
  245. return (r.balanceScore != null) || (r.diversityScore != null) || (r.beneficialScore != null) || (r.harmfulScore != null) || (r.coreGenusScore != null)
  246. },
  247. floraScores: function() {
  248. if (!this.report) return []
  249. var r = this.report
  250. var items = []
  251. var pairs = [
  252. {key:'balance', label:'菌群平衡', score: r.balanceScore},
  253. {key:'diversity', label:'菌群多样性', score: r.diversityScore},
  254. {key:'beneficial', label:'有益菌', score: r.beneficialScore},
  255. {key:'harmful', label:'有害菌', score: r.harmfulScore},
  256. {key:'coreGenus', label:'核心菌属', score: r.coreGenusScore}
  257. ]
  258. for (var i = 0; i < pairs.length; i++) {
  259. var p = pairs[i]
  260. if (p.score != null) {
  261. var s = p.score
  262. var color = '#4CAF50'
  263. if (s < 30) { color = '#F44336' }
  264. else if (s < 60) { color = '#FFC107' }
  265. items.push({key: p.key, label: p.label, score: s, color: color})
  266. }
  267. }
  268. return items
  269. },
  270. radarDimensions: function() {
  271. if (!this.report) return []
  272. var r = this.report
  273. var dims = []
  274. if (r.overallScore != null) dims.push({ label: '综合', value: r.overallScore })
  275. if (r.gutHealthScore != null) dims.push({ label: '肠道', value: r.gutHealthScore })
  276. if (r.nutritionScore != null) dims.push({ label: '营养', value: r.nutritionScore })
  277. if (r.chronicDiseaseScore != null) dims.push({ label: '慢病', value: r.chronicDiseaseScore })
  278. if (r.gutBalanceScore != null) dims.push({ label: '菌群平衡', value: r.gutBalanceScore })
  279. return dims
  280. }
  281. },
  282. onLoad: function(options) {
  283. var childId = options.childId
  284. var reportId = options.reportId
  285. this.childId = childId ? parseInt(childId) : null
  286. this.reportId = reportId ? parseInt(reportId) : null
  287. this.loadData()
  288. },
  289. onReady: function() {
  290. if (this.radarDimensions.length >= 3) {
  291. this.drawRadarChart()
  292. }
  293. },
  294. methods: {
  295. loadData: function() {
  296. var self = this
  297. uni.showLoading({ title: '加载中...' })
  298. // Load report + indicators in parallel
  299. var promises = []
  300. if (this.reportId) {
  301. promises.push(healthRequest('/api/health/report/latest', { childId: this.childId }))
  302. promises.push(healthRequest('/api/health/indicator/list', { reportId: this.reportId }))
  303. } else if (this.childId) {
  304. promises.push(healthRequest('/api/health/report/latest', { childId: this.childId }))
  305. }
  306. Promise.all(promises.map(function(p) {
  307. return p.catch(function(e) { return null })
  308. })).then(function(results) {
  309. uni.hideLoading()
  310. if (results[0] && results[0].data) {
  311. self.report = results[0].data
  312. self.reportId = self.report.id
  313. self.loadDeficiencyRecords()
  314. // Load indicators after getting reportId
  315. if (self.reportId) {
  316. healthRequest('/api/health/indicator/list', { reportId: self.reportId }).then(function(res) {
  317. if (res.data) {
  318. self.indicators = res.data
  319. }
  320. }).catch(function(e) {
  321. console.log('获取指标失败', e)
  322. })
  323. healthRequest('/api/health/report/detail', { reportId: self.reportId }).then(function(res) {
  324. if (res.data) {
  325. self.reportDetail = res.data
  326. }
  327. }).catch(function(e) {
  328. console.log('获取报告详情失败', e)
  329. })
  330. }
  331. }
  332. }).catch(function(e) {
  333. uni.hideLoading()
  334. uni.showToast({ title: '加载失败', icon: 'none' })
  335. })
  336. },
  337. goBack: function() {
  338. uni.navigateBack()
  339. },
  340. goNutritionChat: function() {
  341. if (!this.reportId) return
  342. uni.navigateTo({
  343. url: '/pages/ai/chat?mode=nutrition&reportId=' + this.reportId + '&firstMessage=' + encodeURIComponent('请根据这份菌群检测报告,分析我孩子的营养状况并提出建议')
  344. })
  345. },
  346. loadDeficiencyRecords: function() {
  347. if (!this.childId) return
  348. var self = this
  349. getDeficiencyAnalysis(this.childId).then(function(res) {
  350. if (res.code === 200 && res.data) {
  351. self.deficiencyRecords = res.data
  352. }
  353. }).catch(function(e) {
  354. console.log('获取缺乏分析失败', e)
  355. })
  356. },
  357. getDeficiencyTypeLabel: function(type) {
  358. if (type === 'deficiency') return '缺乏'
  359. if (type === 'excess') return '偏高'
  360. if (type === 'borderline') return '边界值'
  361. return '未分类'
  362. },
  363. getSeverityColor: function(severity) {
  364. if (severity >= 0.7) return '#EF4444'
  365. if (severity >= 0.3) return '#F59E0B'
  366. return '#10B981'
  367. },
  368. drawRadarChart: function() {
  369. var dims = this.radarDimensions
  370. if (!dims || dims.length < 3) return
  371. var ctx = uni.createCanvasContext('radarCanvas', this)
  372. var cw = 300
  373. var ch = 300
  374. var cx = cw / 2
  375. var cy = ch / 2
  376. var maxR = 110
  377. var n = dims.length
  378. var angleStep = (2 * Math.PI) / n
  379. for (var level = 1; level <= 5; level++) {
  380. var r = maxR * (level / 5)
  381. ctx.setStrokeStyle('#E5E7EB')
  382. ctx.setLineWidth(1)
  383. ctx.beginPath()
  384. for (var j = 0; j < n; j++) {
  385. var a = j * angleStep - Math.PI / 2
  386. var x = cx + r * Math.cos(a)
  387. var y = cy + r * Math.sin(a)
  388. if (j === 0) ctx.moveTo(x, y)
  389. else ctx.lineTo(x, y)
  390. }
  391. ctx.closePath()
  392. ctx.stroke()
  393. }
  394. for (var k = 0; k < n; k++) {
  395. var a2 = k * angleStep - Math.PI / 2
  396. ctx.beginPath()
  397. ctx.moveTo(cx, cy)
  398. ctx.lineTo(cx + maxR * Math.cos(a2), cy + maxR * Math.sin(a2))
  399. ctx.setStrokeStyle('#E5E7EB')
  400. ctx.setLineWidth(1)
  401. ctx.stroke()
  402. }
  403. ctx.beginPath()
  404. for (var m = 0; m < n; m++) {
  405. var angle = m * angleStep - Math.PI / 2
  406. var val = dims[m].value || 0
  407. var rr = maxR * (val / 100)
  408. var px = cx + rr * Math.cos(angle)
  409. var py = cy + rr * Math.sin(angle)
  410. if (m === 0) ctx.moveTo(px, py)
  411. else ctx.lineTo(px, py)
  412. }
  413. ctx.closePath()
  414. ctx.setFillStyle('rgba(249, 115, 22, 0.2)')
  415. ctx.fill()
  416. ctx.setStrokeStyle('#F97316')
  417. ctx.setLineWidth(2)
  418. ctx.stroke()
  419. for (var q = 0; q < n; q++) {
  420. var angle3 = q * angleStep - Math.PI / 2
  421. var lx = cx + (maxR + 20) * Math.cos(angle3)
  422. var ly = cy + (maxR + 20) * Math.sin(angle3)
  423. ctx.setFontSize(11)
  424. ctx.setFillStyle('#6B7280')
  425. ctx.setTextAlign('center')
  426. ctx.setTextBaseline('middle')
  427. ctx.fillText(dims[q].label + ' ' + (dims[q].value || '--'), lx, ly)
  428. }
  429. ctx.draw()
  430. },
  431. formatDate: function(dateStr) {
  432. if (!dateStr) return '--'
  433. try {
  434. var d = new Date(dateStr)
  435. var y = d.getFullYear()
  436. var m = ('' + (d.getMonth() + 1)).padStart(2, '0')
  437. var day = ('' + d.getDate()).padStart(2, '0')
  438. return y + '-' + m + '-' + day
  439. } catch (e) {
  440. return dateStr
  441. }
  442. }
  443. }
  444. }
  445. </script>
  446. <style scoped>
  447. .report-container {
  448. min-height: 100vh;
  449. background: #f5f7fa;
  450. }
  451. /* ===== 导航栏 ===== */
  452. .nav-bar {
  453. position: sticky;
  454. top: 0;
  455. background: #fff;
  456. display: flex;
  457. flex-direction: row;
  458. align-items: center;
  459. justify-content: space-between;
  460. padding: 20rpx 30rpx;
  461. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  462. z-index: 100;
  463. }
  464. .nav-back {
  465. font-size: 32rpx;
  466. color: #5B9BD5;
  467. }
  468. .nav-title {
  469. font-size: 32rpx;
  470. font-weight: bold;
  471. color: #333;
  472. }
  473. .nav-placeholder {
  474. width: 80rpx;
  475. }
  476. /* ===== 报告头部 ===== */
  477. .report-header {
  478. background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
  479. margin: 20rpx 30rpx;
  480. border-radius: 20rpx;
  481. padding: 30rpx 24rpx;
  482. }
  483. .report-type-tag {
  484. display: inline-block;
  485. background: #1565C0;
  486. color: #fff;
  487. font-size: 22rpx;
  488. padding: 6rpx 20rpx;
  489. border-radius: 20rpx;
  490. margin-bottom: 20rpx;
  491. }
  492. .report-scores {
  493. display: flex;
  494. flex-direction: row;
  495. margin-bottom: 20rpx;
  496. }
  497. .score-item {
  498. display: flex;
  499. flex-direction: column;
  500. align-items: center;
  501. margin-right: 60rpx;
  502. }
  503. .score-circle-lg {
  504. width: 140rpx;
  505. height: 140rpx;
  506. border-radius: 70rpx;
  507. background: #fff;
  508. display: flex;
  509. flex-direction: column;
  510. align-items: center;
  511. justify-content: center;
  512. margin-bottom: 8rpx;
  513. }
  514. .score-circle-green {
  515. background: #E8F5E9;
  516. }
  517. .score-num {
  518. font-size: 48rpx;
  519. font-weight: bold;
  520. color: #1565C0;
  521. }
  522. .score-circle-green .score-num {
  523. color: #2E7D32;
  524. }
  525. .score-unit {
  526. font-size: 22rpx;
  527. color: #64B5F6;
  528. }
  529. .score-circle-green .score-unit {
  530. color: #81C784;
  531. }
  532. .score-label {
  533. font-size: 24rpx;
  534. color: #666;
  535. }
  536. .report-info-row {
  537. display: flex;
  538. flex-direction: row;
  539. margin-bottom: 16rpx;
  540. }
  541. .info-chip {
  542. background: #fff;
  543. color: #333;
  544. font-size: 24rpx;
  545. padding: 8rpx 20rpx;
  546. border-radius: 20rpx;
  547. margin-right: 16rpx;
  548. }
  549. .report-date {
  550. font-size: 22rpx;
  551. color: #888;
  552. }
  553. /* ===== 指标明细 ===== */
  554. .section {
  555. margin: 20rpx 30rpx;
  556. }
  557. .section-title {
  558. display: flex;
  559. flex-direction: row;
  560. align-items: baseline;
  561. margin-bottom: 20rpx;
  562. font-size: 30rpx;
  563. font-weight: bold;
  564. color: #333;
  565. }
  566. .section-sub {
  567. font-size: 22rpx;
  568. color: #999;
  569. font-weight: normal;
  570. margin-left: 12rpx;
  571. }
  572. .category-group {
  573. margin-bottom: 30rpx;
  574. }
  575. .category-header {
  576. display: flex;
  577. flex-direction: row;
  578. align-items: center;
  579. justify-content: space-between;
  580. margin-bottom: 12rpx;
  581. }
  582. .category-name {
  583. font-size: 26rpx;
  584. font-weight: bold;
  585. color: #333;
  586. }
  587. .category-count {
  588. font-size: 22rpx;
  589. color: #999;
  590. }
  591. .indicator-card {
  592. background: #fff;
  593. border-radius: 16rpx;
  594. padding: 20rpx;
  595. margin-bottom: 12rpx;
  596. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  597. }
  598. .ind-header {
  599. display: flex;
  600. flex-direction: row;
  601. align-items: center;
  602. justify-content: space-between;
  603. margin-bottom: 12rpx;
  604. }
  605. .ind-name {
  606. font-size: 28rpx;
  607. color: #333;
  608. font-weight: 500;
  609. }
  610. .ind-status {
  611. font-size: 22rpx;
  612. padding: 4rpx 16rpx;
  613. border-radius: 16rpx;
  614. }
  615. .status-normal {
  616. background: #E8F5E9;
  617. color: #2E7D32;
  618. }
  619. .status-warning {
  620. background: #FFF3E0;
  621. color: #E65100;
  622. }
  623. .status-warn {
  624. background: #F3E5F5;
  625. color: #7B1FA2;
  626. }
  627. .ind-body {
  628. display: flex;
  629. flex-direction: row;
  630. align-items: baseline;
  631. justify-content: space-between;
  632. }
  633. .ind-value-wrap {
  634. display: flex;
  635. flex-direction: row;
  636. align-items: baseline;
  637. }
  638. .ind-value {
  639. font-size: 36rpx;
  640. font-weight: bold;
  641. color: #1565C0;
  642. }
  643. .ind-unit {
  644. font-size: 24rpx;
  645. color: #999;
  646. margin-left: 8rpx;
  647. }
  648. .ind-ref {
  649. font-size: 22rpx;
  650. color: #bbb;
  651. }
  652. .empty-indicators {
  653. text-align: center;
  654. padding: 60rpx;
  655. color: #999;
  656. font-size: 28rpx;
  657. }
  658. /* ===== 底部 ===== */
  659. .bottom-spacer {
  660. height: 130rpx;
  661. }
  662. /* ===== 营养分析入口 FAB ===== */
  663. .nutrition-fab {
  664. position: fixed;
  665. bottom: 40rpx;
  666. left: 50%;
  667. transform: translateX(-50%);
  668. background: linear-gradient(135deg, #43A047, #66BB6A);
  669. color: #fff;
  670. display: flex;
  671. flex-direction: row;
  672. align-items: center;
  673. padding: 20rpx 40rpx;
  674. border-radius: 50rpx;
  675. box-shadow: 0 8rpx 24rpx rgba(67, 160, 71, 0.4);
  676. z-index: 200;
  677. }
  678. .fab-icon {
  679. font-size: 36rpx;
  680. margin-right: 12rpx;
  681. }
  682. .fab-text {
  683. font-size: 30rpx;
  684. font-weight: 600;
  685. }
  686. .score-dashboard {
  687. margin: 20rpx 30rpx;
  688. background: #fff;
  689. border-radius: 20rpx;
  690. padding: 24rpx;
  691. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  692. }
  693. .main-scores {
  694. display: flex;
  695. flex-direction: row;
  696. flex-wrap: wrap;
  697. justify-content: space-around;
  698. }
  699. .main-score-item {
  700. display: flex;
  701. flex-direction: column;
  702. align-items: center;
  703. margin-bottom: 20rpx;
  704. width: 45%;
  705. }
  706. .score-ring-wrap {
  707. margin-bottom: 8rpx;
  708. }
  709. .main-score-label {
  710. font-size: 24rpx;
  711. color: #666;
  712. font-weight: 500;
  713. }
  714. .flora-score-row {
  715. display: flex;
  716. flex-direction: row;
  717. justify-content: space-around;
  718. margin-top: 16rpx;
  719. padding-top: 20rpx;
  720. border-top: 2rpx solid #F0F0F0;
  721. }
  722. .flora-score-item {
  723. display: flex;
  724. flex-direction: column;
  725. align-items: center;
  726. }
  727. .flora-score-circle {
  728. width: 80rpx;
  729. height: 80rpx;
  730. border-radius: 40rpx;
  731. display: flex;
  732. align-items: center;
  733. justify-content: center;
  734. margin-bottom: 8rpx;
  735. }
  736. .flora-score-num {
  737. font-size: 28rpx;
  738. font-weight: bold;
  739. color: #fff;
  740. }
  741. .flora-score-label {
  742. font-size: 20rpx;
  743. color: #888;
  744. }
  745. /* ===== 营养缺乏分析 ===== */
  746. .deficiency-list {
  747. display: flex;
  748. flex-direction: column;
  749. }
  750. .deficiency-card {
  751. background: #FAFAFA;
  752. border-radius: 16rpx;
  753. padding: 20rpx;
  754. margin-bottom: 12rpx;
  755. }
  756. .deficiency-header {
  757. display: flex;
  758. flex-direction: row;
  759. align-items: center;
  760. justify-content: space-between;
  761. margin-bottom: 12rpx;
  762. }
  763. .deficiency-nutrient {
  764. font-size: 28rpx;
  765. font-weight: bold;
  766. color: #333;
  767. }
  768. .deficiency-type-tag {
  769. font-size: 22rpx;
  770. padding: 4rpx 16rpx;
  771. border-radius: 16rpx;
  772. background: #FFF3E0;
  773. color: #E65100;
  774. }
  775. .dtype-deficiency {
  776. background: #FEE2E2;
  777. color: #DC2626;
  778. }
  779. .dtype-excess {
  780. background: #FFF3E0;
  781. color: #E65100;
  782. }
  783. .dtype-borderline {
  784. background: #FEF3C7;
  785. color: #D97706;
  786. }
  787. .dtype-unclassified {
  788. background: #F3F4F6;
  789. color: #6B7280;
  790. }
  791. .deficiency-severity-row {
  792. display: flex;
  793. flex-direction: row;
  794. align-items: center;
  795. margin-bottom: 8rpx;
  796. }
  797. .severity-bar {
  798. flex: 1;
  799. height: 12rpx;
  800. background: #F3F4F6;
  801. border-radius: 6rpx;
  802. overflow: hidden;
  803. margin-right: 16rpx;
  804. }
  805. .severity-fill {
  806. height: 100%;
  807. border-radius: 6rpx;
  808. }
  809. .severity-val {
  810. font-size: 24rpx;
  811. color: #9CA3AF;
  812. width: 60rpx;
  813. text-align: right;
  814. }
  815. .deficiency-meta {
  816. font-size: 22rpx;
  817. color: #6B7280;
  818. margin-bottom: 6rpx;
  819. }
  820. .deficiency-foods {
  821. font-size: 22rpx;
  822. color: #374151;
  823. margin-top: 8rpx;
  824. }
  825. .foods-label {
  826. color: #9CA3AF;
  827. }
  828. .foods-value {
  829. color: #2E7D32;
  830. }
  831. /* ===== 雷达图 ===== */
  832. .radar-wrap {
  833. display: flex;
  834. justify-content: center;
  835. align-items: center;
  836. }
  837. .radar-canvas {
  838. width: 300px;
  839. height: 300px;
  840. margin: 0 auto;
  841. }
  842. </style>