index.vue 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  3. <!-- 通用登录浮层 -->
  4. <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" @open="onLoginSheetOpen" @close="onLoginSheetClose" />
  5. <block v-if="!isLoggedIn">
  6. <view class="gh-page">
  7. <!-- 页面头 -->
  8. <view class="gh-head">
  9. <text class="gh-eyebrow">浠艾福 · 家庭主动健康</text>
  10. <text class="gh-title">科学管理全家健康数据</text>
  11. <text class="gh-sub">把每个家人的健康数据,变成看得懂的结论。</text>
  12. </view>
  13. <!-- 痛点条 -->
  14. <view class="gh-pain">
  15. <text class="gh-pain-quote">指标正常 ≠ 健康</text>
  16. <text class="gh-pain-desc">家人反复生病,你扛了多少次了?</text>
  17. </view>
  18. <!-- 自检 hero CTA -->
  19. <view class="gh-cta" @click="goSelfTest">
  20. <view class="gh-cta-ic"></view>
  21. <view class="gh-cta-info">
  22. <text class="gh-cta-title">15 题五维健康自检</text>
  23. <text class="gh-cta-sub">约 20 秒,了解家人的健康概况</text>
  24. </view>
  25. <text class="gh-chev">›</text>
  26. </view>
  27. <!-- 本期待填调研(按周期计算,服务端返回 pending 列表) -->
  28. <view v-for="(item, si) in pendingSurveys" :key="si" class="gh-pending" @click="goSurveyFill(item)">
  29. <view class="gh-pending-ic"><text class="gh-pending-glyph">研</text></view>
  30. <view class="gh-pending-info">
  31. <text class="gh-pending-title">{{ item.title }}</text>
  32. <text class="gh-pending-sub">{{ cycleLabel(item.cycleType) }} · {{ item.periodStart }} 至 {{ item.periodEnd }}</text>
  33. </view>
  34. <text class="gh-pending-tag">待填写</text>
  35. </view>
  36. <!-- 演示雷达(登录浮层打开时隐藏:原生 canvas 会盖在浮层之上) -->
  37. <!-- 统一维度体系:示例雷达按注册中心配置取数(维度清单来自 useDimensionRegistry),无配置显示空态引导 -->
  38. <view class="gh-demo" v-if="!loginSheetVisible">
  39. <view v-if="guestBodyDims.length > 0" class="gh-demo-block">
  40. <view class="gh-demo-head">
  41. <text class="gh-demo-name">身体雷达</text>
  42. <text class="gh-demo-tag">示例</text>
  43. </view>
  44. <RadarChart :dimensions="guestBodyDims" :scores="guestBodyScores" :fillColor="bodyColor" childName="示例" width="560" height="460" />
  45. </view>
  46. <view v-if="guestCogDims.length > 0" class="gh-demo-block">
  47. <view class="gh-demo-head">
  48. <text class="gh-demo-name">认知雷达</text>
  49. <text class="gh-demo-tag">示例</text>
  50. </view>
  51. <RadarChart :dimensions="guestCogDims" :scores="guestCogScores" :fillColor="wisdomColor" childName="示例" width="560" height="460" />
  52. </view>
  53. <view v-if="!guestHasDemoConfig" class="gh-demo-empty">
  54. <text class="gh-demo-empty-text">健康雷达尚未配置</text>
  55. <text class="gh-demo-empty-sub">完成维度配置后即可查看示例效果</text>
  56. </view>
  57. </view>
  58. <!-- 五维健康体系 -->
  59. <view class="gh-wuxing">
  60. <text class="gh-wuxing-title">身 · 智 · 富 · 行 · 心,看得见的健康闭环</text>
  61. <text class="gh-wuxing-sub">五行相生相克,从报告和测评里,真正读懂家人的身体。</text>
  62. <view class="gh-rel">
  63. <text class="gh-rel-title">相生 · 前进</text>
  64. <view class="gh-chain">
  65. <text class="gh-node gh-node-body">身</text>
  66. <text class="gh-arrow">→</text>
  67. <text class="gh-node gh-node-wisdom">智</text>
  68. <text class="gh-arrow">→</text>
  69. <text class="gh-node gh-node-wealth">富</text>
  70. <text class="gh-arrow">→</text>
  71. <text class="gh-node gh-node-action">行</text>
  72. <text class="gh-arrow">→</text>
  73. <text class="gh-node gh-node-mind">心</text>
  74. <text class="gh-arrow">→</text>
  75. <text class="gh-node gh-node-body">身</text>
  76. </view>
  77. <text class="gh-rel-hint">健康孕育智慧,智慧创造价值,价值滋养关系,关系反哺心灵,心灵守护健康。</text>
  78. </view>
  79. <view class="gh-rel">
  80. <text class="gh-rel-title">相克 · 平衡</text>
  81. <view class="gh-chain">
  82. <text class="gh-node gh-node-body">身</text>
  83. <text class="gh-op">克</text>
  84. <text class="gh-node gh-node-wealth">富</text>
  85. <text class="gh-sep">·</text>
  86. <text class="gh-node gh-node-wisdom">智</text>
  87. <text class="gh-op">克</text>
  88. <text class="gh-node gh-node-action">行</text>
  89. <text class="gh-sep">·</text>
  90. <text class="gh-node gh-node-wealth">富</text>
  91. <text class="gh-op">克</text>
  92. <text class="gh-node gh-node-mind">心</text>
  93. <text class="gh-sep">·</text>
  94. <text class="gh-node gh-node-action">行</text>
  95. <text class="gh-op">克</text>
  96. <text class="gh-node gh-node-body">身</text>
  97. <text class="gh-sep">·</text>
  98. <text class="gh-node gh-node-mind">心</text>
  99. <text class="gh-op">克</text>
  100. <text class="gh-node gh-node-wisdom">智</text>
  101. </view>
  102. <text class="gh-rel-hint">莫以健康换金钱,真诚胜过算计,财富服务家庭,关爱有度、大爱留白。</text>
  103. </view>
  104. <view class="gh-rows">
  105. <view class="gh-row" @click="goPage('/pages/body-detail/index')">
  106. <view class="gh-ic gh-ic-body"><text class="gh-glyph">身</text></view>
  107. <view class="gh-row-info">
  108. <text class="gh-row-name">身 · 主动健康</text>
  109. <text class="gh-row-sub">读懂每一份报告,看见全家体质的变化</text>
  110. </view>
  111. <text class="gh-row-chev">›</text>
  112. </view>
  113. <view class="gh-row" @click="goPage('/pages/wisdom-detail/index')">
  114. <view class="gh-ic gh-ic-wisdom"><text class="gh-glyph">智</text></view>
  115. <view class="gh-row-info">
  116. <text class="gh-row-name">智 · 面向未来</text>
  117. <text class="gh-row-sub">一次测评,看见成员真实的专注与潜能</text>
  118. </view>
  119. <text class="gh-row-chev">›</text>
  120. </view>
  121. <view class="gh-row" @click="goPage('/pages/wealth/index')">
  122. <view class="gh-ic gh-ic-wealth"><text class="gh-glyph">富</text></view>
  123. <view class="gh-row-info">
  124. <text class="gh-row-name">富 · 利他创富</text>
  125. <text class="gh-row-sub">看懂健康与财富的关系,明白身体是最大的本钱</text>
  126. </view>
  127. <text class="gh-row-chev">›</text>
  128. </view>
  129. <view class="gh-row" @click="goPage('/pages/action-detail/member-action-detail')">
  130. <view class="gh-ic gh-ic-action"><text class="gh-glyph">行</text></view>
  131. <view class="gh-row-info">
  132. <text class="gh-row-name">行 · 人际和谐</text>
  133. <text class="gh-row-sub">看懂关系里的情绪,看见家人真实的需求</text>
  134. </view>
  135. <text class="gh-row-chev">›</text>
  136. </view>
  137. <view class="gh-row" @click="goPage('/pages/mind-detail/index')">
  138. <view class="gh-ic gh-ic-mind"><text class="gh-glyph">心</text></view>
  139. <view class="gh-row-info">
  140. <text class="gh-row-name">心 · 大爱相随</text>
  141. <text class="gh-row-sub">读懂情绪的信号,听懂家人没说出口的话</text>
  142. </view>
  143. <text class="gh-row-chev">›</text>
  144. </view>
  145. </view>
  146. </view>
  147. <!-- 登录引导 -->
  148. <view class="gh-guide">
  149. <LoginGuideCard
  150. title="登录后查看全家健康数据"
  151. :items="[
  152. '查看七维雷达图与健康报告解读',
  153. '完成测评获取个性化健康方案',
  154. '每日打卡追踪身体 / 情绪 / 认知趋势'
  155. ]" />
  156. </view>
  157. </view>
  158. </block>
  159. <block v-else>
  160. <view class="tab-bar">
  161. <view v-for="tab in tabs" :key="tab.code" class="tab-item" :class="{ active: currentTab === tab.code }" @click="switchTab(tab.code)">
  162. <text class="tab-icon">{{ tab.icon }}</text>
  163. <text class="tab-label">{{ tab.label }}</text>
  164. <view v-if="currentTab === tab.code" class="tab-underline" :style="{ background: tab.color }"></view>
  165. </view>
  166. </view>
  167. <view class="section section-chart">
  168. <RadarChart :dimensions="currentDimensions" :scores="currentScores || []" :fillColor="currentColor" :childName="selectedMemberName" :avgScores="currentAvgScores || []" width="640" height="520" />
  169. <view class="chart-empty" v-if="chartIsEmpty">
  170. <text class="empty-text">{{ currentTabLabel }}数据待采集</text>
  171. <text class="empty-sub">完成测评或上传报告即可解锁{{ currentTabLabel }}数据</text>
  172. </view>
  173. </view>
  174. <view class="section section-dc-header">
  175. <view class="dc-title-row">
  176. <text class="dc-icon">🔍</text>
  177. <text class="dc-title">看见 · 健康数据中心</text>
  178. </view>
  179. </view>
  180. <view class="section section-data-collect">
  181. <ReportUploadCard
  182. title="上传报告"
  183. desc="体检报告 · 菌群检测 · 认知测评 · 心理测评 · 情绪打卡"
  184. :tags="['体检报告', '菌群检测', '认知测评', '心理测评', '情绪打卡']"
  185. @click="goPage('/pages/health/report-upload')" />
  186. <view class="data-card data-card-assessment">
  187. <view class="data-card-head">
  188. <text class="data-card-title">在线测评</text>
  189. <text class="data-card-subtitle">多维度自测评估</text>
  190. </view>
  191. <view v-for="quiz in quizzes" :key="quiz.code" class="quiz-item">
  192. <view class="quiz-info">
  193. <text class="quiz-icon">{{ quiz.icon }}</text>
  194. <text class="quiz-label">{{ quiz.label }}</text>
  195. </view>
  196. <view v-if="quiz.score" class="quiz-score">
  197. <text class="score-value">{{ quiz.score }}</text>
  198. <text class="score-unit">分</text>
  199. </view>
  200. <button v-else class="quiz-btn" @click.stop="goQuiz(quiz.code)">开始</button>
  201. </view>
  202. </view>
  203. <!-- 健康阅卷入口(HL-01):问卷式记录,多次填写以最后一次为准 -->
  204. <view class="data-card" @click="goHealthReview">
  205. <view class="data-card-icon">📝</view>
  206. <view class="data-card-info">
  207. <text class="data-card-title">健康阅卷</text>
  208. <text class="data-card-desc">逐项填写健康问卷 · 多次填写保留历史记录</text>
  209. </view>
  210. <text class="data-card-arrow">›</text>
  211. </view>
  212. </view>
  213. <view class="section section-data-view">
  214. <view class="section-header">
  215. <text class="section-title">最近记录</text>
  216. <text class="section-more" @click="goPage('/pages/health/report-list')">查看全部 ›</text>
  217. </view>
  218. <view v-if="reports.length > 0">
  219. <view class="report-card" v-for="(report, idx) in reports.slice(0, 3)" :key="idx" @click="goReportDetail(report)">
  220. <view class="report-type-badge" :class="'badge-' + _reportTypeClass(report.reportType)">{{ _reportTypeLabel(report.reportType) }}</view>
  221. <view class="report-info">
  222. <text class="report-name">{{ report.childName || report.personName || '健康报告' }}</text>
  223. <text class="report-meta">{{ _formatReportDate(report.reportDate) }}{{ report.gutType ? ' · ' + report.gutType : '' }}</text>
  224. </view>
  225. <view class="report-score-wrap">
  226. <text v-if="report.overallScore != null" class="report-score">{{ report.overallScore }}</text>
  227. <text class="report-status" :class="'status-' + _statusClass(report.status)">{{ report.status === 'resolved' ? '已解析' : '待确认' }}</text>
  228. </view>
  229. <text class="report-arrow">›</text>
  230. </view>
  231. </view>
  232. <view v-else class="empty-hint">
  233. <text class="empty-text">暂无报告和测评结果</text>
  234. <text class="empty-sub">上传报告或完成测评,开始记录你的健康</text>
  235. </view>
  236. </view>
  237. <view class="section section-plan">
  238. <view class="plan-card">
  239. <view class="plan-head">
  240. <text class="plan-title">📋 健康方案</text>
  241. <button class="plan-btn" @click="goPlanSummary">{{ lastPlan ? '查看方案' : '生成新方案' }}</button>
  242. </view>
  243. <text v-if="lastPlan" class="plan-goal">{{ lastPlan }}</text>
  244. <text v-else class="plan-hint">选维度 + 选成员 + 设定目标 → 生成</text>
  245. </view>
  246. </view>
  247. <!-- 推荐阅读 -->
  248. <view class="section">
  249. <view class="section-header">
  250. <text class="section-title">📖 推荐阅读</text>
  251. <text class="section-more" @click="goMoreArticles">更多 ›</text>
  252. </view>
  253. <ArticleFeed :articles="healthArticles" @articleClick="goArticleDetail" />
  254. </view>
  255. </block>
  256. </view>
  257. </template>
  258. <script>
  259. import { BrandColors } from '../../utils/brand-colors.js'
  260. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  261. import RadarChart from '../../components/RadarChart.vue'
  262. import ArticleFeed from '../../components/ArticleFeed.vue'
  263. import ReportUploadCard from '../../components/report-upload-card.vue'
  264. import { parseDate } from '../../utils/format.js'
  265. import { ensureDimensionRegistry, getRadarConfig, isRegistryReady, WEALTH_CHILD_LABEL } from '../../composables/useDimensionRegistry.js'
  266. import fontScaleMixin from '@/mixins/font-scale.js'
  267. import shareMixin from '../../components/share-mixin.js'
  268. export default {
  269. mixins: [fontScaleMixin, shareMixin],
  270. components: { LoginGuideCard, RadarChart, ArticleFeed, ReportUploadCard },
  271. data() {
  272. return {
  273. bodyColor: BrandColors.body,
  274. wisdomColor: BrandColors.wisdom,
  275. isLoggedIn: !!uni.getStorageSync('token'),
  276. currentTab: 'body',
  277. selectedMemberName: '',
  278. selectedMemberId: '',
  279. reports: [],
  280. lastPlan: '',
  281. lastPlanId: null,
  282. healthArticles: [],
  283. hasAiQHistory: false,
  284. pendingSurveys: [],
  285. tabs: [
  286. { code: 'body', label: '健康', icon: '🟠', color: BrandColors.body },
  287. { code: 'cognitive', label: '认知', icon: '🧠', color: BrandColors.wisdom },
  288. { code: 'wealth', label: '财富', icon: '💧', color: BrandColors.wealth },
  289. { code: 'relationship', label: '社会性', icon: '🤝', color: BrandColors.success },
  290. { code: 'mental', label: '心理', icon: '💖', color: BrandColors.mind }
  291. ],
  292. quizzes: [
  293. { code: 'cognitive', label: '认知能力测评', icon: '🧠', score: null },
  294. { code: 'mental', label: '心理健康测评', icon: '💖', score: null },
  295. { code: 'relationship', label: '关系质量测评', icon: '🤝', score: null }
  296. ],
  297. // 真实数据缓存
  298. bodyData: null,
  299. cognitiveData: null,
  300. cognitiveFamilyData: [],
  301. emiData: null,
  302. emiFamilyData: [],
  303. relationshipData: [],
  304. energySandbox: null,
  305. wealthDetail: null,
  306. childrenList: [],
  307. relationshipEmpty: false,
  308. // 登录浮层打开标志(打开期间隐藏演示雷达,避免原生 canvas 盖在浮层之上)
  309. loginSheetVisible: false,
  310. // 统一维度注册中心是否就绪(成功取到 tree 后由 ensureDimensionRegistry 置位)
  311. // 未就绪时主页雷达回落硬编码兜底,保证后端未上线 / 接口异常时页面不崩
  312. registryReady: false
  313. }
  314. },
  315. computed: {
  316. currentTabLabel: function() {
  317. var tab = this.tabs.filter(function(t) { return t.code === this.currentTab }.bind(this))[0]
  318. return tab ? tab.label : ''
  319. },
  320. currentColor: function() {
  321. var tab = this.tabs.filter(function(t) { return t.code === this.currentTab }.bind(this))[0]
  322. return tab ? tab.color : BrandColors.body
  323. },
  324. currentDimensions: function() {
  325. // 配置驱动:从统一维度注册中心 tree 取该 tab 根节点的 children 作为维度清单
  326. var config = getRadarConfig(this.currentTab)
  327. if (this.registryReady && config && config.length > 0) {
  328. var isChild = !!uni.getStorageSync('currentChildId')
  329. var self = this
  330. return config.map(function(c) {
  331. var label = c.label
  332. // 财富子维度在「成员(儿童)」语境下使用更贴近儿童的文案(与改造前字面量一致)
  333. if (self.currentTab === 'wealth' && isChild && WEALTH_CHILD_LABEL[c.code]) {
  334. label = WEALTH_CHILD_LABEL[c.code]
  335. }
  336. // label 供 RadarChart 画维度名;key 供(若有)点击透传;code 保留注册中心维度码
  337. return { label: label, key: c.code, code: c.code }
  338. })
  339. }
  340. // 过渡兜底:注册中心未就绪或某根无子维 → 回落现有硬编码清单(后端未上线 / 接口异常时页面不崩)
  341. return this._fallbackDimensions(this.currentTab)
  342. },
  343. currentScores: function() {
  344. if (this.chartIsEmpty) {
  345. var dims = this.currentDimensions, scores = []
  346. for (var i = 0; i < dims.length; i++) scores.push(0)
  347. return scores
  348. }
  349. // 配置驱动:与 currentDimensions 同源同序遍历注册中心配置,按 scoreField 取分
  350. var config = getRadarConfig(this.currentTab)
  351. if (this.registryReady && config && config.length > 0) {
  352. var self = this
  353. return config.map(function(c) {
  354. return self._readRegistryScore(self.currentTab, c.code, c.scoreField)
  355. })
  356. }
  357. // 过渡兜底:注册中心未就绪 → 回落现有硬编码取分逻辑(与改造前一致)
  358. return this._fallbackScores(this.currentTab)
  359. },
  360. currentAvgScores: function() {
  361. if (this.chartIsEmpty) return []
  362. if (this.currentTab === 'cognitive' && this.cognitiveFamilyData.length > 0) {
  363. var keys = ['memoryScore','attentionScore','logicScore','spatialScore','perceptionScore','focusScore','processingSpeedScore']
  364. var avgs = []
  365. for (var k = 0; k < keys.length; k++) {
  366. var sum = 0
  367. for (var i = 0; i < this.cognitiveFamilyData.length; i++) {
  368. var v = this.cognitiveFamilyData[i][keys[k]]
  369. if (typeof v === 'number' && v > 0) sum += v
  370. }
  371. avgs.push(Math.round(sum / this.cognitiveFamilyData.length))
  372. }
  373. return avgs
  374. }
  375. if (this.currentTab === 'mental' && this.emiFamilyData.length > 0) {
  376. var keys2 = ['opennessScore','conscientiousnessScore','extraversionScore','agreeablenessScore','neuroticismScore','driveAutonomy','driveCompetence','driveRelatedness','emotionStability','selfConceptOverall']
  377. var avgs2 = []
  378. for (var k2 = 0; k2 < keys2.length; k2++) {
  379. var sum2 = 0
  380. for (var i2 = 0; i2 < this.emiFamilyData.length; i2++) {
  381. var v2 = this.emiFamilyData[i2][keys2[k2]]
  382. if (typeof v2 === 'number' && v2 > 0) sum2 += v2
  383. }
  384. avgs2.push(Math.round(sum2 / this.emiFamilyData.length))
  385. }
  386. return avgs2
  387. }
  388. if (this.currentTab === 'relationship' && this.relationshipData.length > 0) {
  389. return [this._relScore('trustScore'), this._relScore('intimacyScore'), this._relScore('communicationScore'), this._relScore('totalScore'), 0]
  390. }
  391. if (this.currentTab === 'wealth' && this.wealthDetail) {
  392. var d = this.wealthDetail
  393. return [d.wealthSkill || 0, d.wealthAltruism || 0, d.wealthIncome || 0, d.wealthFx || 0]
  394. }
  395. return []
  396. },
  397. chartIsEmpty: function() {
  398. if (this.currentTab === 'body') return !this.bodyData || !this.bodyData.dimensions || this.bodyData.dimensions.length === 0
  399. if (this.currentTab === 'cognitive') return !this.cognitiveData || !this.cognitiveData.overallScore
  400. if (this.currentTab === 'mental') return !this.emiData || !this.emiData.overallScore
  401. if (this.currentTab === 'relationship') return !this.relationshipData || this.relationshipData.length === 0
  402. if (this.currentTab === 'wealth') return !this.wealthDetail
  403. var quiz = this.quizzes.filter(function(q) { return q.code === this.currentTab }.bind(this))[0]
  404. return !(quiz && quiz.score)
  405. },
  406. // ── 访客态示例雷达(统一维度体系):维度清单按注册中心配置取,无配置显示空态引导 ──
  407. guestBodyDims: function() {
  408. return this._guestRadarDims('body')
  409. },
  410. guestBodyScores: function() {
  411. return this._guestDemoScores(this.guestBodyDims)
  412. },
  413. guestCogDims: function() {
  414. return this._guestRadarDims('cognitive')
  415. },
  416. guestCogScores: function() {
  417. return this._guestDemoScores(this.guestCogDims)
  418. },
  419. guestHasDemoConfig: function() {
  420. return this.guestBodyDims.length > 0 || this.guestCogDims.length > 0
  421. }
  422. },
  423. onShow() {
  424. this.isLoggedIn = !!uni.getStorageSync('token')
  425. if (this.isLoggedIn) {
  426. var stored = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || ''
  427. if (stored) {
  428. var n = parseInt(stored, 10)
  429. this.selectedMemberId = isNaN(n) ? stored : n
  430. this.selectedMemberName = uni.getStorageSync('currentChildName') || '成员'
  431. }
  432. this.loadHealthData()
  433. this.loadPlanList()
  434. this.loadPendingSurveys()
  435. // 触发统一维度注册中心树拉取(主页雷达配置驱动取数;失败则回落硬编码兜底)
  436. var self = this
  437. ensureDimensionRegistry().then(function() {
  438. self.registryReady = isRegistryReady()
  439. }).catch(function() {
  440. self.registryReady = false
  441. })
  442. } else {
  443. this.pendingSurveys = []
  444. // 访客态:示例雷达同样按注册中心配置渲染(无配置显示空态引导)
  445. var self = this
  446. ensureDimensionRegistry().then(function() {
  447. self.registryReady = isRegistryReady()
  448. }).catch(function() {
  449. self.registryReady = false
  450. })
  451. }
  452. },
  453. methods: {
  454. _cognitiveScore: function(key) {
  455. if (!this.cognitiveData) return 0
  456. var v = this.cognitiveData[key]
  457. return (typeof v === 'number' && v > 0) ? v : 0
  458. },
  459. _emiScore: function(key) {
  460. if (!this.emiData) return 0
  461. var v = this.emiData[key]
  462. return (typeof v === 'number' && v > 0) ? v : 0
  463. },
  464. _relScore: function(key) {
  465. if (!this.relationshipData || this.relationshipData.length === 0) return 0
  466. var total = 0, count = 0
  467. for (var i = 0; i < this.relationshipData.length; i++) {
  468. var item = this.relationshipData[i]
  469. if (item[key] != null) { total += Number(item[key]); count++ }
  470. }
  471. return count > 0 ? Math.round(total / count) : 0
  472. },
  473. _wealthScore: function(key) {
  474. if (!this.energySandbox) return 0
  475. var v = this.energySandbox[key]
  476. return (typeof v === 'number' && v > 0) ? v : 0
  477. },
  478. /**
  479. * 过渡兜底:返回某 tab 的硬编码维度清单(与改造前字面量一致)。
  480. * 仅当注册中心未就绪时使用,保证后端未上线 / 接口异常时页面不崩。
  481. * @param {string} tab
  482. * @returns {Array<{label:string,key:string}>}
  483. */
  484. _fallbackDimensions: function(tab) {
  485. if (tab === 'cognitive') {
  486. return [{ label:'记忆力',key:'memory'},{ label:'注意力',key:'attention'},{ label:'逻辑推理',key:'logic'},{ label:'空间想象',key:'spatial'},{ label:'感知能力',key:'perception'},{ label:'专注力',key:'focus'},{ label:'加工速度',key:'processingSpeed' }]
  487. }
  488. if (tab === 'mental') {
  489. return [{ label:'开放性',key:'openness'},{ label:'尽责性',key:'conscientiousness'},{ label:'外向性',key:'extraversion'},{ label:'宜人性',key:'agreeableness'},{ label:'神经质',key:'neuroticism'},{ label:'自主性',key:'driveAutonomy'},{ label:'胜任感',key:'driveCompetence'},{ label:'归属感',key:'driveRelatedness'},{ label:'情绪稳定性',key:'emotionStability'},{ label:'自我概念',key:'selfConceptOverall' }]
  490. }
  491. if (tab === 'relationship') {
  492. return [{ label:'亲子信任',key:'parentTrust'},{ label:'亲子亲密度',key:'parentIntimacy'},{ label:'沟通质量',key:'communication'},{ label:'关系健康度',key:'healthStatus'},{ label:'最近互动',key:'lastInteraction' }]
  493. }
  494. if (tab === 'wealth') {
  495. var isChild = !!uni.getStorageSync('currentChildId')
  496. if (isChild) {
  497. return [{ label:'学业能力',key:'skill'},{ label:'利他贡献',key:'altruism'},{ label:'积分积累',key:'income'},{ label:'财务素养',key:'fx' }]
  498. }
  499. return [{ label:'个人能力',key:'skill'},{ label:'利他贡献',key:'altruism'},{ label:'CF值积累',key:'income'},{ label:'财务素养',key:'fx' }]
  500. }
  501. return [{ label:'生长发育',key:'growth'},{ label:'睡眠质量',key:'sleep'},{ label:'视力健康',key:'vision'},{ label:'免疫力',key:'immunity'},{ label:'营养均衡',key:'nutrition'},{ label:'肠胃健康',key:'gut'},{ label:'运动活力',key:'exercise' }]
  502. },
  503. /**
  504. * 过渡兜底:返回某 tab 的硬编码取分(与改造前字面量一致)。
  505. * @param {string} tab
  506. * @returns {Array<number>}
  507. */
  508. _fallbackScores: function(tab) {
  509. if (tab === 'cognitive') {
  510. return [
  511. this._cognitiveScore('memoryScore'),
  512. this._cognitiveScore('attentionScore'),
  513. this._cognitiveScore('logicScore'),
  514. this._cognitiveScore('spatialScore'),
  515. this._cognitiveScore('perceptionScore'),
  516. this._cognitiveScore('focusScore'),
  517. this._cognitiveScore('processingSpeedScore')
  518. ]
  519. }
  520. if (tab === 'mental') {
  521. return [
  522. this._emiScore('opennessScore'),
  523. this._emiScore('conscientiousnessScore'),
  524. this._emiScore('extraversionScore'),
  525. this._emiScore('agreeablenessScore'),
  526. this._emiScore('neuroticismScore'),
  527. this._emiScore('driveAutonomy'),
  528. this._emiScore('driveCompetence'),
  529. this._emiScore('driveRelatedness'),
  530. this._emiScore('emotionStability'),
  531. this._emiScore('selfConceptOverall')
  532. ]
  533. }
  534. if (tab === 'relationship') {
  535. return [
  536. this._relScore('trustScore'),
  537. this._relScore('intimacyScore'),
  538. this._relScore('communicationScore'),
  539. this._relScore('totalScore'),
  540. 0
  541. ]
  542. }
  543. if (tab === 'wealth') {
  544. var d = this.wealthDetail
  545. if (!d) return [0, 0, 0, 0]
  546. return [d.wealthSkill || 0, d.wealthAltruism || 0, d.wealthIncome || 0, d.wealthFx || 0]
  547. }
  548. // body: 从 API 真实维度数据取分(无真实数据时由 chartIsEmpty 走零值空态,不再回落硬编码示例分)
  549. if (this.bodyData && this.bodyData.dimensions && this.bodyData.dimensions.length > 0) {
  550. return this.bodyData.dimensions.map(function(dItem) { return Number(dItem.score) || 0 })
  551. }
  552. return []
  553. },
  554. /**
  555. * 配置驱动取分:按 tab 与注册中心节点的 scoreField / code 从对应分数包取分。
  556. * 包缺失或值非数字 → 0(保持现有零填充行为)。与改造前取分口径逐一对齐。
  557. * @param {string} tab
  558. * @param {string} code 注册中心节点 code(body 类为 body.growth)
  559. * @param {string} scoreField legacyAlias 首元素(取分字段名)
  560. * @returns {number}
  561. */
  562. _readRegistryScore: function(tab, code, scoreField) {
  563. if (tab === 'body') {
  564. // body 维度按 dimension 字段匹配:兼容两种格式——
  565. // ① 当前后端 /api/dimension/overview 仍返回 legacy 码(growth/sleep/...,见 DimensionScoreServiceImpl.DIMENSIONS),
  566. // 此时与 legacyAlias 首元素(scoreField)匹配;
  567. // ② 后续后端迁移为统一码(body.growth/...)后,与注册中心节点 code 匹配。
  568. var dims = this.bodyData && this.bodyData.dimensions
  569. if (!dims || !dims.length) return 0
  570. for (var i = 0; i < dims.length; i++) {
  571. var dItem = dims[i]
  572. if (dItem && (dItem.dimension === code || dItem.dimension === scoreField)) {
  573. var v = Number(dItem.score)
  574. return (typeof v === 'number' && !isNaN(v)) ? v : 0
  575. }
  576. }
  577. return 0
  578. }
  579. if (tab === 'cognitive') {
  580. if (!this.cognitiveData) return 0
  581. var cv = this.cognitiveData[scoreField]
  582. return (typeof cv === 'number' && cv > 0) ? cv : 0
  583. }
  584. if (tab === 'mental') {
  585. if (!this.emiData) return 0
  586. var mv = this.emiData[scoreField]
  587. return (typeof mv === 'number' && mv > 0) ? mv : 0
  588. }
  589. if (tab === 'relationship') {
  590. // 最近互动是日期字段,恒为 0(与改造前字面量 0 一致)
  591. if (scoreField === 'lastInteractionAt') return 0
  592. if (!this.relationshipData || this.relationshipData.length === 0) return 0
  593. var total = 0, count = 0
  594. for (var r = 0; r < this.relationshipData.length; r++) {
  595. var item = this.relationshipData[r]
  596. if (item && item[scoreField] != null) {
  597. total += Number(item[scoreField])
  598. count++
  599. }
  600. }
  601. return count > 0 ? Math.round(total / count) : 0
  602. }
  603. if (tab === 'wealth') {
  604. var wd = this.wealthDetail
  605. if (!wd) return 0
  606. var wv = wd[scoreField]
  607. return (typeof wv === 'number' && wv > 0) ? wv : 0
  608. }
  609. return 0
  610. },
  611. /**
  612. * 访客演示雷达维度清单:按注册中心配置取(body→body 根、cognitive→wisdom 根),
  613. * 未就绪或无配置返回空数组(模板据此渲染空态引导文案)。
  614. * @param {string} tab
  615. * @returns {Array<{label:string,key:string,code:string}>}
  616. */
  617. _guestRadarDims: function(tab) {
  618. var config = getRadarConfig(tab)
  619. if (!this.registryReady || !config || config.length === 0) return []
  620. var dims = []
  621. for (var i = 0; i < config.length; i++) {
  622. var c = config[i]
  623. dims.push({ label: c.label, key: c.code, code: c.code })
  624. }
  625. return dims
  626. },
  627. /**
  628. * 访客演示雷达示例分数:按维度数量生成确定性示例分(非字面量数组),
  629. * 仅用于示例形状演示,无真实数据含义。替代原访客示例的硬编码分数数组。
  630. * @param {Array} dims
  631. * @returns {Array<number>}
  632. */
  633. _guestDemoScores: function(dims) {
  634. var scores = []
  635. for (var i = 0; i < dims.length; i++) {
  636. scores.push(72 - (i % 3) * 4)
  637. }
  638. return scores
  639. },
  640. switchTab: function(code) { this.currentTab = code },
  641. goPage: function(url) { uni.navigateTo({ url: url }) },
  642. // 登录浮层打开/关闭(隐藏演示雷达,规避原生 canvas 层级高于浮层的问题)
  643. onLoginSheetOpen: function() { this.loginSheetVisible = true },
  644. onLoginSheetClose: function() { this.loginSheetVisible = false },
  645. // 登录成功:刷新登录态数据(镜像 onShow 已登录分支)
  646. onLoginSuccess: function() {
  647. // 未登录点击「15题五维健康自检」→ 登录成功后续接跳转调研问卷
  648. if (this._pendingSurveyUrl) {
  649. var pendingUrl = this._pendingSurveyUrl
  650. this._pendingSurveyUrl = ''
  651. uni.navigateTo({ url: pendingUrl })
  652. return
  653. }
  654. this.isLoggedIn = true
  655. var stored = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || ''
  656. if (stored) {
  657. var n = parseInt(stored, 10)
  658. this.selectedMemberId = isNaN(n) ? stored : n
  659. this.selectedMemberName = uni.getStorageSync('currentChildName') || '成员'
  660. }
  661. this.loadHealthData()
  662. this.loadPlanList()
  663. this.loadPendingSurveys()
  664. },
  665. goQuiz: function(code) {
  666. var url = '/pages/body-detail/dimension-questionnaire?dim=' + code
  667. if (this.selectedMemberId) url += '&memberId=' + this.selectedMemberId
  668. uni.navigateTo({ url: url })
  669. },
  670. goReportDetail: function(report) {
  671. if (!report || !report.id) return
  672. var type = report.reportType || 'gut_flora'
  673. var url
  674. if (type === 'dan') {
  675. url = '/pages/dan-assessment/report-result?reportId=' + report.id
  676. } else if (type === 'gut_flora') {
  677. url = '/pages/health/gut-flora-detail?reportId=' + report.id
  678. } else {
  679. url = '/pages/health/report-detail?reportType=' + type + '&reportId=' + report.id
  680. }
  681. uni.navigateTo({ url: url })
  682. },
  683. _reportTypeLabel: function(type) {
  684. var map = { gut_flora: '肠道', physical_exam: '体检', tongue: '舌诊', blood: '血液' }
  685. return map[type] || '健康报告'
  686. },
  687. _reportTypeClass: function(type) {
  688. var map = { gut_flora: 'gut', physical_exam: 'exam', tongue: 'tongue', blood: 'blood' }
  689. return map[type] || 'default'
  690. },
  691. _statusClass: function(status) {
  692. return status === 'resolved' ? 'resolved' : 'pending'
  693. },
  694. goSelfTest: function() {
  695. // 15题五维健康自检对应健康调研问卷,需登录后才能填写:未登录先弹出登录浮层
  696. var url = '/pages/health/health-survey?modules=basic,status,diet,disease,bowel,sleep,med,allergy'
  697. if (!uni.getStorageSync('token')) {
  698. this._pendingSurveyUrl = url
  699. this.openLoginSheet({ redirect: url })
  700. return
  701. }
  702. uni.navigateTo({ url: url })
  703. },
  704. goHealthReview: function() {
  705. // 健康阅卷(HL-01):问卷式记录,多次填写以最后一次为准;需登录后填写
  706. var url = '/pages/health/health-survey?source=health_review&entry=health_review'
  707. if (!uni.getStorageSync('token')) {
  708. this._pendingSurveyUrl = url
  709. this.openLoginSheet({ redirect: url })
  710. return
  711. }
  712. uni.navigateTo({ url: url })
  713. },
  714. // 拉取本期待填调研(服务端按 cycle_type 计算当前周期)
  715. loadPendingSurveys: function() {
  716. var self = this
  717. var api = require('../../utils/api.js')
  718. api.getSurveyStatus({}).then(function(res) {
  719. var list = (res && res.code === 200 && res.data) ? res.data : []
  720. var pending = []
  721. for (var i = 0; i < list.length; i++) {
  722. if (list[i] && list[i].status === 'pending') pending.push(list[i])
  723. }
  724. self.pendingSurveys = pending
  725. }).catch(function() { self.pendingSurveys = [] })
  726. },
  727. cycleLabel: function(cycleType) {
  728. var map = { weekly: '每周调研', biweekly: '双周调研', monthly: '每月调研' }
  729. return map[cycleType] || '定期调研'
  730. },
  731. goSurveyFill: function(item) {
  732. if (!item || !item.templateId) return
  733. var url = '/pages/health/survey-questionnaire?templateId=' + item.templateId +
  734. '&templateTitle=' + encodeURIComponent(item.title || '定期调研') +
  735. '&templateDimension=' + encodeURIComponent(item.dimension || '') +
  736. '&periodStart=' + (item.periodStart || '') +
  737. '&periodEnd=' + (item.periodEnd || '')
  738. uni.navigateTo({ url: url })
  739. },
  740. goPlanSummary: function() {
  741. uni.navigateTo({ url: '/pages/health/plan-list' })
  742. },
  743. loadHealthData: function() {
  744. var self = this
  745. try {
  746. var api = require('../../utils/api.js')
  747. var memberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || uni.getStorageSync('userId') || ''
  748. // 最近记录:展示家庭所有成员的最近报告——不传 memberId,后端返回当前家庭全部报告
  749. // (按报告日期倒序)取最近 3 条,卡片通过 childName/personName 区分成员。
  750. // 下方维度/认知/心理等数据仍按当前选中成员(memberId)加载,不受此影响
  751. api.getReportList('', 3).then(function(res) {
  752. if (res.code === 200 && res.data) {
  753. var list = Array.isArray(res.data) ? res.data : (res.data.list || [])
  754. self.reports = list
  755. }
  756. }).catch(function() {})
  757. // 身体七维概览
  758. if (memberId) {
  759. api.getDimensionOverview({ memberId: memberId }).then(function(res) {
  760. if (res.code === 200 && res.data) self.bodyData = res.data
  761. }).catch(function() {})
  762. }
  763. // 文章
  764. api.getFeaturedArticles({ size: 3, dimensionCode: 'body' }).then(function(res) {
  765. if (res.code === 200 && res.data) {
  766. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  767. self.healthArticles = list.slice(0, 3) || []
  768. }
  769. }).catch(function() {})
  770. // 认知测评得分
  771. if (memberId) {
  772. api.getCognitiveChildScores(memberId).then(function(res) {
  773. if (res.code === 200) self.cognitiveData = res.data || null
  774. }).catch(function() {})
  775. api.getCognitiveFamilyScores().then(function(res) {
  776. if (res.code === 200 && Array.isArray(res.data)) self.cognitiveFamilyData = res.data
  777. }).catch(function() {})
  778. }
  779. // EMI心理报告
  780. if (memberId) {
  781. api.getEmiReport(memberId).then(function(res) {
  782. if (res.code === 200) self.emiData = res.data || null
  783. }).catch(function() {})
  784. }
  785. // 关系质量评分
  786. api.getRelationshipScores().then(function(res) {
  787. if (res.code === 200 && Array.isArray(res.data) && res.data.length > 0) {
  788. self.relationshipData = res.data
  789. self.relationshipEmpty = false
  790. } else {
  791. self.relationshipEmpty = true
  792. }
  793. }).catch(function() { self.relationshipEmpty = true })
  794. // 财富子维度:沙盘里本人用 userId,成员用 family_members.id,不能混用 currentMemberId
  795. var childId = uni.getStorageSync('currentChildId')
  796. var wealthMemberId = childId || uni.getStorageSync('userId')
  797. var wealthMemberType = childId ? 'child' : 'parent'
  798. if (wealthMemberId) {
  799. api.getWealthDetail(wealthMemberId, wealthMemberType).then(function(res) {
  800. if (res.code === 200 && res.data) {
  801. self.wealthDetail = res.data
  802. }
  803. }).catch(function() {})
  804. }
  805. } catch (e) { console.error('加载健康数据失败', e) }
  806. },
  807. loadPlanList: function() {
  808. var self = this
  809. var api = require('../../utils/api.js')
  810. api.getHealthPlanList({}).then(function(res) {
  811. if (res && res.code === 200 && res.data) {
  812. var list = res.data.list || res.data
  813. var plans = Array.isArray(list) ? list : []
  814. if (plans.length > 0) {
  815. self.lastPlan = plans[0].goal || plans[0].memberName || '已有健康方案'
  816. self.lastPlanId = plans[0].id || null
  817. } else {
  818. self.lastPlan = ''
  819. self.lastPlanId = null
  820. }
  821. } else {
  822. self.lastPlan = ''
  823. self.lastPlanId = null
  824. }
  825. }).catch(function() {
  826. self.lastPlan = ''
  827. self.lastPlanId = null
  828. })
  829. },
  830. goArticleDetail: function(article) {
  831. var id = article && article.id || article
  832. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  833. },
  834. goMoreArticles: function() {
  835. uni.navigateTo({ url: '/pages/article-center/index?dimension=body' })
  836. },
  837. _formatReportDate: function(dateStr) {
  838. if (!dateStr) return ''
  839. // 后端返回 ISO 8601 (2026-08-15T14:30:00) 或 yyyy-MM-dd,统一截取前10位
  840. var s = String(dateStr)
  841. return s.length >= 10 ? s.substring(0, 10) : s
  842. },
  843. }
  844. }
  845. </script>
  846. <style scoped lang="scss">
  847. // 本页无色:全局令牌全覆盖($c-fill-warm $facade-fill-page 已提全局 $facade-fill-page)
  848. .container { background: $facade-fill-page; min-height: 100vh; padding-bottom: calc(160rpx + env(safe-area-inset-bottom)); }
  849. .section { margin: 16rpx 24rpx; }
  850. .tab-bar { display: flex; background: $app-surface; margin: 0 24rpx 16rpx; border-radius: 16rpx; padding: 8rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  851. .tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 12rpx 0; position: relative; border-radius: 16rpx; }
  852. .tab-item.active { background: $facade-brand-tint; }
  853. .tab-icon { font-size: calc(32rpx * var(--font-scale, 1)); margin-bottom: 4rpx; }
  854. .tab-label { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-body; font-weight: 500; }
  855. .tab-item.active .tab-label { color: $facade-text-strong; font-weight: bold; }
  856. .tab-underline { width: 40rpx; height: 4rpx; border-radius: 8rpx; margin-top: 6rpx; }
  857. .section-chart { position: relative; margin: 0 24rpx 16rpx; }
  858. .chart-empty { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; z-index: 3; background: rgba($app-surface, 0.85); border-radius: 16rpx; padding: 20rpx $uni-space-page; }
  859. .chart-empty .empty-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-strong; font-weight: 500; display: block; }
  860. .chart-empty .empty-sub { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; display: block; margin-top: 4rpx; }
  861. .section-dc-header { margin: 20rpx 24rpx 8rpx; }
  862. .dc-title-row { display: flex; align-items: center; }
  863. .dc-icon { font-size: calc(32rpx * var(--font-scale, 1)); margin-right: 8rpx; }
  864. .dc-title { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; }
  865. .section-data-collect { margin: 8rpx 24rpx; }
  866. .data-card { display: flex; align-items: center; background: $app-surface; border-radius: 24rpx; padding: 24rpx; margin-bottom: 12rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  867. .data-card-icon { width: 88rpx; height: 88rpx; border-radius: 24rpx; display: flex; align-items: center; justify-content: center; margin-right: 20rpx; font-size: calc(40rpx * var(--font-scale, 1)); }
  868. .data-card-info { flex: 1; }
  869. .data-card-title { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; display: block; margin-bottom: 6rpx; }
  870. .data-card-desc { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; }
  871. .data-card-arrow { font-size: calc(36rpx * var(--font-scale, 1)); color: $facade-text-ghost; }
  872. .data-card-assessment { flex-direction: column; align-items: stretch; padding: 24rpx; }
  873. .data-card-head { display: flex; align-items: center; margin-bottom: 16rpx; }
  874. .data-card-subtitle { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; margin-left: 12rpx; }
  875. .quiz-item { display: flex; align-items: center; padding: 16rpx 0; border-top: 1rpx solid $facade-fill; }
  876. .quiz-item:first-of-type { border-top: none; }
  877. .quiz-info { display: flex; align-items: center; flex: 1; }
  878. .quiz-icon { font-size: calc(36rpx * var(--font-scale, 1)); margin-right: 16rpx; }
  879. .quiz-label { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-strong; }
  880. .quiz-score { display: flex; align-items: baseline; margin-right: 16rpx; }
  881. .score-value { font-size: calc(36rpx * var(--font-scale, 1)); font-weight: bold; color: $brand-primary; }
  882. .score-unit { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; margin-left: 4rpx; }
  883. .quiz-btn { background: $brand-primary; color: $app-surface; font-size: calc(24rpx * var(--font-scale, 1)); border: none; border-radius: 24rpx; padding: 10rpx $uni-space-page; height: 56rpx; line-height: 36rpx; margin: 0; }
  884. .section-data-view { margin: 16rpx 24rpx; }
  885. .section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12rpx; }
  886. .section-title { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; }
  887. .section-more { font-size: calc(24rpx * var(--font-scale, 1)); color: $brand-primary; }
  888. .report-card { display: flex; align-items: center; background: $app-surface; border-radius: 16rpx; padding: 16rpx 20rpx; margin-bottom: 10rpx; }
  889. .report-type-badge { font-size: calc(20rpx * var(--font-scale, 1)); padding: 4rpx 12rpx; border-radius: 8rpx; margin-right: 12rpx; flex-shrink: 0; font-weight: 600; }
  890. .report-type-badge.badge-gut { background: rgba($brand-primary, 0.12); color: $brand-primary; }
  891. .report-type-badge.badge-exam { background: rgba($dim-wisdom, 0.12); color: $dim-wisdom; }
  892. .report-type-badge.badge-tongue { background: rgba($dim-action, 0.12); color: $dim-action; }
  893. .report-type-badge.badge-blood { background: rgba($status-danger, 0.12); color: $status-danger; }
  894. .report-type-badge.badge-default { background: rgba($facade-text-slate, 0.12); color: $facade-text-slate; }
  895. .report-info { flex: 1; min-width: 0; }
  896. .report-name { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-strong; font-weight: 600; display: block; margin-bottom: 4rpx; }
  897. .report-meta { font-size: calc(20rpx * var(--font-scale, 1)); color: $facade-text-muted; display: block; }
  898. .report-score-wrap { display: flex; flex-direction: column; align-items: flex-end; margin-right: 8rpx; flex-shrink: 0; }
  899. .report-score { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: bold; color: $brand-primary; line-height: 1; }
  900. .report-status { font-size: calc(20rpx * var(--font-scale, 1)); margin-top: 4rpx; }
  901. .report-status.status-resolved { color: $dim-action; }
  902. .report-status.status-pending { color: $dim-wealth; }
  903. .report-arrow { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-ghost; }
  904. .empty-hint { text-align: center; padding: $uni-space-lg 0; background: $app-surface; border-radius: 16rpx; }
  905. .empty-hint .empty-text { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-muted; display: block; }
  906. .empty-hint .empty-sub { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-ghost; display: block; margin-top: 6rpx; }
  907. .section-plan { margin: 8rpx 24rpx 16rpx; }
  908. .plan-card { background: $app-surface; border-radius: 24rpx; padding: 24rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  909. .plan-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12rpx; }
  910. .plan-title { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; }
  911. .plan-btn { background: linear-gradient(135deg, $brand-primary, $brand-primary-light); color: $app-surface; font-size: calc(24rpx * var(--font-scale, 1)); border: none; border-radius: 24rpx; padding: 10rpx 28rpx; height: 56rpx; line-height: 36rpx; margin: 0; }
  912. .plan-goal { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.5; display: block; margin-top: 12rpx; }
  913. .plan-hint { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; display: block; margin-top: 12rpx; }
  914. /* ===== 访客态(新暖调配色 · 令牌化) ===== */
  915. $gh-white: str-slice('#{$app-surface}', 2);
  916. .gh-page { background: $app-bg; min-height: 100vh; padding: 28rpx 0 40rpx; }
  917. /* 页面头 */
  918. .gh-head { margin: 0 32rpx 24rpx; display: flex; flex-direction: column; }
  919. .gh-eyebrow { font-size: calc(22rpx * var(--font-scale, 1)); font-weight: 600; color: $brand-primary; letter-spacing: 2rpx; }
  920. .gh-title { font-size: calc(46rpx * var(--font-scale, 1)); font-weight: 700; color: $facade-text-strong; line-height: 1.32; margin-top: 12rpx; }
  921. .gh-sub { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.65; margin-top: 10rpx; }
  922. /* 痛点条 */
  923. .gh-pain { margin: 0 32rpx 24rpx; display: flex; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; }
  924. .gh-pain-quote { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 700; color: $brand-primary; }
  925. .gh-pain-desc { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; }
  926. /* 自检 hero CTA */
  927. .gh-cta { margin: 0 32rpx 24rpx; display: flex; flex-direction: row; align-items: center; padding: 28rpx; border-radius: 24rpx; background: linear-gradient(135deg, $brand-primary, $brand-primary-dark); box-shadow: 0 12rpx 32rpx rgba($brand-primary, 0.24); }
  928. .gh-cta:active { opacity: 0.9; }
  929. .gh-cta-ic {
  930. width: 88rpx; height: 88rpx; border-radius: 24rpx; flex-shrink: 0;
  931. background-color: rgba($app-surface, 0.18);
  932. background-repeat: no-repeat;
  933. background-position: center;
  934. background-size: 48rpx 48rpx;
  935. background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23#{$gh-white}' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2 4 14h6l-1 8 9-12h-6l1-8z'/%3E%3C/svg%3E");
  936. }
  937. .gh-cta-info { flex: 1; min-width: 0; margin-left: 20rpx; display: flex; flex-direction: column; }
  938. .gh-cta-title { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 700; color: $app-surface; }
  939. .gh-cta-sub { font-size: calc(22rpx * var(--font-scale, 1)); color: rgba($app-surface, 0.82); margin-top: 6rpx; }
  940. .gh-chev { font-size: calc(36rpx * var(--font-scale, 1)); color: rgba($app-surface, 0.72); margin-left: 12rpx; }
  941. /* 待填调研 */
  942. .gh-pending { margin: 0 32rpx 20rpx; display: flex; flex-direction: row; align-items: center; padding: 24rpx; border-radius: 20rpx; background: $app-surface; border: 1rpx solid $app-border-subtle; }
  943. .gh-pending:active { opacity: 0.9; }
  944. .gh-pending-ic { width: 72rpx; height: 72rpx; border-radius: 20rpx; display: flex; flex-direction: row; align-items: center; justify-content: center; flex-shrink: 0; background: $dim-body-tint; }
  945. .gh-pending-glyph { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 700; color: $dim-body-deep; }
  946. .gh-pending-info { flex: 1; min-width: 0; margin-left: 20rpx; display: flex; flex-direction: column; }
  947. .gh-pending-title { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  948. .gh-pending-sub { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-body; margin-top: 6rpx; }
  949. .gh-pending-tag { flex-shrink: 0; margin-left: 12rpx; font-size: calc(20rpx * var(--font-scale, 1)); font-weight: 600; color: $brand-primary; background: rgba($brand-primary, 0.1); border-radius: 999rpx; padding: 6rpx 16rpx; }
  950. /* 演示雷达 */
  951. .gh-demo { margin: 0 32rpx 24rpx; background: $app-surface; border-radius: 24rpx; padding: 20rpx 12rpx 12rpx; border: 1rpx solid $app-border-subtle; }
  952. .gh-demo-block { margin-top: 12rpx; }
  953. .gh-demo-block:first-child { margin-top: 0; }
  954. .gh-demo-head { display: flex; flex-direction: row; align-items: center; justify-content: space-between; padding: 0 20rpx; margin: 12rpx 0 4rpx; }
  955. .gh-demo-name { font-size: calc(24rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  956. .gh-demo-tag { font-size: calc(20rpx * var(--font-scale, 1)); color: $brand-primary; background: rgba($brand-primary, 0.1); border-radius: 8rpx; padding: 2rpx 12rpx; }
  957. .gh-demo-empty { padding: 72rpx 20rpx; display: flex; flex-direction: column; align-items: center; }
  958. .gh-demo-empty-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-strong; font-weight: 600; display: block; }
  959. .gh-demo-empty-sub { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; display: block; margin-top: 10rpx; }
  960. /* 五维健康体系 */
  961. .gh-wuxing { margin: 0 32rpx 24rpx; background: $app-surface; border-radius: 24rpx; padding: 28rpx 24rpx; border: 1rpx solid $app-border-subtle; }
  962. .gh-wuxing-title { display: block; text-align: center; font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 700; color: $facade-text-strong; line-height: 1.45; }
  963. .gh-wuxing-sub { display: block; text-align: center; font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.65; margin-top: 10rpx; }
  964. .gh-rel { margin-top: 24rpx; padding: 20rpx; border-radius: 20rpx; background: $app-bg; }
  965. .gh-rel-title { display: block; font-size: calc(24rpx * var(--font-scale, 1)); font-weight: 700; color: $facade-text-strong; margin-bottom: 12rpx; }
  966. .gh-chain { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; }
  967. .gh-node { font-size: calc(22rpx * var(--font-scale, 1)); font-weight: 700; padding: 6rpx 14rpx; border-radius: 10rpx; }
  968. .gh-node-body { color: $dim-body-deep; background: $dim-body-tint; }
  969. .gh-node-wisdom { color: $dim-wisdom-deep; background: $dim-wisdom-tint; }
  970. .gh-node-wealth { color: $dim-wealth-deep; background: $dim-wealth-tint; }
  971. .gh-node-action { color: $dim-action-deep; background: $dim-action-tint; }
  972. .gh-node-mind { color: $dim-mind-deep; background: $dim-mind-tint; }
  973. .gh-arrow { font-size: calc(20rpx * var(--font-scale, 1)); color: $facade-text-ghost; margin: 0 6rpx; }
  974. .gh-op { font-size: calc(20rpx * var(--font-scale, 1)); color: $status-danger-deep; margin: 0 8rpx; }
  975. .gh-sep { font-size: calc(20rpx * var(--font-scale, 1)); color: $facade-text-ghost; margin: 0 8rpx; }
  976. .gh-rel-hint { display: block; font-size: calc(20rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.65; margin-top: 12rpx; }
  977. .gh-rows { margin-top: 24rpx; display: flex; flex-direction: column; }
  978. .gh-row { display: flex; flex-direction: row; align-items: center; padding: 20rpx 0; border-top: 1rpx solid $app-border-subtle; }
  979. .gh-row:first-child { border-top: none; padding-top: 4rpx; }
  980. .gh-row:active { opacity: 0.85; }
  981. .gh-ic { width: 76rpx; height: 76rpx; border-radius: 20rpx; display: flex; flex-direction: row; align-items: center; justify-content: center; flex-shrink: 0; }
  982. .gh-ic-body { background: $dim-body-tint; }
  983. .gh-ic-wisdom { background: $dim-wisdom-tint; }
  984. .gh-ic-wealth { background: $dim-wealth-tint; }
  985. .gh-ic-action { background: $dim-action-tint; }
  986. .gh-ic-mind { background: $dim-mind-tint; }
  987. .gh-glyph { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 700; }
  988. .gh-ic-body .gh-glyph { color: $dim-body-deep; }
  989. .gh-ic-wisdom .gh-glyph { color: $dim-wisdom-deep; }
  990. .gh-ic-wealth .gh-glyph { color: $dim-wealth-deep; }
  991. .gh-ic-action .gh-glyph { color: $dim-action-deep; }
  992. .gh-ic-mind .gh-glyph { color: $dim-mind-deep; }
  993. .gh-row-info { flex: 1; min-width: 0; margin-left: 20rpx; display: flex; flex-direction: column; }
  994. .gh-row-name { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  995. .gh-row-sub { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.5; margin-top: 6rpx; }
  996. .gh-row-chev { font-size: calc(32rpx * var(--font-scale, 1)); color: $facade-text-ghost; margin-left: 12rpx; flex-shrink: 0; }
  997. .gh-guide { margin: 0 32rpx 8rpx; }
  998. </style>