index.vue 65 KB

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