index.vue 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428
  1. <template>
  2. <view class="container">
  3. <!-- Tabbar 切换过渡页 -->
  4. <tab-transition v-if="showTabTransition" dimCode="mind" ref="tabTransition" @close="showTabTransition = false" />
  5. <!-- 品牌头部 -->
  6. <PageBanner theme="mind-wisdom"
  7. tagline="心智成长 · 智慧人生"
  8. quote="知己知彼,百战不殆" />
  9. <!-- 品牌定位语(登录前显示) -->
  10. <view class="brand-strap" v-if="!isLoggedIn">
  11. <text class="brand-strap-text">关注全家心理健康与情绪成长</text>
  12. </view>
  13. <!-- ===== 家庭天盘模块(今日运势 / 今日心情 / 吉位) ===== -->
  14. <FamilyTianpanCard
  15. v-if="isLoggedIn"
  16. :visible="isLoggedIn"
  17. :fortune="dailyFortuneSafe"
  18. :mood="todayMood"
  19. :dominantElement="dominantElementSafe"
  20. :weeklyTip="familyWeeklyInsight"
  21. :traditionalData="traditionalData" />
  22. <!-- 家庭成员选择条 -->
  23. <FamilyMemberStrip
  24. v-if="currentView === 'self' && isLoggedIn"
  25. :members="familyMembersVisible"
  26. :selectedMemberId="selectedMemberId"
  27. @select="onFamilyMemberSelect"
  28. @removed="loadFamilyMembersVisible" />
  29. <!-- 游客引导语 -->
  30. <view class="monthly-guidance" v-if="!isLoggedIn">
  31. <text class="guidance-icon">🔥</text>
  32. <text class="guidance-text">{{ monthlyGuidance }}</text>
  33. </view>
  34. <!-- 登录后:五维能量条 -->
  35. <FamilyEnergyBar
  36. v-if="isLoggedIn"
  37. dimensionCode="mind"
  38. :sandboxData="sandboxData" />
  39. <!-- 心理指标卡片 -->
  40. <view class="indicator-cards-section" v-if="isLoggedIn && mindIndicators.length > 0">
  41. <view class="section-header">
  42. <text class="section-title">🔥 心理指标</text>
  43. <text class="section-more" @click="goMindDetail">更多 ›</text>
  44. </view>
  45. <view class="indicator-cards">
  46. <view
  47. v-for="(ind, i) in mindIndicators"
  48. :key="ind.code"
  49. class="indicator-card"
  50. :class="{ 'no-data': !ind.value }"
  51. @click="goMindDetail()"
  52. >
  53. <view class="indicator-header">
  54. <text class="indicator-name">{{ ind.name }}</text>
  55. <text class="indicator-unit" v-if="ind.unit">{{ ind.unit }}</text>
  56. </view>
  57. <view class="indicator-body">
  58. <text class="indicator-value" v-if="ind.value || ind.numericValue !== null">{{ ind.value || formatNumeric(ind.numericValue) }}</text>
  59. <text class="indicator-placeholder" v-else>暂无数据</text>
  60. </view>
  61. <view class="indicator-footer">
  62. <text class="indicator-range" v-if="ind.refRange">参考: {{ ind.refRange }}</text>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- 心理报告卡片(登录后可见) -->
  68. <view class="emi-card" v-if="isLoggedIn && emiData">
  69. <view class="emi-header">
  70. <text class="emi-title">心理测评报告</text>
  71. <view class="emi-overall-wrap">
  72. <text class="emi-overall-label">综合EQ分</text>
  73. <text class="emi-overall-value">{{ emiData.overallScore || 0 }}</text>
  74. <text :class="['emi-overall-level', 'level-' + getScoreLevel(emiData.overallScore || 0)]">
  75. {{ getScoreLevelText(emiData.overallScore || 0) }}
  76. </text>
  77. </view>
  78. </view>
  79. <view class="emi-dimensions">
  80. <view class="emi-dimension" v-for="dim in emiDimensions" :key="dim.key">
  81. <view class="emi-dim-header">
  82. <text class="emi-dim-label">{{ dim.label }}</text>
  83. <view class="emi-dim-values">
  84. <text class="emi-dim-score">{{ emiData[dim.key] || 0 }}</text>
  85. <text :class="['emi-dim-level', 'level-' + getScoreLevel(emiData[dim.key] || 0)]">
  86. {{ getScoreLevelText(emiData[dim.key] || 0) }}
  87. </text>
  88. </view>
  89. </view>
  90. <view class="emi-dim-bar">
  91. <view class="emi-dim-bar-fill" :style="{ width: (emiData[dim.key] || 0) + '%', background: dim.color }"></view>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="emi-footer" @click="goEmotionReport">
  96. <text class="emi-footer-text">查看详情</text>
  97. <text class="emi-footer-icon">&#x2192;</text>
  98. </view>
  99. </view>
  100. <!-- 心维度画像 - 总体说明 -->
  101. <view class="dimension-portrait-section" v-if="isLoggedIn && mindPortrait">
  102. <view class="section-header">
  103. <text class="section-title">🧭 心维度画像</text>
  104. <text class="portrait-tier">{{ mindPortrait.tierLabel }}</text>
  105. </view>
  106. <view class="portrait-summary">
  107. <text class="portrait-desc">{{ mindPortrait.summary }}</text>
  108. </view>
  109. <view class="portrait-dimensions">
  110. <view class="portrait-dim-item" v-for="dim in mindPortrait.dims" :key="dim.code">
  111. <view class="portrait-dim-header">
  112. <view class="portrait-dim-icon" :style="{ background: dim.color }">{{ dim.icon }}</view>
  113. <text class="portrait-dim-name">{{ dim.name }}</text>
  114. <text class="portrait-dim-score">{{ dim.score }}</text>
  115. </view>
  116. <view class="portrait-dim-bar-track">
  117. <view class="portrait-dim-bar-fill" :style="{ width: dim.score + '%', background: dim.color }"></view>
  118. </view>
  119. <text class="portrait-dim-desc">{{ dim.desc }}</text>
  120. </view>
  121. </view>
  122. <view class="portrait-tip" v-if="mindPortrait.tip">
  123. <text class="portrait-tip-text">💡 {{ mindPortrait.tip }}</text>
  124. </view>
  125. </view>
  126. <!-- 肠脑轴情绪卡片 -->
  127. <view class="section" v-if="gutIndicators && gutIndicators.length > 0">
  128. <view class="section-header">
  129. <text class="section-title">🌱 情绪与肠胃</text>
  130. </view>
  131. <view class="gut-insight-text" v-if="gutInsight">
  132. <text>{{ gutInsight }}</text>
  133. </view>
  134. <view class="gut-indicator-list">
  135. <view class="gut-indicator-item" v-for="ind in gutIndicators" :key="ind.id">
  136. <view class="gut-indicator-left">
  137. <text class="gut-indicator-name">{{ ind.indicatorName || ind.name }}</text>
  138. <text class="gut-indicator-impact" v-if="emotionImpactLabel(ind.indicatorName || ind.name)">影响{{ emotionImpactLabel(ind.indicatorName || ind.name) }}</text>
  139. </view>
  140. <view class="gut-indicator-bar-track">
  141. <view class="gut-indicator-bar-fill" :style="{ width: indicatorBarWidth(ind), background: indicatorColor(ind.status) }"></view>
  142. </view>
  143. <text class="gut-indicator-value">{{ formatIndicatorValue(ind) }}{{ ind.unit || '%' }}</text>
  144. <text :class="['gut-indicator-status', 'status-' + (ind.status || 'normal')]">{{ statusLabel(ind.status) }}</text>
  145. </view>
  146. </view>
  147. </view>
  148. <!-- ===== Phase 1.2: 心理告警横幅 ===== -->
  149. <PsychCrisisBanner v-if="isLoggedIn" :memberId="currentChildId" source="screening" />
  150. <!-- ===== 底部:功能入口 Grid(通用,两行) ===== -->
  151. <view class="func-section" v-if="sectionVisible('func_entries')">
  152. <view class="func-grid">
  153. <view class="func-row">
  154. <view class="func-item" v-for="item in funcListRow1" :key="item.label" @click="onFuncClick(item)">
  155. <view class="func-icon-wrap">
  156. <text class="func-icon">{{ item.icon }}</text>
  157. </view>
  158. <text class="func-label">{{ item.label }}</text>
  159. </view>
  160. </view>
  161. <view class="func-row">
  162. <view class="func-item" v-for="item in funcListRow2" :key="item.label" @click="onFuncClick(item)">
  163. <view class="func-icon-wrap">
  164. <text class="func-icon">{{ item.icon }}</text>
  165. </view>
  166. <text class="func-label">{{ item.label }}</text>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. <!-- 心13维雷达图(分组展示,登录后且选中成员时) -->
  172. <view class="section" v-if="isLoggedIn && currentMemberEnergies">
  173. <view class="section-header">
  174. <text class="section-title">🧠 情绪与性格</text>
  175. </view>
  176. <view class="radar-group" v-for="(group, gIdx) in mindRadarGroups" :key="gIdx">
  177. <text class="radar-group-label">{{ group.label }}</text>
  178. <RadarChart
  179. :dimensions="group.dimensions"
  180. :scores="getMindGroupScores(group)"
  181. :avg-scores="getMindGroupFamilyScores(group)"
  182. :population-scores="getGroupPopulationScores(group)"
  183. fillColor="#FF6B9D"
  184. gridColor="#FCE7F3"
  185. labelColor="#9D174D"
  186. :width="540"
  187. :height="540" />
  188. </view>
  189. </view>
  190. <!-- 心维度介绍卡片(登录后显示) -->
  191. <DimensionIntroCard dimCode="mind" v-if="isLoggedIn" learn-more-url="/pages/mind-detail/dimension-intro" />
  192. <!-- 底部占位 -->
  193. <view class="bottom-spacer"></view>
  194. <FloatingAvatar />
  195. </view>
  196. </template>
  197. <script>
  198. import TabTransition from '../../components/tab-transition.vue'
  199. import PageBanner from '../../components/PageBanner.vue'
  200. import DimensionIntroCard from '../../components/DimensionIntroCard.vue'
  201. import RadarChart from '../../components/RadarChart.vue'
  202. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  203. import PsychCrisisBanner from '@/pages/mind-detail/components/PsychCrisisBanner.vue'
  204. import FloatingAvatar from '../../components/AIFloatingAvatar.vue'
  205. import FamilyTianpanCard from '@/pages/mind-detail/components/FamilyTianpanCard.vue'
  206. import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
  207. import { getVisibleSections, getEmiReport, getFamilyEnergySandbox, getEnergySandbox, getChildren, getFamilyMemberList, getEnergyOverview, getContactList, getHealthAlerts, getMilestones, getDanReportByChild, getFamilyFortune, getLatestIndicators, getRadarData } from '../../utils/api.js'
  208. import nav from '../../utils/nav.js'
  209. import config from '../../config.js'
  210. import { parseDate } from '../../utils/format.js'
  211. export default {
  212. components: { TabTransition, PageBanner, RadarChart, FamilyEnergyBar, PsychCrisisBanner, FloatingAvatar, FamilyTianpanCard, FamilyMemberStrip, DimensionIntroCard },
  213. data() {
  214. return {
  215. isLoggedIn: false,
  216. role: null,
  217. showTabTransition: true,
  218. currentChildId: null,
  219. selectedMemberId: null,
  220. visibleSections: [],
  221. familyMembersVisible: [],
  222. // 心理 Tab 数据
  223. emiData: null,
  224. emiLoading: true,
  225. emiDimensions: [
  226. { key: 'emotionStability', label: '情绪稳定性', color: '#FF6B35' }
  227. ],
  228. // 大五维度(用于雷达图)
  229. personalityDimensions: [
  230. { key: 'opennessScore', label: '开放性' },
  231. { key: 'conscientiousnessScore', label: '尽责性' },
  232. { key: 'extraversionScore', label: '外向性' },
  233. { key: 'agreeablenessScore', label: '宜人性' },
  234. { key: 'neuroticismScore', label: '神经质' }
  235. ],
  236. // 功能入口
  237. funcList: [
  238. { icon: '\u{1F4D6}', label: '阅读', needLogin: false, page: '/pages/article-center/index?dimension=mind' },
  239. { icon: '\u{1F4CA}', label: '测评报告', needLogin: true, page: '/pages/mind-detail/emotion-report' },
  240. { icon: '\u{1F4DD}', label: '成长记录', needLogin: true, page: '/pages/growth-main/index' },
  241. { icon: '\u{2728}', label: '情绪打卡', needLogin: true, page: '/pages/mind-detail/emotion-checkin' },
  242. { icon: '\u{1F4C8}', label: '情绪趋势', needLogin: true, page: '/pages/mind-detail/emotion-trend' },
  243. { icon: '\u{1F9E9}', label: '心理自评', needLogin: true, page: '/pages/mind-detail/screening' },
  244. { icon: '\u{1F3E0}', label: '家庭天盘', needLogin: true, page: '/pages/mind-detail/family-dashboard' },
  245. { icon: '\u{1F9D8}', label: '疏导工具', needLogin: true, page: '/pages/mind-detail/soothe-toolbox' },
  246. { icon: '\u{1F31F}', label: '先天画像', needLogin: true, page: '/pages/mind-detail/innate-portrait' }
  247. ],
  248. articles: [],
  249. // 肠脑轴数据
  250. gutIndicators: null,
  251. gutInsight: '',
  252. // 传统文化数据
  253. traditionalData: null,
  254. traditionalLoading: true,
  255. compatibilityData: null,
  256. wuxingConfig: {
  257. wood: { label: '木', color: '#10B981' },
  258. fire: { label: '火', color: '#FF6B9D' },
  259. earth: { label: '土', color: '#FF8C42' },
  260. metal: { label: '金', color: '#6366F1' },
  261. water: { label: '水', color: '#3B82F6' }
  262. },
  263. pillarLabels: { year: '年柱', month: '月柱', day: '日柱', hour: '时柱' },
  264. familyScore: 0,
  265. // 五维组件数据
  266. userName: '',
  267. children: [],
  268. mindSubDims: [],
  269. mindIndicators: [],
  270. sandboxData: null,
  271. currentView: 'self', // 'self' | 'family'
  272. contactList: [],
  273. healthAlerts: [],
  274. milestones: [],
  275. danReports: [],
  276. // 心13维雷达图分组配置
  277. mindRadarGroups: [
  278. {
  279. label: '大五人格',
  280. dimensions: [
  281. { key: 'bigFiveOpenness', label: '开放性' },
  282. { key: 'bigFiveConscientiousness', label: '尽责性' },
  283. { key: 'bigFiveExtraversion', label: '外向性' },
  284. { key: 'bigFiveAgreeableness', label: '宜人性' },
  285. { key: 'bigFiveNeuroticism', label: '神经质' }
  286. ]
  287. },
  288. {
  289. label: '情绪稳定性',
  290. dimensions: [
  291. { key: 'emotionStability', label: '情绪稳定性' }
  292. ]
  293. },
  294. {
  295. label: '自驱力',
  296. dimensions: [
  297. { key: 'driveAutonomy', label: '自主性' },
  298. { key: 'driveCompetence', label: '胜任感' },
  299. { key: 'driveRelatedness', label: '归属感' }
  300. ]
  301. },
  302. {
  303. label: '自我概念',
  304. dimensions: [
  305. { key: 'selfConceptOverall', label: '综合自我概念' }
  306. ]
  307. }
  308. ],
  309. // 家庭天盘 - 今日心情(占位数据)
  310. todayMood: {
  311. emoji: '\u{1F60A}',
  312. text: '平静',
  313. score: 65
  314. },
  315. // 家庭天盘 - 每日运势数据
  316. dailyFortuneData: null,
  317. // 心维度雷达图人群位置分数 (dimensionKey -> score)
  318. mindPopulationScores: {}
  319. }
  320. },
  321. computed: {
  322. /** 每月引导语 */
  323. monthlyGuidance: function() {
  324. var month = new Date().getMonth()
  325. var messages = [
  326. '一月:新年新起点,从情绪觉察开始',
  327. '二月:春节团聚,关注家人心理联结',
  328. '三月:春意盎然,适合情绪释放',
  329. '四月:清明时节,整理内心情绪',
  330. '五月:劳动之余,关注心理健康',
  331. '六月:中考高考季,减压情绪管理',
  332. '七月:暑期到来,培养情绪调节能力',
  333. '八月:夏末秋初,回顾情绪成长',
  334. '九月:开学季,关注家庭成员心理适应',
  335. '十月:国庆假期,增进亲子沟通',
  336. '十一月:秋冬交替,预防情绪低落',
  337. '十二月:年终总结,规划心理成长'
  338. ]
  339. return messages[month] || messages[0]
  340. },
  341. personalityScores: function() {
  342. if (!this.emiData) return []
  343. return [
  344. this.emiData.opennessScore || 0,
  345. this.emiData.conscientiousnessScore || 0,
  346. this.emiData.extraversionScore || 0,
  347. this.emiData.agreeablenessScore || 0,
  348. this.emiData.neuroticismScore || 0
  349. ]
  350. },
  351. emotionArticles: function() {
  352. if (!this.articles || this.articles.length === 0) return []
  353. var result = []
  354. for (var i = 0; i < this.articles.length; i++) {
  355. var a = this.articles[i]
  356. if (a.relatedDimensions && a.relatedDimensions.indexOf('mind') !== -1) {
  357. result.push(a)
  358. }
  359. }
  360. if (result.length === 0) return this.articles.slice(0, 5)
  361. return result.slice(0, 5)
  362. },
  363. wuxingData: function() {
  364. if (!this.traditionalData || !this.traditionalData.wuxingElements) return []
  365. var elements = this.traditionalData.wuxingElements
  366. var keys = ['wood', 'fire', 'earth', 'metal', 'water']
  367. var result = []
  368. for (var i = 0; i < keys.length; i++) {
  369. var k = keys[i]
  370. if (elements[k] !== undefined) {
  371. result.push({
  372. key: k,
  373. label: this.wuxingConfig[k].label,
  374. color: this.wuxingConfig[k].color,
  375. value: elements[k]
  376. })
  377. }
  378. }
  379. return result.sort(function(a, b) { return b.value - a.value })
  380. },
  381. currentDimensionCode: function() {
  382. return 'mind'
  383. },
  384. funcListRow1: function() {
  385. return this.funcList.slice(0, 4)
  386. },
  387. funcListRow2: function() {
  388. return this.funcList.slice(4)
  389. },
  390. // ===== 关键信息 - 家庭 =====
  391. familyWuxingLabel: function() {
  392. if (!this.compatibilityData || !this.compatibilityData.familyWuxing || !this.compatibilityData.familyWuxing.aggregatePercentages) return null
  393. var pcts = this.compatibilityData.familyWuxing.aggregatePercentages
  394. var keys = ['wood', 'fire', 'earth', 'metal', 'water']
  395. var maxKey = null
  396. var maxVal = -1
  397. for (var i = 0; i < keys.length; i++) {
  398. if (pcts[keys[i]] !== undefined && pcts[keys[i]] > maxVal) {
  399. maxVal = pcts[keys[i]]
  400. maxKey = keys[i]
  401. }
  402. }
  403. if (!maxKey) return null
  404. return { key: maxKey, label: this.wuxingConfig[maxKey].label, color: this.wuxingConfig[maxKey].color, value: maxVal }
  405. },
  406. familyMemberCount: function() {
  407. if (!this.compatibilityData || !this.compatibilityData.members) return 0
  408. return this.compatibilityData.members.length
  409. },
  410. familyWeeklyInsight: function() {
  411. if (!this.compatibilityData || !this.compatibilityData.weeklyInsight) return ''
  412. return this.compatibilityData.weeklyInsight
  413. },
  414. // ===== 关键信息 - 个人 =====
  415. dominantElement: function() {
  416. if (!this.traditionalData || !this.traditionalData.wuxingElements) return null
  417. var elements = this.traditionalData.wuxingElements
  418. var keys = ['wood', 'fire', 'earth', 'metal', 'water']
  419. var maxKey = null
  420. var maxVal = -1
  421. for (var i = 0; i < keys.length; i++) {
  422. if (elements[keys[i]] !== undefined && elements[keys[i]] > maxVal) {
  423. maxVal = elements[keys[i]]
  424. maxKey = keys[i]
  425. }
  426. }
  427. return maxKey
  428. },
  429. luckyColorInfo: function() {
  430. var colorMap = {
  431. wood: { name: '绿', hex: '#10B981' },
  432. fire: { name: '红', hex: '#FF6B9D' },
  433. earth: { name: '黄', hex: '#FF8C42' },
  434. metal: { name: '白', hex: '#6366F1' },
  435. water: { name: '蓝', hex: '#3B82F6' }
  436. }
  437. var elem = this.dominantElement
  438. if (!elem) return null
  439. return colorMap[elem] || null
  440. },
  441. luckyNumber: function() {
  442. if (this.traditionalData && this.traditionalData.lifeNumber) {
  443. return this.traditionalData.lifeNumber
  444. }
  445. var numMap = { wood: 3, fire: 9, earth: 5, metal: 7, water: 1 }
  446. var elem = this.dominantElement
  447. return elem ? numMap[elem] : null
  448. },
  449. fortuneSeed: function() {
  450. if (this.traditionalData && this.traditionalData.lifeNumber) {
  451. return String(this.traditionalData.lifeNumber)
  452. }
  453. return '0'
  454. },
  455. // WXML 不支持模板内 || {} 字面量,需在 computed 中预先做 fallback
  456. dailyFortuneSafe: function() {
  457. return this.dailyFortune || {}
  458. },
  459. // WXML 不支持模板内 || '' 字面量,需在 computed 中预先做 fallback
  460. dominantElementSafe: function() {
  461. return this.dominantElement || ''
  462. },
  463. dailyFortune: function() {
  464. // 优先使用后端接口数据
  465. if (this.dailyFortuneData) {
  466. var levels = ['大吉', '吉', '平', '凶', '大凶']
  467. return {
  468. level: this.dailyFortuneData.level,
  469. text: levels[this.dailyFortuneData.level],
  470. description: this.dailyFortuneData.description
  471. }
  472. }
  473. // 兼容模式:没有接口数据时使用原算法
  474. if (!this.dominantElement) return null
  475. var today = new Date()
  476. var dateStr = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate()
  477. var seedStr = dateStr + (this.fortuneSeed || '')
  478. var hash = 0
  479. for (var i = 0; i < seedStr.length; i++) {
  480. hash = ((hash << 5) - hash) + seedStr.charCodeAt(i)
  481. hash = hash & hash
  482. }
  483. var level = Math.abs(hash) % 5
  484. var levels = ['大吉', '吉', '平', '凶', '大凶']
  485. var descMap = {
  486. wood: ['大吉:木气旺盛,宜规划', '吉:行动力强', '平:静心养性', '凶:谨言慎行', '大凶:忌冲动'],
  487. fire: ['大吉:热情高涨', '吉:精力充沛', '平:适当休息', '凶:注意情绪', '大凶:静心冥想'],
  488. earth: ['大吉:稳重踏实', '吉:贵人运佳', '平:按部就班', '凶:注意肠胃', '大凶:不宜投资'],
  489. metal: ['大吉:决策力强', '吉:思维清晰', '平:保持专注', '凶:注意言辞', '大凶:不宜强求'],
  490. water: ['大吉:灵感丰富', '吉:人际和谐', '平:安静内省', '凶:情绪波动', '大凶:宜藏不宜放']
  491. }
  492. var descList = descMap[this.dominantElement] || descMap.wood
  493. return { level: level, text: levels[level], description: descList[level] }
  494. },
  495. /** 当前选中成员的能量数据(从 sandboxData.members 中按 selectedMemberId 查找) */
  496. currentMemberEnergies: function() {
  497. if (!this.sandboxData || !this.sandboxData.members) return null
  498. var members = this.sandboxData.members
  499. var targetId = this.selectedMemberId || this.currentChildId
  500. for (var i = 0; i < members.length; i++) {
  501. var m = members[i]
  502. if (m && (m.memberId === targetId)) return m
  503. }
  504. return members[0] || null
  505. },
  506. mindPortrait: function() {
  507. var self = this
  508. if (!this.isLoggedIn || !this.emiData) return null
  509. var e = this.emiData
  510. var dims = [
  511. { key: 'emotionStability', label: '情绪稳定性', color: '#FF6B9D', desc: '情绪识别与调控能力' },
  512. { key: 'opennessScore', label: '开放性', color: '#6366F1', desc: '对新事物的接受程度' },
  513. { key: 'conscientiousnessScore', label: '尽责性', color: '#F59E0B', desc: '做事有条理、自律程度' },
  514. { key: 'extraversionScore', label: '外向性', color: '#10B981', desc: '社交活跃与外向程度' },
  515. { key: 'agreeablenessScore', label: '宜人性', color: '#FF8C42', desc: '与人相处的和谐程度' },
  516. { key: 'neuroticismScore', label: '神经质', color: '#8B5CF6', desc: '情绪波动程度(反向)' }
  517. ]
  518. var result = { overall: 0, tierLabel: '', summary: '', dims: [], tip: '' }
  519. var total = 0
  520. var count = 0
  521. var dimList = []
  522. for (var i = 0; i < dims.length; i++) {
  523. var key = dims[i].key
  524. var score = e[key] || 0
  525. if (isNaN(score)) score = 0
  526. score = Math.max(0, Math.min(100, Number(score)))
  527. total += score
  528. count++
  529. var matched = dims.find(function(d) { return d.key === key })
  530. dimList.push({
  531. code: key,
  532. name: matched ? matched.label : key,
  533. score: Math.round(score),
  534. color: matched ? matched.color : '#FF6B9D',
  535. desc: matched ? matched.desc : ''
  536. })
  537. }
  538. if (count === 0) return null
  539. result.overall = Math.round(total / count)
  540. result.dims = dimList
  541. var o = result.overall
  542. if (o >= 80) {
  543. result.tierLabel = '心灵智者'
  544. result.summary = '您的心理状态非常健康,情绪稳定、人格成熟且内心强大。'
  545. result.tip = '保持内心平衡,可分享经验帮助家人共同成长'
  546. } else if (o >= 60) {
  547. result.tierLabel = '心灵进取者'
  548. result.summary = '您的心理状态良好,具备较强的情绪调节能力和自我认知。'
  549. result.tip = '关注情绪波动,练习正念冥想,持续提升心理韧性'
  550. } else if (o >= 40) {
  551. result.tierLabel = '心灵探索者'
  552. result.summary = '您的心理状态正在建立基础,情绪管理有待加强。'
  553. result.tip = '从每日情绪打卡开始,逐步建立情绪觉察习惯'
  554. } else {
  555. result.tierLabel = '心灵关怀者'
  556. result.summary = '您可能正处于情绪波动期,需要更多关注与支持。'
  557. result.tip = '建议寻求专业心理帮助,或向家人朋友倾诉'
  558. }
  559. return result
  560. }
  561. },
  562. onShow() {
  563. this.showTabTransition = true
  564. var token = uni.getStorageSync('token')
  565. this.isLoggedIn = !!token
  566. if (this.isLoggedIn) {
  567. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  568. // FIX: 从 Vuex store 读取 currentChildId,而非仅从 localStorage
  569. this.currentChildId = (this.$store.state && this.$store.state.currentChildId) || uni.getStorageSync('currentChildId') || null
  570. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  571. }
  572. this.loadSectionConfig()
  573. if (this.isLoggedIn) {
  574. this.loadChildren()
  575. this.loadFamilyMembersVisible()
  576. this.loadSandboxData()
  577. this.loadMindRadarPopulationData()
  578. this.loadEmiData()
  579. this.loadGutData()
  580. this.loadEnergyData()
  581. this.loadTraditionalCultureData()
  582. this.loadContacts()
  583. this.loadHealthAlerts()
  584. this.loadMilestones()
  585. this.loadDanReports()
  586. }
  587. // 游客也能浏览活动和商品
  588. this.loadFamilyFortune()
  589. this._watchPageReady()
  590. },
  591. methods: {
  592. /** 获取心维度分组雷达图的分值数组 */
  593. getMindGroupScores: function(group) {
  594. var member = this.currentMemberEnergies
  595. if (!member) return []
  596. var scores = []
  597. var dims = group.dimensions
  598. for (var i = 0; i < dims.length; i++) {
  599. scores.push(member[dims[i].key] || 0)
  600. }
  601. return scores
  602. },
  603. /** 获取心维度分组雷达图的家庭平均分(sandboxData.members 各维度均值) */
  604. getMindGroupFamilyScores: function(group) {
  605. if (!this.sandboxData || !this.sandboxData.members) return []
  606. var members = this.sandboxData.members
  607. var dims = group.dimensions
  608. var scores = []
  609. for (var i = 0; i < dims.length; i++) {
  610. var key = dims[i].key
  611. var sum = 0, count = 0
  612. for (var j = 0; j < members.length; j++) {
  613. var val = members[j][key]
  614. if (val !== undefined && val !== null && val > 0) { sum += val; count++ }
  615. }
  616. scores.push(count > 0 ? Math.round(sum / count) : 0)
  617. }
  618. return scores
  619. },
  620. /** 获取分组对应的人群位置分数 */
  621. getGroupPopulationScores: function(group) {
  622. if (!this.mindPopulationScores) return []
  623. var scores = []
  624. var dims = group.dimensions
  625. for (var i = 0; i < dims.length; i++) {
  626. scores.push(this.mindPopulationScores[dims[i].key] || 0)
  627. }
  628. return scores
  629. },
  630. // ===== 区块可见性 =====
  631. loadSectionConfig: function() {
  632. var self = this
  633. var baseSections = ['func_entries', 'daily_tip', 'recommended_reading']
  634. if (!uni.getStorageSync('token')) {
  635. self.visibleSections = baseSections
  636. return
  637. }
  638. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  639. getVisibleSections({ pageKey: 'mind', role: role }).then(function(res) {
  640. if (res.code === 200 && res.data) {
  641. var keys = res.data.map(function(s) { return s.sectionKey })
  642. var merged = baseSections.slice()
  643. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  644. self.visibleSections = merged
  645. }
  646. }).catch(function() {
  647. self.visibleSections = ['func_entries', 'daily_tip', 'recommended_reading', 'mind_tasks', 'related_activities', 'purchased_courses']
  648. })
  649. },
  650. // 加载家庭天盘数据
  651. loadFamilyFortune: function() {
  652. var self = this
  653. if (!self.isLoggedIn) return
  654. getFamilyFortune().then(function(res) {
  655. if (res.code === 200 && res.data) {
  656. // 更新 todayMood 占位数据为真实接口数据
  657. self.todayMood = {
  658. emoji: res.data.moodEmoji || '\u{1F60A}',
  659. text: res.data.moodText || '平静',
  660. score: res.data.moodScore || 65
  661. }
  662. // 更新 dailyFortune computed 函数依赖的数据
  663. self.dailyFortuneData = {
  664. level: res.data.fortuneLevel,
  665. text: res.data.fortuneLevelText,
  666. description: res.data.fortuneDescription
  667. }
  668. // 更新主导五行
  669. self.traditionalData = self.traditionalData || {}
  670. self.traditionalData.wuxingElements = {}
  671. if (res.data.dominantElement) {
  672. self.traditionalData.wuxingElements[res.data.dominantElement] = 100
  673. }
  674. // 更新周报提示
  675. self.compatibilityData = self.compatibilityData || {}
  676. self.compatibilityData.weeklyInsight = res.data.weeklyTip || self.compatibilityData.weeklyInsight
  677. }
  678. }).catch(function(err) {
  679. console.error('Failed to load family fortune:', err)
  680. })
  681. },
  682. viewReport: function(report) {
  683. if (report && report.fileUrl) {
  684. uni.downloadFile({
  685. url: report.fileUrl,
  686. success: function(res) {
  687. if (res.statusCode === 200) {
  688. uni.openDocument({
  689. filePath: res.tempFilePath,
  690. success: function() {
  691. console.log('打开报告成功')
  692. }
  693. })
  694. }
  695. }
  696. })
  697. }
  698. },
  699. formatDate: function(dateStr) {
  700. if (!dateStr) return ''
  701. var d = parseDate(dateStr)
  702. if (!d) return ''
  703. var month = d.getMonth() + 1
  704. var day = d.getDate()
  705. return month + '月' + day + '日'
  706. },
  707. sectionVisible: function(key) {
  708. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  709. },
  710. // ===== 心理 Tab:EMI 数据 =====
  711. loadEmiData: function() {
  712. var self = this
  713. var memberId = self.currentChildId
  714. if (!memberId) {
  715. self.emiLoading = false
  716. return
  717. }
  718. self.emiLoading = true
  719. getEmiReport(memberId).then(function(res) {
  720. if (res.code === 200 && res.data) {
  721. self.emiData = res.data
  722. self.mindSubDims = (function() { var e = self.emiData || {}; return [{label:'情绪稳定性', score:e.emotionStability||0, desc:'识别、理解和管理情绪的综合能力'}, {label:'开放性', score:e.opennessScore||0, desc:'对新事物的接受程度'}, {label:'尽责性', score:e.conscientiousnessScore||0, desc:'做事有条理的程度'}, {label:'外向性', score:e.extraversionScore||0, desc:'社交活跃度'}, {label:'宜人性', score:e.agreeablenessScore||0, desc:'与人相处的和谐度'}, {label:'神经质', score:e.neuroticismScore||0, desc:'情绪波动程度(反向)'}, {label:'自主性', score:e.driveAutonomy||0, desc:'内在驱动力'}, {label:'胜任感', score:e.driveCompetence||0, desc:'对自己能力的信心'}, {label:'归属感', score:e.driveRelatedness||0, desc:'感受被接纳'}]; })();
  723. self.loadMindIndicators(memberId)
  724. }
  725. self.emiLoading = false
  726. }).catch(function() {
  727. self.emiLoading = false
  728. })
  729. },
  730. // ===== 肠脑轴情绪指标 =====
  731. loadGutData: function() {
  732. var self = this
  733. var memberId = self.currentChildId
  734. if (!memberId) return
  735. var token = uni.getStorageSync('token')
  736. // 获取神经递质指标
  737. uni.request({
  738. url: config.API_BASE_URL + '/api/mind/neurotransmitters',
  739. method: 'POST',
  740. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  741. data: { memberId: memberId },
  742. success: function(r) {
  743. if (r.statusCode === 200 && r.data && r.data.code === 200) {
  744. var list = r.data.data
  745. if (Array.isArray(list) && list.length > 0) {
  746. self.gutIndicators = list.slice(0, 4)
  747. }
  748. }
  749. }
  750. })
  751. // 获取情绪洞察摘要
  752. uni.request({
  753. url: config.API_BASE_URL + '/api/mind/gut-emotion-insight',
  754. method: 'POST',
  755. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  756. data: { memberId: memberId },
  757. success: function(r) {
  758. if (r.statusCode === 200 && r.data && r.data.code === 200 && r.data.data) {
  759. self.gutInsight = r.data.data.summary || ''
  760. }
  761. }
  762. })
  763. },
  764. indicatorColor: function(status) {
  765. if (status === 'abnormal' || status === '偏高' || status === '偏低') return '#EF4444'
  766. if (status === 'warning' || status === '偏高' || status === '偏低') return '#F59E0B'
  767. return '#10B981'
  768. },
  769. statusLabel: function(status) {
  770. if (status === 'normal') return '正常'
  771. if (status === 'abnormal') return '异常'
  772. if (status === 'warning') return '警讯'
  773. return status || '正常'
  774. },
  775. // 情绪影响映射:指标名 → 影响的情绪功能
  776. emotionImpactLabel: function(name) {
  777. if (!name) return ''
  778. if (name.indexOf('血清素') !== -1 || name.indexOf('5-HT') !== -1) return '情绪稳定'
  779. if (name.indexOf('多巴胺') !== -1 || name.indexOf('Dopamine') !== -1) return '愉悦·动力'
  780. if (name.indexOf('GABA') !== -1 || name.indexOf('氨基丁酸') !== -1) return '放松·减压'
  781. if (name.indexOf('色氨酸') !== -1 || name.indexOf('Tryptophan') !== -1) return '睡眠·情绪'
  782. if (name.indexOf('褪黑素') !== -1 || name.indexOf('Melatonin') !== -1) return '睡眠调节'
  783. if (name.indexOf('皮质醇') !== -1 || name.indexOf('Cortisol') !== -1) return '压力水平'
  784. return ''
  785. },
  786. // 指标值展示:后端字段为 indicatorValue,兼容数值型
  787. formatIndicatorValue: function(ind) {
  788. if (!ind) return ''
  789. var v = ind.value !== undefined && ind.value !== null ? ind.value : ind.indicatorValue
  790. if (v === undefined || v === null || v === '') return ''
  791. return String(v)
  792. },
  793. // 指标条宽度:将指标值归一化为 0-100% 百分比
  794. indicatorBarWidth: function(ind) {
  795. var raw = ind.value !== undefined && ind.value !== null ? ind.value : ind.indicatorValue
  796. var n = parseFloat(raw)
  797. if (!isNaN(n) && n >= 0 && n <= 100) return n + '%'
  798. if (!isNaN(n) && n > 100) return '100%'
  799. var st = ind.status || ''
  800. if (st === '偏低' || st === '缺乏' || st === 'abnormal') return '30%'
  801. if (st === '偏高' || st === '过高') return '75%'
  802. return '55%'
  803. },
  804. // ===== EMI 分数评级 =====
  805. getScoreLevel: function(score) {
  806. if (score >= 85) return 'excellent'
  807. if (score >= 70) return 'good'
  808. if (score >= 55) return 'average'
  809. return 'low'
  810. },
  811. getScoreLevelText: function(score) {
  812. if (score >= 85) return '优秀'
  813. if (score >= 70) return '良好'
  814. if (score >= 55) return '一般'
  815. return '需提升'
  816. },
  817. // ===== 导航 =====
  818. goEmotionReport: function() {
  819. var memberId = this.currentChildId || ''
  820. uni.navigateTo({ url: '/pages/mind-detail/emotion-report?memberId=' + memberId })
  821. },
  822. goArticles: function() {
  823. uni.navigateTo({ url: '/pages/article-center/index?dimension=mind' })
  824. },
  825. onFuncClick: function(item) {
  826. if (item.needLogin && !this.isLoggedIn) {
  827. uni.showModal({
  828. title: '提示',
  829. content: '请先登录后使用此功能',
  830. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  831. })
  832. return
  833. }
  834. if (item.page) {
  835. var url = item.page
  836. if (item.page.indexOf('innate-portrait') !== -1 || item.page.indexOf('innate-trajectory') !== -1) {
  837. var memberId = this.currentChildId
  838. if (!memberId) {
  839. uni.showToast({ title: '请先选择家庭成员', icon: 'none' })
  840. return
  841. }
  842. var familyId = (this.$store.state && this.$store.state.familyId) || uni.getStorageSync('familyId') || ''
  843. url += '?memberId=' + memberId + '&memberType=child&familyId=' + familyId
  844. }
  845. nav.goPage(url)
  846. }
  847. },
  848. // ===== 孩子列表与维度数据 =====
  849. loadChildren: function() {
  850. var self = this
  851. getChildren().then(function(res) {
  852. if (res.code === 200 && res.data) {
  853. self.children = res.data
  854. var savedChildId = uni.getStorageSync('currentChildId')
  855. var found = false
  856. for (var i = 0; i < self.children.length; i++) {
  857. if (self.children[i].memberId === savedChildId) {
  858. self.currentChildId = savedChildId
  859. found = true
  860. break
  861. }
  862. }
  863. // FIX: 不再自动选择第一个孩子。仅在用户通过 UserQuickEntry 切换时设置 currentChildId
  864. if (found) {
  865. self.loadDimensionData()
  866. self.loadEmiData()
  867. }
  868. }
  869. }).catch(function(e) {
  870. console.log('获取成员列表失败', e)
  871. })
  872. },
  873. loadDimensionData: function() {
  874. if (this.familyMembersVisible.length > 0) {
  875. this.loadCompatibilityData()
  876. }
  877. },
  878. loadSandboxData: function() {
  879. var self = this
  880. getFamilyEnergySandbox().then(function(res) {
  881. if (res && res.data) {
  882. self.sandboxData = res.data
  883. }
  884. }).catch(function() {})
  885. },
  886. loadMindRadarPopulationData: function() {
  887. var self = this
  888. if (!this.currentChildId && !this.selectedMemberId) return
  889. var memberId = this.selectedMemberId || this.currentChildId
  890. if (!memberId) return
  891. getRadarData({
  892. memberId: memberId,
  893. dimensions: ['bigFiveOpenness','bigFiveConscientiousness','bigFiveExtraversion','bigFiveAgreeableness','bigFiveNeuroticism','emotionStability','driveAutonomy','driveCompetence','driveRelatedness','selfConceptOverall']
  894. }).then(function(res) {
  895. if (res && res.data && res.data.populationScores) {
  896. var dims = res.data.dimensions || []
  897. var scores = res.data.populationScores
  898. var map = {}
  899. for (var i = 0; i < dims.length && i < scores.length; i++) {
  900. map[dims[i]] = scores[i]
  901. }
  902. self.mindPopulationScores = map
  903. }
  904. }).catch(function(e) { console.warn('[mind] radar-data failed', e) })
  905. },
  906. switchView: function(view) {
  907. this.currentView = view
  908. if (view === 'family') {
  909. this.selectedMemberId = null
  910. var self = this
  911. getEnergySandbox('family').then(function(res) {
  912. if (res && res.data && !res.data.locked) {
  913. self.sandboxData = res.data.familyData || res.data
  914. }
  915. }).catch(function(e) { console.log('获取家庭数据失败', e) })
  916. } else {
  917. this.loadSandboxData()
  918. }
  919. },
  920. },
  921. loadEnergyData: function() {
  922. var self = this
  923. if (!this.currentChildId) return
  924. getEnergyOverview(this.currentChildId).then(function(res) {
  925. if (res && res.data) {
  926. var dims = res.data.dimensions
  927. if (dims && dims.length > 0) {
  928. for (var i = 0; i < dims.length; i++) {
  929. if (dims[i] && dims[i].code === 'mind' && res.data.energyScores) {
  930. self.familyScore = res.data.energyScores.mindScore || 0
  931. }
  932. }
  933. }
  934. }
  935. }).catch(function(e) {
  936. console.log('获取能量概览失败', e)
  937. })
  938. },
  939. onFamilyMemberSelect: function(member) {
  940. this.selectedMemberId = member.id
  941. },
  942. onChildChanged: function(child) {
  943. this.currentChildId = child.memberId
  944. // FIX: 同步提交到 Vuex store
  945. this.$store.commit('switchToChild', child.memberId)
  946. this.loadDimensionData()
  947. this.loadEmiData()
  948. this.loadTraditionalCultureData()
  949. },
  950. loadMindIndicators: function(memberId) {
  951. var self = this
  952. getLatestIndicators({ memberId: memberId, domain: 'mind' }).then(function(res) {
  953. if (res.code === 200) self.mindIndicators = res.data || []
  954. }).catch(function(e) { console.log('[mind] loadMindIndicators failed', e) })
  955. },
  956. goMindDetail: function() {
  957. var id = this.activeChildId || uni.getStorageSync('currentChildId')
  958. if (!id) return
  959. uni.navigateTo({ url: '/pages/mind-detail/member-mind-detail?memberId=' + id })
  960. },
  961. formatNumeric: function(v) {
  962. if (v === null || v === undefined) return ''
  963. var n = parseFloat(v)
  964. if (isNaN(n)) return String(v)
  965. return n % 1 === 0 ? String(n) : n.toFixed(1)
  966. },
  967. loadFamilyMembersVisible: function() {
  968. var self = this
  969. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  970. self.familyMembersVisible = res.data || []
  971. }).catch(function(e) {
  972. console.log('获取可见家庭成员失败', e)
  973. self.familyMembersVisible = []
  974. })
  975. },
  976. loadCompatibilityData: function() {
  977. var self = this
  978. var token = uni.getStorageSync('token')
  979. uni.request({
  980. url: config.API_BASE_URL + '/api/mind/traditional/family-dashboard',
  981. method: 'POST',
  982. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  983. data: {},
  984. success: function(res) {
  985. if (res.data && res.data.code === 200 && res.data.data) {
  986. self.compatibilityData = res.data.data
  987. }
  988. },
  989. fail: function() {}
  990. })
  991. },
  992. scrollToSection: function(section) {
  993. uni.pageScrollTo({ selector: '#' + section, duration: 300 })
  994. },
  995. goAssessment: function() { uni.navigateTo({ url: '/pages/assessment/apply' }) },
  996. goLogin: function() { uni.navigateTo({ url: '/pages/login/login' }) },
  997. // ===== 传统文化数据 =====
  998. // ===== 联系人 / 关系健康 =====
  999. loadContacts: function() {
  1000. var self = this
  1001. getContactList({}).then(function(res) {
  1002. if (res.code === 200) {
  1003. self.contactList = Array.isArray(res.data) ? res.data : []
  1004. } else {
  1005. self.contactList = []
  1006. }
  1007. }).catch(function() {
  1008. self.contactList = []
  1009. })
  1010. },
  1011. loadHealthAlerts: function() {
  1012. var self = this
  1013. getHealthAlerts().then(function(res) {
  1014. if (res.code === 200) {
  1015. self.healthAlerts = Array.isArray(res.data) ? res.data : []
  1016. } else {
  1017. self.healthAlerts = []
  1018. }
  1019. }).catch(function() {
  1020. self.healthAlerts = []
  1021. })
  1022. },
  1023. loadMilestones: function() {
  1024. var self = this
  1025. getMilestones(30).then(function(res) {
  1026. if (res.code === 200) {
  1027. self.milestones = Array.isArray(res.data) ? res.data : []
  1028. } else {
  1029. self.milestones = []
  1030. }
  1031. }).catch(function() {
  1032. self.milestones = []
  1033. })
  1034. },
  1035. loadTraditionalCultureData: function() {
  1036. var self = this
  1037. var memberId = this.currentChildId
  1038. if (!memberId) {
  1039. self.traditionalLoading = false
  1040. return
  1041. }
  1042. self.traditionalLoading = true
  1043. uni.request({
  1044. url: config.API_BASE_URL + '/api/mind/traditional/mirror',
  1045. method: 'POST',
  1046. data: { memberId: memberId, memberType: 'child' },
  1047. success: function(res) {
  1048. self.traditionalLoading = false
  1049. if (res.data && res.data.code === 200 && res.data.data) {
  1050. var d = res.data.data
  1051. if (d.eightCharacters || d.wuxingElements || d.zodiac || d.numSoul) {
  1052. self.traditionalData = d
  1053. } else {
  1054. self.traditionalData = null
  1055. }
  1056. } else {
  1057. self.traditionalData = null
  1058. }
  1059. },
  1060. fail: function() {
  1061. self.traditionalLoading = false
  1062. self.traditionalData = null
  1063. }
  1064. })
  1065. },
  1066. _watchPageReady() {
  1067. var self = this
  1068. var unwatch = this.$watch(function() {
  1069. if (self.isLoggedIn) {
  1070. return !!(self.emiData || self.energyOverview)
  1071. } }, function(val) {
  1072. if (val) {
  1073. if (unwatch) unwatch()
  1074. if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
  1075. }
  1076. })
  1077. },
  1078. // ===== DAN 报告 =====
  1079. loadDanReports: function() {
  1080. var self = this
  1081. var memberId = self.currentChildId
  1082. if (!memberId) return
  1083. getDanReportByChild(memberId, 'mind').then(function(res) {
  1084. if (res.code === 200 && res.data) {
  1085. self.danReports = res.data
  1086. }
  1087. }).catch(function() {})
  1088. },
  1089. goDanUpload: function(dimension) {
  1090. var memberId = this.selectedMemberId || this.currentChildId
  1091. var url = '/pages/health/report-upload?type=a2'
  1092. if (memberId) {
  1093. url += '&memberId=' + memberId
  1094. }
  1095. uni.navigateTo({ url: url })
  1096. },
  1097. viewDanReport: function(report) {
  1098. var reportId = report.sourceReportId || report.id
  1099. uni.navigateTo({ url: '/pages/health/report-detail?reportType=dan&reportId=' + reportId })
  1100. },
  1101. formatDate: function(dateStr) {
  1102. if (!dateStr) return ''
  1103. var d = parseDate(dateStr)
  1104. if (!d) return ''
  1105. return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  1106. }
  1107. }
  1108. </script>
  1109. <style scoped>
  1110. .container {
  1111. min-height: 100vh;
  1112. background: #f5f7fa;
  1113. padding-bottom: 120rpx;
  1114. }
  1115. /* ===== 心·心理 标题栏 ===== */
  1116. .section-title-bar {
  1117. display: flex;
  1118. flex-direction: row;
  1119. align-items: center;
  1120. margin: 20rpx 30rpx 10rpx;
  1121. padding: 16rpx 24rpx;
  1122. background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  1123. border-radius: 20rpx;
  1124. box-shadow: 0 4rpx 16rpx rgba(139,92,246,0.25);
  1125. }
  1126. .section-title-icon {
  1127. font-size: 32rpx;
  1128. color: #fff;
  1129. margin-right: 12rpx;
  1130. }
  1131. .section-title-text {
  1132. font-size: 32rpx;
  1133. font-weight: bold;
  1134. color: #fff;
  1135. }
  1136. /* ===== 心理报告上传卡片 ===== */
  1137. .mind-report-section {
  1138. margin: 20rpx 30rpx;
  1139. }
  1140. .mind-report-card {
  1141. display: flex;
  1142. flex-direction: row;
  1143. align-items: center;
  1144. background: linear-gradient(135deg, #F3E8FF, #FCE4EC);
  1145. border-radius: 20rpx;
  1146. padding: 28rpx 24rpx;
  1147. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1148. }
  1149. .mind-report-left {
  1150. width: 100rpx;
  1151. height: 100rpx;
  1152. background: rgba(255,255,255,0.7);
  1153. border-radius: 20rpx;
  1154. display: flex;
  1155. align-items: center;
  1156. justify-content: center;
  1157. margin-right: 20rpx;
  1158. flex-shrink: 0;
  1159. }
  1160. .mind-report-icon {
  1161. font-size: 52rpx;
  1162. }
  1163. .mind-report-right {
  1164. flex: 1;
  1165. }
  1166. .mind-report-title {
  1167. font-size: 30rpx;
  1168. font-weight: bold;
  1169. color: #7C3AED;
  1170. display: block;
  1171. margin-bottom: 6rpx;
  1172. }
  1173. .mind-report-desc {
  1174. font-size: 22rpx;
  1175. color: #A855F7;
  1176. line-height: 1.5;
  1177. display: block;
  1178. margin-bottom: 10rpx;
  1179. }
  1180. .mind-report-tags {
  1181. display: flex;
  1182. flex-direction: row;
  1183. gap: 10rpx;
  1184. }
  1185. .mind-tag {
  1186. font-size: 20rpx;
  1187. color: #7C3AED;
  1188. background: rgba(255,255,255,0.6);
  1189. padding: 4rpx 14rpx;
  1190. border-radius: 20rpx;
  1191. }
  1192. .mind-report-arrow {
  1193. font-size: 36rpx;
  1194. color: #C084FC;
  1195. margin-left: 10rpx;
  1196. flex-shrink: 0;
  1197. }
  1198. .mind-report-card:active {
  1199. opacity: 0.7;
  1200. }
  1201. .mind-report-list {
  1202. margin-top: 12rpx;
  1203. }
  1204. .mind-report-item {
  1205. display: flex;
  1206. flex-direction: row;
  1207. align-items: center;
  1208. background: #fff;
  1209. border-radius: 14rpx;
  1210. padding: 20rpx 20rpx;
  1211. margin-bottom: 8rpx;
  1212. box-shadow: 0 1rpx 6rpx rgba(0,0,0,0.05);
  1213. }
  1214. .mind-report-item:active {
  1215. opacity: 0.7;
  1216. }
  1217. .mind-report-item-icon {
  1218. font-size: 28rpx;
  1219. margin-right: 14rpx;
  1220. }
  1221. .mind-report-item-name {
  1222. font-size: 26rpx;
  1223. color: #333;
  1224. flex: 1;
  1225. }
  1226. .mind-report-item-date {
  1227. font-size: 22rpx;
  1228. color: #999;
  1229. margin-right: 14rpx;
  1230. }
  1231. .mind-report-item-status {
  1232. font-size: 22rpx;
  1233. padding: 2rpx 12rpx;
  1234. border-radius: 20rpx;
  1235. }
  1236. .mind-report-item-status.parsed {
  1237. color: #7C3AED;
  1238. background: #F3E8FF;
  1239. }
  1240. .mind-report-item-status.pending {
  1241. color: #999;
  1242. background: #F5F5F5;
  1243. }
  1244. .mind-report-empty {
  1245. display: flex;
  1246. flex-direction: row;
  1247. align-items: center;
  1248. justify-content: center;
  1249. padding: 24rpx;
  1250. margin-top: 8rpx;
  1251. }
  1252. .mind-report-empty-icon {
  1253. font-size: 32rpx;
  1254. margin-right: 10rpx;
  1255. }
  1256. .mind-report-empty-text {
  1257. font-size: 24rpx;
  1258. color: #bbb;
  1259. }
  1260. /* ===== 心理能量概况 ===== */
  1261. .energy-overview {
  1262. display: flex;
  1263. flex-direction: row;
  1264. margin: 20rpx 30rpx;
  1265. background: #fff;
  1266. border-radius: 20rpx;
  1267. padding: 24rpx 16rpx;
  1268. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1269. justify-content: space-around;
  1270. }
  1271. .energy-badge {
  1272. display: flex;
  1273. flex-direction: column;
  1274. align-items: center;
  1275. flex: 1;
  1276. }
  1277. .badge-icon {
  1278. font-size: 36rpx;
  1279. margin-bottom: 8rpx;
  1280. }
  1281. .badge-value {
  1282. font-size: 36rpx;
  1283. font-weight: bold;
  1284. color: #333;
  1285. }
  1286. .badge-label {
  1287. font-size: 20rpx;
  1288. color: #999;
  1289. margin-top: 4rpx;
  1290. }
  1291. /* ===== EMI 四维条形图 ===== */
  1292. .emi-section {
  1293. margin: 20rpx 30rpx;
  1294. }
  1295. .emi-card {
  1296. background: #fff;
  1297. border-radius: 24rpx;
  1298. padding: 30rpx;
  1299. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1300. }
  1301. .emi-card-title {
  1302. font-size: 30rpx;
  1303. font-weight: bold;
  1304. color: #333;
  1305. display: block;
  1306. }
  1307. .personality-header {
  1308. display: flex;
  1309. flex-direction: row;
  1310. align-items: center;
  1311. justify-content: space-between;
  1312. margin-bottom: 24rpx;
  1313. }
  1314. .test-btn {
  1315. background: #8B5CF6;
  1316. padding: 8rpx 28rpx;
  1317. border-radius: 30rpx;
  1318. }
  1319. .test-btn-text {
  1320. font-size: 24rpx;
  1321. color: #fff;
  1322. font-weight: 500;
  1323. }
  1324. .emi-bar-item {
  1325. display: flex;
  1326. flex-direction: row;
  1327. align-items: center;
  1328. margin-bottom: 20rpx;
  1329. }
  1330. .emi-bar-label {
  1331. font-size: 24rpx;
  1332. color: #666;
  1333. width: 120rpx;
  1334. flex-shrink: 0;
  1335. }
  1336. .emi-bar-track {
  1337. flex: 1;
  1338. height: 20rpx;
  1339. background: #f0f0f0;
  1340. border-radius: 10rpx;
  1341. overflow: hidden;
  1342. margin: 0 16rpx;
  1343. }
  1344. .emi-bar-fill {
  1345. height: 100%;
  1346. border-radius: 10rpx;
  1347. transition: width 0.5s;
  1348. }
  1349. .emi-bar-score {
  1350. font-size: 26rpx;
  1351. font-weight: bold;
  1352. color: #333;
  1353. width: 60rpx;
  1354. text-align: right;
  1355. flex-shrink: 0;
  1356. }
  1357. .emi-bar-level {
  1358. font-size: 20rpx;
  1359. width: 80rpx;
  1360. text-align: right;
  1361. flex-shrink: 0;
  1362. }
  1363. .level-excellent { color: #10B981; }
  1364. .level-good { color: #3B82F6; }
  1365. .level-average { color: #F97316; }
  1366. .level-low { color: #EF4444; }
  1367. .emi-footer {
  1368. display: flex;
  1369. flex-direction: row;
  1370. justify-content: space-between;
  1371. align-items: center;
  1372. margin-top: 20rpx;
  1373. padding-top: 20rpx;
  1374. border-top: 1rpx solid #f0f0f0;
  1375. }
  1376. .emi-overall {
  1377. font-size: 28rpx;
  1378. font-weight: bold;
  1379. color: #FF6B35;
  1380. }
  1381. .emi-link {
  1382. display: flex;
  1383. flex-direction: row;
  1384. align-items: center;
  1385. }
  1386. .emi-link-text {
  1387. font-size: 26rpx;
  1388. color: #FF6B35;
  1389. font-weight: 500;
  1390. }
  1391. .emi-link-arrow {
  1392. font-size: 26rpx;
  1393. color: #FF6B35;
  1394. margin-left: 8rpx;
  1395. }
  1396. /* ===== EMI 心理报告卡片 ===== */
  1397. .emi-card {
  1398. margin: 30rpx;
  1399. background: #fff;
  1400. border-radius: 24rpx;
  1401. padding: 30rpx;
  1402. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1403. }
  1404. .emi-header {
  1405. margin-bottom: 24rpx;
  1406. }
  1407. .emi-title {
  1408. font-size: 30rpx;
  1409. font-weight: bold;
  1410. color: #333;
  1411. display: block;
  1412. }
  1413. .emi-overall-wrap {
  1414. display: flex;
  1415. flex-direction: column;
  1416. align-items: center;
  1417. padding: 32rpx 0;
  1418. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1419. border-radius: 16rpx;
  1420. margin: 20rpx 0;
  1421. color: #fff;
  1422. }
  1423. .emi-overall-label {
  1424. font-size: 26rpx;
  1425. margin-bottom: 6rpx;
  1426. }
  1427. .emi-overall-value {
  1428. font-size: 64rpx;
  1429. font-weight: bold;
  1430. margin-bottom: 6rpx;
  1431. }
  1432. .emi-overall-level {
  1433. font-size: 24rpx;
  1434. padding: 4rpx 16rpx;
  1435. border-radius: 12rpx;
  1436. background: rgba(255,255,255,0.2);
  1437. }
  1438. .emi-dimensions {
  1439. display: flex;
  1440. flex-direction: column;
  1441. gap: 20rpx;
  1442. }
  1443. .emi-dimension {
  1444. display: flex;
  1445. flex-direction: column;
  1446. }
  1447. .emi-dim-header {
  1448. display: flex;
  1449. flex-direction: row;
  1450. justify-content: space-between;
  1451. align-items: center;
  1452. margin-bottom: 8rpx;
  1453. }
  1454. .emi-dim-label {
  1455. font-size: 26rpx;
  1456. color: #666;
  1457. }
  1458. .emi-dim-values {
  1459. display: flex;
  1460. flex-direction: row;
  1461. align-items: center;
  1462. }
  1463. .emi-dim-score {
  1464. font-size: 28rpx;
  1465. font-weight: bold;
  1466. color: #FF6B35;
  1467. margin-right: 12rpx;
  1468. }
  1469. .emi-dim-level {
  1470. font-size: 20rpx;
  1471. padding: 2rpx 12rpx;
  1472. border-radius: 8rpx;
  1473. }
  1474. .emi-dim-bar {
  1475. height: 14rpx;
  1476. background: #f0f0f0;
  1477. border-radius: 7rpx;
  1478. overflow: hidden;
  1479. }
  1480. .emi-dim-bar-fill {
  1481. height: 100%;
  1482. border-radius: 7rpx;
  1483. transition: width 0.5s;
  1484. }
  1485. .emi-footer {
  1486. display: flex;
  1487. justify-content: flex-end;
  1488. align-items: center;
  1489. padding-top: 20rpx;
  1490. border-top: 1rpx solid #f0f0f0;
  1491. margin-top: 20rpx;
  1492. }
  1493. .emi-footer-text {
  1494. font-size: 24rpx;
  1495. color: #F97316;
  1496. font-weight: 500;
  1497. }
  1498. .emi-footer-icon {
  1499. font-size: 24rpx;
  1500. margin-left: 8rpx;
  1501. }
  1502. .level-excellent { color: #10B981; background: #ECFDF5; }
  1503. .level-good { color: #3B82F6; background: #EFF6FF; }
  1504. .level-average { color: #F97316; background: #FFF7ED; }
  1505. .level-low { color: #EF4444; background: #FEF2F2; }
  1506. /* 雷达图内的空状态 */
  1507. .placeholder-content {
  1508. display: flex;
  1509. flex-direction: column;
  1510. align-items: center;
  1511. padding: 40rpx 20rpx;
  1512. }
  1513. /* ===== 占位卡 ===== */
  1514. .placeholder-card {
  1515. margin: 30rpx;
  1516. background: #fff;
  1517. border-radius: 24rpx;
  1518. padding: 60rpx 40rpx;
  1519. display: flex;
  1520. flex-direction: column;
  1521. align-items: center;
  1522. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1523. }
  1524. .placeholder-icon {
  1525. font-size: 80rpx;
  1526. margin-bottom: 20rpx;
  1527. }
  1528. .placeholder-title {
  1529. font-size: 32rpx;
  1530. font-weight: bold;
  1531. color: #333;
  1532. margin-bottom: 16rpx;
  1533. }
  1534. .placeholder-desc {
  1535. font-size: 26rpx;
  1536. color: #999;
  1537. text-align: center;
  1538. line-height: 1.6;
  1539. margin-bottom: 30rpx;
  1540. }
  1541. .placeholder-btn {
  1542. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1543. color: #fff;
  1544. font-size: 28rpx;
  1545. font-weight: bold;
  1546. padding: 16rpx 64rpx;
  1547. border-radius: 40rpx;
  1548. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  1549. }
  1550. /* ===== 传统文化卡片 ===== */
  1551. .culture-section {
  1552. margin: 20rpx 30rpx;
  1553. }
  1554. .culture-card {
  1555. background: #fff;
  1556. border-radius: 20rpx;
  1557. padding: 24rpx;
  1558. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1559. margin-bottom: 16rpx;
  1560. }
  1561. .culture-card-header {
  1562. display: flex;
  1563. align-items: center;
  1564. margin-bottom: 16rpx;
  1565. }
  1566. .culture-card-icon {
  1567. font-size: 32rpx;
  1568. margin-right: 10rpx;
  1569. }
  1570. .culture-card-title {
  1571. font-size: 28rpx;
  1572. font-weight: 600;
  1573. color: #333;
  1574. }
  1575. .culture-card-body {
  1576. font-size: 24rpx;
  1577. color: #666;
  1578. line-height: 1.6;
  1579. }
  1580. /* 八字四柱 */
  1581. .bazi-grid {
  1582. display: flex;
  1583. justify-content: space-around;
  1584. padding: 8rpx 0;
  1585. }
  1586. .bazi-column {
  1587. display: flex;
  1588. flex-direction: column;
  1589. align-items: center;
  1590. }
  1591. .bazi-pillar-label {
  1592. font-size: 22rpx;
  1593. color: #999;
  1594. margin-bottom: 6rpx;
  1595. }
  1596. .bazi-pillar-value {
  1597. font-size: 32rpx;
  1598. font-weight: 700;
  1599. color: #8B5CF6;
  1600. background: #F5F0FF;
  1601. padding: 10rpx 14rpx;
  1602. border-radius: 10rpx;
  1603. }
  1604. /* 五行能量 */
  1605. .wuxing-list {
  1606. display: flex;
  1607. flex-direction: column;
  1608. gap: 12rpx;
  1609. }
  1610. .wuxing-item {
  1611. display: flex;
  1612. align-items: center;
  1613. gap: 12rpx;
  1614. }
  1615. .wuxing-label {
  1616. font-size: 26rpx;
  1617. font-weight: 600;
  1618. width: 44rpx;
  1619. text-align: center;
  1620. }
  1621. .wuxing-bar-track {
  1622. flex: 1;
  1623. height: 20rpx;
  1624. background: #F0F0F0;
  1625. border-radius: 10rpx;
  1626. overflow: hidden;
  1627. }
  1628. .wuxing-bar-fill {
  1629. height: 100%;
  1630. border-radius: 10rpx;
  1631. }
  1632. .wuxing-value {
  1633. font-size: 22rpx;
  1634. color: #666;
  1635. width: 56rpx;
  1636. text-align: right;
  1637. }
  1638. .energy-card {
  1639. margin-top: 20rpx;
  1640. padding: 24rpx 20rpx;
  1641. background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  1642. border-radius: 20rpx;
  1643. position: relative;
  1644. overflow: hidden;
  1645. }
  1646. .energy-card::before {
  1647. content: '';
  1648. position: absolute;
  1649. top: -60rpx;
  1650. right: -60rpx;
  1651. width: 200rpx;
  1652. height: 200rpx;
  1653. background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, transparent 70%);
  1654. border-radius: 50%;
  1655. }
  1656. .energy-card::after {
  1657. content: '';
  1658. position: absolute;
  1659. bottom: -40rpx;
  1660. left: -40rpx;
  1661. width: 160rpx;
  1662. height: 160rpx;
  1663. background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  1664. border-radius: 50%;
  1665. }
  1666. .energy-header {
  1667. display: flex;
  1668. align-items: center;
  1669. margin-bottom: 14rpx;
  1670. position: relative;
  1671. z-index: 1;
  1672. }
  1673. .energy-icon {
  1674. font-size: 32rpx;
  1675. margin-right: 10rpx;
  1676. }
  1677. .energy-label {
  1678. font-size: 28rpx;
  1679. font-weight: 700;
  1680. background: linear-gradient(135deg, #F59E0B, #FF6B9D);
  1681. -webkit-background-clip: text;
  1682. -webkit-text-fill-color: transparent;
  1683. background-clip: text;
  1684. }
  1685. .energy-divider {
  1686. height: 2rpx;
  1687. background: linear-gradient(90deg, rgba(255,215,0,0.5), rgba(255,107,157,0.3), transparent);
  1688. margin-bottom: 18rpx;
  1689. position: relative;
  1690. z-index: 1;
  1691. }
  1692. .energy-quote {
  1693. font-size: 26rpx;
  1694. color: #E2E8F0;
  1695. line-height: 1.8;
  1696. display: block;
  1697. margin-bottom: 14rpx;
  1698. position: relative;
  1699. z-index: 1;
  1700. padding-left: 20rpx;
  1701. letter-spacing: 1rpx;
  1702. }
  1703. .energy-quote::before {
  1704. content: '';
  1705. position: absolute;
  1706. left: 0;
  1707. top: 4rpx;
  1708. bottom: 4rpx;
  1709. width: 4rpx;
  1710. background: linear-gradient(180deg, #F59E0B, #FF6B9D);
  1711. border-radius: 2rpx;
  1712. }
  1713. .energy-advice {
  1714. font-size: 24rpx;
  1715. color: #94A3B8;
  1716. line-height: 1.7;
  1717. display: block;
  1718. position: relative;
  1719. z-index: 1;
  1720. padding: 14rpx 18rpx;
  1721. background: rgba(255,255,255,0.05);
  1722. border-radius: 12rpx;
  1723. border: 1rpx solid rgba(255,255,255,0.08);
  1724. }
  1725. .energy-footer {
  1726. display: flex;
  1727. justify-content: center;
  1728. gap: 12rpx;
  1729. margin-top: 18rpx;
  1730. position: relative;
  1731. z-index: 1;
  1732. }
  1733. .energy-footer-dot {
  1734. width: 8rpx;
  1735. height: 8rpx;
  1736. border-radius: 50%;
  1737. background: rgba(255,255,255,0.3);
  1738. }
  1739. .energy-footer-dot:nth-child(2) {
  1740. background: rgba(255,215,0,0.6);
  1741. width: 10rpx;
  1742. height: 10rpx;
  1743. }
  1744. /* 星座+灵数双栏 */
  1745. .culture-dual {
  1746. display: flex;
  1747. gap: 16rpx;
  1748. }
  1749. .culture-dual-item {
  1750. flex: 1;
  1751. background: #fff;
  1752. border-radius: 20rpx;
  1753. padding: 20rpx;
  1754. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1755. display: flex;
  1756. flex-direction: column;
  1757. align-items: center;
  1758. }
  1759. .culture-dual-icon {
  1760. font-size: 36rpx;
  1761. margin-bottom: 8rpx;
  1762. }
  1763. .culture-dual-label {
  1764. font-size: 22rpx;
  1765. color: #999;
  1766. margin-bottom: 6rpx;
  1767. }
  1768. .culture-dual-value {
  1769. font-size: 28rpx;
  1770. font-weight: 700;
  1771. color: #8B5CF6;
  1772. }
  1773. .culture-empty {
  1774. text-align: center;
  1775. padding: 30rpx 0;
  1776. color: #bbb;
  1777. font-size: 24rpx;
  1778. }
  1779. /* ===== 每日心理 ===== */
  1780. .tip-card {
  1781. background: #fff;
  1782. border-radius: 20rpx;
  1783. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1784. display: flex;
  1785. flex-direction: row;
  1786. overflow: hidden;
  1787. }
  1788. .tip-left-bar {
  1789. width: 6rpx;
  1790. background: linear-gradient(180deg, #5B9BD5, #8FC5E8);
  1791. flex-shrink: 0;
  1792. }
  1793. .tip-body {
  1794. flex: 1;
  1795. padding: 28rpx 24rpx;
  1796. }
  1797. .tip-title {
  1798. font-size: 28rpx;
  1799. font-weight: bold;
  1800. color: #5B9BD5;
  1801. display: block;
  1802. margin-bottom: 12rpx;
  1803. }
  1804. .tip-content {
  1805. font-size: 24rpx;
  1806. color: #666;
  1807. line-height: 1.6;
  1808. display: block;
  1809. margin-bottom: 16rpx;
  1810. }
  1811. .tip-footer {
  1812. display: flex;
  1813. flex-direction: row;
  1814. justify-content: flex-end;
  1815. }
  1816. .tip-source {
  1817. font-size: 22rpx;
  1818. color: #bbb;
  1819. }
  1820. /* ===== 通用区块 ===== */
  1821. .section {
  1822. margin: 20rpx 30rpx;
  1823. }
  1824. .section-header {
  1825. margin-bottom: 20rpx;
  1826. }
  1827. .section-title {
  1828. font-size: 30rpx;
  1829. font-weight: bold;
  1830. color: #333;
  1831. }
  1832. /* ===== 推荐阅读 ===== */
  1833. .article-list {
  1834. display: flex;
  1835. flex-direction: column;
  1836. }
  1837. .article-card {
  1838. background: #fff;
  1839. border-radius: 20rpx;
  1840. padding: 28rpx 24rpx;
  1841. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1842. margin-bottom: 20rpx;
  1843. }
  1844. .article-category {
  1845. display: inline-block;
  1846. padding: 4rpx 18rpx;
  1847. border-radius: 20rpx;
  1848. margin-bottom: 14rpx;
  1849. }
  1850. .article-category-text {
  1851. font-size: 20rpx;
  1852. color: #fff;
  1853. font-weight: 500;
  1854. }
  1855. .article-title {
  1856. font-size: 28rpx;
  1857. font-weight: bold;
  1858. color: #333;
  1859. display: block;
  1860. margin-bottom: 10rpx;
  1861. }
  1862. .article-summary {
  1863. font-size: 24rpx;
  1864. color: #888;
  1865. line-height: 1.5;
  1866. display: block;
  1867. margin-bottom: 20rpx;
  1868. }
  1869. .article-meta {
  1870. display: flex;
  1871. flex-direction: row;
  1872. align-items: center;
  1873. justify-content: space-between;
  1874. }
  1875. .meta-item {
  1876. display: flex;
  1877. flex-direction: row;
  1878. align-items: center;
  1879. margin-right: 20rpx;
  1880. }
  1881. .meta-icon {
  1882. font-size: 22rpx;
  1883. margin-right: 4rpx;
  1884. }
  1885. .meta-text {
  1886. font-size: 22rpx;
  1887. color: #bbb;
  1888. }
  1889. .article-date {
  1890. font-size: 22rpx;
  1891. color: #bbb;
  1892. margin-left: auto;
  1893. }
  1894. /* ===== 功能区入口 ===== */
  1895. .func-section {
  1896. margin: 20rpx 30rpx;
  1897. }
  1898. .func-grid {
  1899. display: flex;
  1900. flex-direction: column;
  1901. gap: 16rpx;
  1902. background: #fff;
  1903. border-radius: 20rpx;
  1904. padding: 24rpx 16rpx;
  1905. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1906. }
  1907. .func-row {
  1908. display: flex;
  1909. flex-direction: row;
  1910. justify-content: space-between;
  1911. }
  1912. .func-item {
  1913. display: flex;
  1914. flex-direction: column;
  1915. align-items: center;
  1916. flex: 1;
  1917. }
  1918. .func-icon-wrap {
  1919. width: 80rpx;
  1920. height: 80rpx;
  1921. border-radius: 40rpx;
  1922. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  1923. display: flex;
  1924. align-items: center;
  1925. justify-content: center;
  1926. margin-bottom: 10rpx;
  1927. }
  1928. .func-icon {
  1929. font-size: 40rpx;
  1930. }
  1931. .func-label {
  1932. font-size: 22rpx;
  1933. color: #666;
  1934. font-weight: 500;
  1935. }
  1936. .func-item:active {
  1937. opacity: 0.7;
  1938. }
  1939. /* ===== 底部 ===== */
  1940. .indicator-cards-section { margin: 20rpx 30rpx; }
  1941. .indicator-cards { display: flex; flex-direction: row; flex-wrap: wrap; gap: 16rpx; }
  1942. .indicator-card { width: calc(50% - 8rpx); background: #fff; border-radius: 20rpx; padding: 24rpx 20rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  1943. .indicator-card.no-data { opacity: 0.5; }
  1944. .indicator-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12rpx; }
  1945. .indicator-name { font-size: 26rpx; color: #666; font-weight: 500; }
  1946. .indicator-unit { font-size: 22rpx; color: #999; }
  1947. .indicator-body { margin-bottom: 8rpx; }
  1948. .indicator-value { font-size: 40rpx; font-weight: bold; color: #FF6B9D; }
  1949. .indicator-placeholder { font-size: 26rpx; color: #ccc; }
  1950. .indicator-range { font-size: 20rpx; color: #bbb; }
  1951. .bottom-spacer { height: 120rpx; }
  1952. /* ===== 肠脑轴 ===== */
  1953. .gut-insight-text {
  1954. font-size: 24rpx;
  1955. color: #666;
  1956. margin-bottom: 16rpx;
  1957. padding: 12rpx 16rpx;
  1958. background: #F0FFF4;
  1959. border-radius: 12rpx;
  1960. line-height: 1.6;
  1961. }
  1962. .gut-indicator-list {
  1963. display: flex;
  1964. flex-direction: column;
  1965. gap: 12rpx;
  1966. }
  1967. .gut-indicator-item {
  1968. display: flex;
  1969. align-items: center;
  1970. gap: 12rpx;
  1971. }
  1972. .gut-indicator-left {
  1973. width: 110rpx;
  1974. flex-shrink: 0;
  1975. }
  1976. .gut-indicator-name {
  1977. font-size: 22rpx;
  1978. color: #666;
  1979. font-weight: 500;
  1980. display: block;
  1981. }
  1982. .gut-indicator-impact {
  1983. font-size: 18rpx;
  1984. color: #FF6B9D;
  1985. display: block;
  1986. margin-top: 2rpx;
  1987. }
  1988. .gut-indicator-bar-track {
  1989. flex: 1;
  1990. height: 16rpx;
  1991. background: #F0F0F0;
  1992. border-radius: 8rpx;
  1993. overflow: hidden;
  1994. }
  1995. .gut-indicator-bar-fill {
  1996. height: 100%;
  1997. border-radius: 8rpx;
  1998. transition: width 0.3s;
  1999. }
  2000. .gut-indicator-value {
  2001. font-size: 22rpx;
  2002. color: #666;
  2003. width: 60rpx;
  2004. text-align: right;
  2005. }
  2006. .gut-indicator-status {
  2007. font-size: 20rpx;
  2008. padding: 2rpx 12rpx;
  2009. border-radius: 10rpx;
  2010. width: 60rpx;
  2011. text-align: center;
  2012. }
  2013. .status-normal {
  2014. background: #D1FAE5;
  2015. color: #059669;
  2016. }
  2017. .status-abnormal {
  2018. background: #FEE2E2;
  2019. color: #DC2626;
  2020. }
  2021. .status-warning {
  2022. background: #FEF3C7;
  2023. color: #D97706;
  2024. }
  2025. /* ===== 关键信息(家庭+个人) ===== */
  2026. .key-info-card {
  2027. background: #fff;
  2028. border-radius: 20rpx;
  2029. padding: 24rpx;
  2030. margin-top: 20rpx;
  2031. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  2032. }
  2033. .key-info-header {
  2034. display: flex;
  2035. align-items: center;
  2036. margin-bottom: 20rpx;
  2037. }
  2038. .key-info-icon {
  2039. font-size: 28rpx;
  2040. margin-right: 8rpx;
  2041. }
  2042. .key-info-title {
  2043. font-size: 28rpx;
  2044. font-weight: 600;
  2045. color: #333;
  2046. }
  2047. .key-info-body {
  2048. display: flex;
  2049. flex-direction: row;
  2050. gap: 20rpx;
  2051. }
  2052. .key-info-col {
  2053. flex: 1;
  2054. background: #F8F9FA;
  2055. border-radius: 14rpx;
  2056. padding: 16rpx;
  2057. min-width: 0;
  2058. }
  2059. .ki-subtitle {
  2060. font-size: 22rpx;
  2061. color: #999;
  2062. margin-bottom: 12rpx;
  2063. font-weight: 500;
  2064. }
  2065. .ki-row {
  2066. display: flex;
  2067. align-items: center;
  2068. margin-bottom: 10rpx;
  2069. flex-wrap: nowrap;
  2070. }
  2071. .ki-row:last-child {
  2072. margin-bottom: 0;
  2073. }
  2074. .ki-label {
  2075. font-size: 22rpx;
  2076. color: #888;
  2077. margin-right: 8rpx;
  2078. white-space: nowrap;
  2079. }
  2080. .ki-dot {
  2081. width: 16rpx;
  2082. height: 16rpx;
  2083. border-radius: 50%;
  2084. margin-right: 6rpx;
  2085. flex-shrink: 0;
  2086. }
  2087. .ki-valuel {
  2088. font-size: 24rpx;
  2089. color: #333;
  2090. font-weight: 500;
  2091. white-space: nowrap;
  2092. }
  2093. .ki-valued {
  2094. font-size: 24rpx;
  2095. color: #333;
  2096. font-weight: 500;
  2097. }
  2098. .ki-swatch {
  2099. width: 28rpx;
  2100. height: 28rpx;
  2101. border-radius: 50%;
  2102. margin-right: 6rpx;
  2103. border: 2rpx solid rgba(0,0,0,0.06);
  2104. flex-shrink: 0;
  2105. }
  2106. .ki-num {
  2107. font-size: 30rpx;
  2108. font-weight: 700;
  2109. color: #FF6B9D;
  2110. }
  2111. .ki-fortune {
  2112. font-size: 24rpx;
  2113. font-weight: 700;
  2114. padding: 2rpx 12rpx;
  2115. border-radius: 10rpx;
  2116. }
  2117. .ki-fortune-0 {
  2118. color: #D32F2F;
  2119. background: #FFEBEE;
  2120. }
  2121. .ki-fortune-1 {
  2122. color: #E65100;
  2123. background: #FFF3E0;
  2124. }
  2125. .ki-fortune-2 {
  2126. color: #F9A825;
  2127. background: #FFFDE7;
  2128. }
  2129. .ki-fortune-3 {
  2130. color: #7B1FA2;
  2131. background: #F3E5F5;
  2132. }
  2133. .ki-fortune-4 {
  2134. color: #B71C1C;
  2135. background: #FFCDD2;
  2136. }
  2137. .ki-insight {
  2138. display: flex;
  2139. align-items: flex-start;
  2140. margin-top: 16rpx;
  2141. padding: 16rpx;
  2142. background: #FFF8F0;
  2143. border-radius: 12rpx;
  2144. }
  2145. .ki-insight-icon {
  2146. font-size: 24rpx;
  2147. margin-right: 8rpx;
  2148. flex-shrink: 0;
  2149. }
  2150. .ki-insight-text {
  2151. font-size: 22rpx;
  2152. color: #8B6914;
  2153. line-height: 1.5;
  2154. }
  2155. .ki-footer {
  2156. margin-top: 16rpx;
  2157. text-align: center;
  2158. padding: 12rpx;
  2159. font-size: 24rpx;
  2160. color: #8B5CF6;
  2161. font-weight: 500;
  2162. background: #F5F3FF;
  2163. border-radius: 12rpx;
  2164. }
  2165. .ki-footer:active {
  2166. opacity: 0.7;
  2167. }
  2168. /* DAN 报告卡片 */
  2169. .dan-card {
  2170. background: #fff;
  2171. border-radius: 16rpx;
  2172. padding: 24rpx;
  2173. margin-bottom: 16rpx;
  2174. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  2175. }
  2176. .dan-card-header {
  2177. display: flex;
  2178. justify-content: space-between;
  2179. align-items: center;
  2180. margin-bottom: 12rpx;
  2181. }
  2182. .dan-report-date {
  2183. font-size: 26rpx;
  2184. color: #666;
  2185. }
  2186. .dan-status {
  2187. font-size: 22rpx;
  2188. padding: 4rpx 16rpx;
  2189. border-radius: 8rpx;
  2190. }
  2191. .dan-status.confirmed {
  2192. background: #D1FAE5;
  2193. color: #065F46;
  2194. }
  2195. .dan-status.pending {
  2196. background: #FEF3C7;
  2197. color: #92400E;
  2198. }
  2199. .dan-report-desc {
  2200. font-size: 28rpx;
  2201. color: #333;
  2202. font-weight: 500;
  2203. margin-bottom: 12rpx;
  2204. display: block;
  2205. }
  2206. .dan-card-footer {
  2207. text-align: right;
  2208. }
  2209. .dan-view-link {
  2210. font-size: 26rpx;
  2211. color: #6366F1;
  2212. }
  2213. .section-header {
  2214. display: flex;
  2215. justify-content: space-between;
  2216. align-items: center;
  2217. margin-bottom: 20rpx;
  2218. }
  2219. .section-title {
  2220. font-size: 32rpx;
  2221. font-weight: 700;
  2222. color: #333;
  2223. }
  2224. .section-more {
  2225. font-size: 26rpx;
  2226. color: #6366F1;
  2227. padding: 8rpx 16rpx;
  2228. }
  2229. /* 品牌定位语 */
  2230. .brand-strap {
  2231. margin: 16rpx 30rpx 0;
  2232. padding: 20rpx 28rpx;
  2233. background: linear-gradient(135deg, #FFF0F5, rgba(255,107,157,0.12));
  2234. border-radius: 16rpx;
  2235. border-left: 4rpx solid #FF6B9D;
  2236. }
  2237. .brand-strap-text {
  2238. font-size: 26rpx;
  2239. color: #9D174D;
  2240. font-weight: 500;
  2241. }
  2242. /* 每月引导语 */
  2243. .monthly-guidance {
  2244. margin: 16rpx 30rpx 0;
  2245. padding: 20rpx 28rpx;
  2246. background: linear-gradient(135deg, #FFF0F5, rgba(255,107,157,0.08));
  2247. border-radius: 16rpx;
  2248. border-left: 4rpx solid #FF6B9D;
  2249. display: flex;
  2250. align-items: center;
  2251. gap: 12rpx;
  2252. }
  2253. .guidance-icon { font-size: 32rpx; }
  2254. .guidance-text {
  2255. font-size: 26rpx;
  2256. color: #9D174D;
  2257. font-weight: 500;
  2258. }
  2259. /* 雷达图分组 */
  2260. .radar-group { margin-bottom: 30rpx; }
  2261. .radar-group-label {
  2262. font-size: 28rpx;
  2263. font-weight: bold;
  2264. color: #9D174D;
  2265. margin-bottom: 16rpx;
  2266. padding-left: 10rpx;
  2267. }
  2268. /* 维度画像样式 */
  2269. .dimension-portrait-section {
  2270. margin: 24rpx 30rpx;
  2271. background: #fff;
  2272. border-radius: 24rpx;
  2273. padding: 32rpx 24rpx;
  2274. box-shadow: 0 4rpx 20rpx rgba(255, 107, 157, 0.12);
  2275. border: 2rpx solid rgba(255, 107, 157, 0.1);
  2276. }
  2277. .portrait-tier {
  2278. font-size: 26rpx;
  2279. color: #FF6B9D;
  2280. font-weight: bold;
  2281. margin-left: 16rpx;
  2282. }
  2283. .portrait-summary {
  2284. margin-bottom: 24rpx;
  2285. }
  2286. .portrait-desc {
  2287. font-size: 26rpx;
  2288. color: #666;
  2289. line-height: 1.6;
  2290. display: block;
  2291. }
  2292. .portrait-dimensions {
  2293. margin-bottom: 20rpx;
  2294. }
  2295. .portrait-dim-item {
  2296. margin-bottom: 18rpx;
  2297. }
  2298. .portrait-dim-header {
  2299. display: flex;
  2300. align-items: center;
  2301. margin-bottom: 6rpx;
  2302. }
  2303. .portrait-dim-icon {
  2304. width: 36rpx;
  2305. height: 36rpx;
  2306. border-radius: 18rpx;
  2307. display: flex;
  2308. align-items: center;
  2309. justify-content: center;
  2310. margin-right: 10rpx;
  2311. font-size: 20rpx;
  2312. }
  2313. .portrait-dim-name {
  2314. font-size: 24rpx;
  2315. color: #333;
  2316. flex: 1;
  2317. }
  2318. .portrait-dim-score {
  2319. font-size: 26rpx;
  2320. font-weight: bold;
  2321. color: #FF6B9D;
  2322. margin-right: 12rpx;
  2323. }
  2324. .portrait-dim-bar-track {
  2325. height: 10rpx;
  2326. background: #F0F6F7;
  2327. border-radius: 5rpx;
  2328. overflow: hidden;
  2329. margin-bottom: 4rpx;
  2330. flex: 1;
  2331. }
  2332. .portrait-dim-bar-fill {
  2333. height: 100%;
  2334. border-radius: 5rpx;
  2335. transition: width 0.3s ease;
  2336. }
  2337. .portrait-dim-desc {
  2338. font-size: 20rpx;
  2339. color: #999;
  2340. display: block;
  2341. }
  2342. .portrait-tip {
  2343. padding: 16rpx 20rpx;
  2344. background: linear-gradient(135deg, #FFF0F5, #FDF2F7);
  2345. border-radius: 12rpx;
  2346. border-left: 4rpx solid #FF6B9D;
  2347. margin-top: 16rpx;
  2348. }
  2349. .portrait-tip-text {
  2350. font-size: 22rpx;
  2351. color: #C2410C;
  2352. line-height: 1.5;
  2353. }
  2354. </style>