index.vue 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243
  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-extra/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. dimensionWeights: item.dimensionWeights || null,
  872. views: item.viewCount ? String(item.viewCount) : '0',
  873. likes: '0',
  874. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  875. relatedDimensions: self.parseRelatedDimensions(item.relatedDimensions)
  876. }
  877. })
  878. }
  879. }).catch(function() {})
  880. },
  881. // ===== EMI 分数评级 =====
  882. getScoreLevel: function(score) {
  883. if (score >= 85) return 'excellent'
  884. if (score >= 70) return 'good'
  885. if (score >= 55) return 'average'
  886. return 'low'
  887. },
  888. getScoreLevelText: function(score) {
  889. if (score >= 85) return '优秀'
  890. if (score >= 70) return '良好'
  891. if (score >= 55) return '一般'
  892. return '需提升'
  893. },
  894. // ===== 导航 =====
  895. goEmotionReport: function() {
  896. var childId = this.currentChildId || ''
  897. uni.navigateTo({ url: '/pages/mind-detail/emotion-report?childId=' + childId })
  898. },
  899. goArticles: function() {
  900. uni.navigateTo({ url: '/pages/article-center/index?dimension=mind' })
  901. },
  902. onFuncClick: function(item) {
  903. if (item.needLogin && !this.isLoggedIn) {
  904. uni.showModal({
  905. title: '提示',
  906. content: '请先登录后使用此功能',
  907. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  908. })
  909. return
  910. }
  911. if (item.page) uni.navigateTo({ url: item.page })
  912. },
  913. goArticleDetail: function(article) {
  914. var id = article.id || article
  915. uni.navigateTo({ url: '/pages/mind-detail/article-detail?id=' + id })
  916. },
  917. // ===== 孩子列表与维度数据 =====
  918. loadChildren: function() {
  919. var self = this
  920. getChildren().then(function(res) {
  921. if (res.code === 200 && res.data) {
  922. self.children = res.data
  923. var savedChildId = uni.getStorageSync('currentChildId')
  924. var found = false
  925. for (var i = 0; i < self.children.length; i++) {
  926. if (self.children[i].childId === savedChildId) {
  927. self.currentChildId = savedChildId
  928. found = true
  929. break
  930. }
  931. }
  932. // FIX: 不再自动选择第一个孩子。仅在用户通过 UserQuickEntry 切换时设置 currentChildId
  933. if (found) {
  934. self.loadDimensionData()
  935. self.loadEmiData()
  936. }
  937. }
  938. }).catch(function(e) {
  939. console.log('获取孩子列表失败', e)
  940. })
  941. },
  942. loadDimensionData: function() {
  943. this.loadDimensionTasks()
  944. this.loadDimensionActivities()
  945. this.loadDimensionProducts()
  946. if (this.familyMembersVisible.length > 0) {
  947. this.loadCompatibilityData()
  948. }
  949. },
  950. loadSandboxData: function() {
  951. var self = this
  952. getFamilyEnergySandbox().then(function(res) {
  953. if (res && res.data) {
  954. self.sandboxData = res.data
  955. }
  956. }).catch(function() {})
  957. },
  958. loadEnergyData: function() {
  959. var self = this
  960. if (!this.currentChildId) return
  961. getEnergyOverview(this.currentChildId).then(function(res) {
  962. if (res && res.data) {
  963. var dims = res.data.dimensions
  964. if (dims && dims.length > 0) {
  965. for (var i = 0; i < dims.length; i++) {
  966. if (dims[i] && dims[i].code === 'mind' && res.data.energyScores) {
  967. self.familyScore = res.data.energyScores.mindScore || 0
  968. }
  969. }
  970. }
  971. }
  972. }).catch(function(e) {
  973. console.log('获取能量概览失败', e)
  974. })
  975. },
  976. loadDimensionTasks: function() {
  977. var self = this
  978. if (!this.currentChildId) return
  979. getTodayTasksByCategory(this.currentChildId, 'mind').then(function(res) {
  980. if (res && res.data) {
  981. self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
  982. }
  983. }).catch(function() { self.dimensionTasks = [] })
  984. },
  985. loadDimensionActivities: function() {
  986. var self = this
  987. var dimCode = self.currentDimensionCode
  988. getActivityList({ dimensionCode: dimCode, page: 1, size: 3 }).then(function(res) {
  989. if (res && res.data) {
  990. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  991. self.dimensionActivities = list.slice(0, 3)
  992. }
  993. }).catch(function() { self.dimensionActivities = [] })
  994. },
  995. loadDimensionProducts: function() {
  996. var self = this
  997. var dimCode = self.currentDimensionCode
  998. getProductsByDomain(dimCode, 1, 4).then(function(res) {
  999. if (res && res.data) {
  1000. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  1001. self.dimensionProducts = list.slice(0, 4)
  1002. }
  1003. }).catch(function() { self.dimensionProducts = [] })
  1004. },
  1005. onChildChanged: function(child) {
  1006. this.currentChildId = child.childId
  1007. // FIX: 同步提交到 Vuex store
  1008. this.$store.commit('switchToChild', child.childId)
  1009. this.loadDimensionData()
  1010. this.loadEmiData()
  1011. this.loadTraditionalCultureData()
  1012. },
  1013. loadFamilyMembersVisible: function() {
  1014. var self = this
  1015. getVisibleFamilyMembers().then(function(res) {
  1016. self.familyMembersVisible = res.data || []
  1017. }).catch(function(e) {
  1018. console.log('获取可见家庭成员失败', e)
  1019. self.familyMembersVisible = []
  1020. })
  1021. },
  1022. loadCompatibilityData: function() {
  1023. var self = this
  1024. var familyId = uni.getStorageSync('currentFamilyId')
  1025. if (!familyId) {
  1026. var userInfo = uni.getStorageSync('userInfo')
  1027. if (userInfo && userInfo.familyId) familyId = userInfo.familyId
  1028. }
  1029. if (!familyId) return
  1030. var token = uni.getStorageSync('token')
  1031. uni.request({
  1032. url: config.API_BASE_URL + '/api/mind/traditional/family-dashboard',
  1033. method: 'POST',
  1034. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  1035. data: { familyId: familyId },
  1036. success: function(res) {
  1037. if (res.data && res.data.code === 200 && res.data.data) {
  1038. self.compatibilityData = res.data.data
  1039. }
  1040. },
  1041. fail: function() {}
  1042. })
  1043. },
  1044. scrollToSection: function(section) {
  1045. uni.pageScrollTo({ selector: '#' + section, duration: 300 })
  1046. },
  1047. onTaskClick: function(task) {
  1048. uni.navigateTo({ url: '/pages/tasks/tasks' })
  1049. },
  1050. goActivityDetail: function(act) {
  1051. if (act && act.id) uni.navigateTo({ url: '/pages/discover-detail/activity-detail/activity-detail?id=' + act.id })
  1052. },
  1053. goMoreActivities: function() {
  1054. uni.navigateTo({ url: '/pages/activity/index' })
  1055. },
  1056. goProductDetail: function(prod) {
  1057. if (prod && prod.id) uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  1058. },
  1059. goMoreProducts: function() {
  1060. uni.navigateTo({ url: '/pages/shop/index' })
  1061. },
  1062. goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  1063. goMemberDetail: function(member) {
  1064. if (!member || !member.memberId) return
  1065. var currentId = this.currentChildId
  1066. uni.navigateTo({
  1067. url: '/pages/member-detail/member-detail?memberId=' + member.memberId + '&entrySource=relation-graph&selfId=' + currentId + '&dimensionCode=mind'
  1068. })
  1069. },
  1070. goFamilyMembers: function() {
  1071. uni.navigateTo({ url: '/pages/profile-extra/family-members' })
  1072. },
  1073. goAssessment: function() { uni.navigateTo({ url: '/pages/assessment/apply' }) },
  1074. goLogin: function() { uni.navigateTo({ url: '/pages/login/login' }) },
  1075. // ===== 传统文化数据 =====
  1076. // ===== 联系人 / 关系健康 =====
  1077. loadContacts: function() {
  1078. var self = this
  1079. getContactList({}).then(function(res) {
  1080. if (res.code === 200) {
  1081. self.contactList = Array.isArray(res.data) ? res.data : []
  1082. } else {
  1083. self.contactList = []
  1084. }
  1085. }).catch(function() {
  1086. self.contactList = []
  1087. })
  1088. },
  1089. loadHealthAlerts: function() {
  1090. var self = this
  1091. getHealthAlerts({}).then(function(res) {
  1092. if (res.code === 200) {
  1093. self.healthAlerts = Array.isArray(res.data) ? res.data : []
  1094. } else {
  1095. self.healthAlerts = []
  1096. }
  1097. }).catch(function() {
  1098. self.healthAlerts = []
  1099. })
  1100. },
  1101. loadMilestones: function() {
  1102. var self = this
  1103. getMilestones({}, 30).then(function(res) {
  1104. if (res.code === 200) {
  1105. self.milestones = Array.isArray(res.data) ? res.data : []
  1106. } else {
  1107. self.milestones = []
  1108. }
  1109. }).catch(function() {
  1110. self.milestones = []
  1111. })
  1112. },
  1113. loadTraditionalCultureData: function() {
  1114. var self = this
  1115. var memberId = this.currentChildId
  1116. if (!memberId) {
  1117. self.traditionalLoading = false
  1118. return
  1119. }
  1120. self.traditionalLoading = true
  1121. uni.request({
  1122. url: config.API_BASE_URL + '/api/mind/traditional/mirror',
  1123. method: 'POST',
  1124. data: { memberId: memberId, memberType: 'child' },
  1125. success: function(res) {
  1126. self.traditionalLoading = false
  1127. if (res.data && res.data.code === 200 && res.data.data) {
  1128. var d = res.data.data
  1129. if (d.eightCharacters || d.wuxingElements || d.zodiac || d.numSoul) {
  1130. self.traditionalData = d
  1131. } else {
  1132. self.traditionalData = null
  1133. }
  1134. } else {
  1135. self.traditionalData = null
  1136. }
  1137. },
  1138. fail: function() {
  1139. self.traditionalLoading = false
  1140. self.traditionalData = null
  1141. }
  1142. })
  1143. },
  1144. _watchPageReady() {
  1145. var self = this
  1146. var unwatch = this.$watch(function() {
  1147. if (self.isLoggedIn) {
  1148. return !!(self.emiData || self.energyOverview || (self.dimensionActivities && self.dimensionActivities.length > 0))
  1149. }
  1150. return !!(self.dimensionActivities && self.dimensionActivities.length > 0)
  1151. }, function(val) {
  1152. if (val) {
  1153. if (unwatch) unwatch()
  1154. self.showTabTransition = false
  1155. }
  1156. })
  1157. setTimeout(function() {
  1158. if (unwatch) unwatch()
  1159. self.showTabTransition = false
  1160. }, 5000)
  1161. },
  1162. // ===== DAN 报告 =====
  1163. loadDanReports: function() {
  1164. var self = this
  1165. var memberId = self.currentChildId
  1166. if (!memberId) return
  1167. getDanReportByChild(memberId, 'mind').then(function(res) {
  1168. if (res.code === 200 && res.data) {
  1169. self.danReports = res.data
  1170. }
  1171. }).catch(function() {})
  1172. },
  1173. goDanUpload: function(dimension) {
  1174. uni.navigateTo({ url: '/pages/dan-assessment/report-upload' })
  1175. },
  1176. viewDanReport: function(report) {
  1177. uni.navigateTo({ url: '/pages/dan-assessment/report-upload?draftId=' + report.id })
  1178. },
  1179. formatDate: function(dateStr) {
  1180. if (!dateStr) return ''
  1181. var d = new Date(dateStr)
  1182. return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  1183. }
  1184. }
  1185. }
  1186. </script>
  1187. <style scoped>
  1188. .container {
  1189. min-height: 100vh;
  1190. background: #f5f7fa;
  1191. padding-bottom: 120rpx;
  1192. }
  1193. /* ===== 心·心理 标题栏 ===== */
  1194. .section-title-bar {
  1195. display: flex;
  1196. flex-direction: row;
  1197. align-items: center;
  1198. margin: 20rpx 30rpx 10rpx;
  1199. padding: 16rpx 24rpx;
  1200. background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  1201. border-radius: 20rpx;
  1202. box-shadow: 0 4rpx 16rpx rgba(139,92,246,0.25);
  1203. }
  1204. .section-title-icon {
  1205. font-size: 32rpx;
  1206. color: #fff;
  1207. margin-right: 12rpx;
  1208. }
  1209. .section-title-text {
  1210. font-size: 32rpx;
  1211. font-weight: bold;
  1212. color: #fff;
  1213. }
  1214. /* ===== 心理能量概况 ===== */
  1215. .energy-overview {
  1216. display: flex;
  1217. flex-direction: row;
  1218. margin: 20rpx 30rpx;
  1219. background: #fff;
  1220. border-radius: 20rpx;
  1221. padding: 24rpx 16rpx;
  1222. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1223. justify-content: space-around;
  1224. }
  1225. .energy-badge {
  1226. display: flex;
  1227. flex-direction: column;
  1228. align-items: center;
  1229. flex: 1;
  1230. }
  1231. .badge-icon {
  1232. font-size: 36rpx;
  1233. margin-bottom: 8rpx;
  1234. }
  1235. .badge-value {
  1236. font-size: 36rpx;
  1237. font-weight: bold;
  1238. color: #333;
  1239. }
  1240. .badge-label {
  1241. font-size: 20rpx;
  1242. color: #999;
  1243. margin-top: 4rpx;
  1244. }
  1245. /* ===== EMI 四维条形图 ===== */
  1246. .emi-section {
  1247. margin: 20rpx 30rpx;
  1248. }
  1249. .emi-card {
  1250. background: #fff;
  1251. border-radius: 24rpx;
  1252. padding: 30rpx;
  1253. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1254. }
  1255. .emi-card-title {
  1256. font-size: 30rpx;
  1257. font-weight: bold;
  1258. color: #333;
  1259. display: block;
  1260. }
  1261. .personality-header {
  1262. display: flex;
  1263. flex-direction: row;
  1264. align-items: center;
  1265. justify-content: space-between;
  1266. margin-bottom: 24rpx;
  1267. }
  1268. .test-btn {
  1269. background: #8B5CF6;
  1270. padding: 8rpx 28rpx;
  1271. border-radius: 30rpx;
  1272. }
  1273. .test-btn-text {
  1274. font-size: 24rpx;
  1275. color: #fff;
  1276. font-weight: 500;
  1277. }
  1278. .emi-bar-item {
  1279. display: flex;
  1280. flex-direction: row;
  1281. align-items: center;
  1282. margin-bottom: 20rpx;
  1283. }
  1284. .emi-bar-label {
  1285. font-size: 24rpx;
  1286. color: #666;
  1287. width: 120rpx;
  1288. flex-shrink: 0;
  1289. }
  1290. .emi-bar-track {
  1291. flex: 1;
  1292. height: 20rpx;
  1293. background: #f0f0f0;
  1294. border-radius: 10rpx;
  1295. overflow: hidden;
  1296. margin: 0 16rpx;
  1297. }
  1298. .emi-bar-fill {
  1299. height: 100%;
  1300. border-radius: 10rpx;
  1301. transition: width 0.5s;
  1302. }
  1303. .emi-bar-score {
  1304. font-size: 26rpx;
  1305. font-weight: bold;
  1306. color: #333;
  1307. width: 60rpx;
  1308. text-align: right;
  1309. flex-shrink: 0;
  1310. }
  1311. .emi-bar-level {
  1312. font-size: 20rpx;
  1313. width: 80rpx;
  1314. text-align: right;
  1315. flex-shrink: 0;
  1316. }
  1317. .level-excellent { color: #10B981; }
  1318. .level-good { color: #3B82F6; }
  1319. .level-average { color: #F97316; }
  1320. .level-low { color: #EF4444; }
  1321. .emi-footer {
  1322. display: flex;
  1323. flex-direction: row;
  1324. justify-content: space-between;
  1325. align-items: center;
  1326. margin-top: 20rpx;
  1327. padding-top: 20rpx;
  1328. border-top: 1rpx solid #f0f0f0;
  1329. }
  1330. .emi-overall {
  1331. font-size: 28rpx;
  1332. font-weight: bold;
  1333. color: #FF6B35;
  1334. }
  1335. .emi-link {
  1336. display: flex;
  1337. flex-direction: row;
  1338. align-items: center;
  1339. }
  1340. .emi-link-text {
  1341. font-size: 26rpx;
  1342. color: #FF6B35;
  1343. font-weight: 500;
  1344. }
  1345. .emi-link-arrow {
  1346. font-size: 26rpx;
  1347. color: #FF6B35;
  1348. margin-left: 8rpx;
  1349. }
  1350. /* ===== EMI 心理报告卡片 ===== */
  1351. .emi-card {
  1352. margin: 30rpx;
  1353. background: #fff;
  1354. border-radius: 24rpx;
  1355. padding: 30rpx;
  1356. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1357. }
  1358. .emi-header {
  1359. margin-bottom: 24rpx;
  1360. }
  1361. .emi-title {
  1362. font-size: 30rpx;
  1363. font-weight: bold;
  1364. color: #333;
  1365. display: block;
  1366. }
  1367. .emi-overall-wrap {
  1368. display: flex;
  1369. flex-direction: column;
  1370. align-items: center;
  1371. padding: 32rpx 0;
  1372. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1373. border-radius: 16rpx;
  1374. margin: 20rpx 0;
  1375. color: #fff;
  1376. }
  1377. .emi-overall-label {
  1378. font-size: 26rpx;
  1379. margin-bottom: 6rpx;
  1380. }
  1381. .emi-overall-value {
  1382. font-size: 64rpx;
  1383. font-weight: bold;
  1384. margin-bottom: 6rpx;
  1385. }
  1386. .emi-overall-level {
  1387. font-size: 24rpx;
  1388. padding: 4rpx 16rpx;
  1389. border-radius: 12rpx;
  1390. background: rgba(255,255,255,0.2);
  1391. }
  1392. .emi-dimensions {
  1393. display: flex;
  1394. flex-direction: column;
  1395. gap: 20rpx;
  1396. }
  1397. .emi-dimension {
  1398. display: flex;
  1399. flex-direction: column;
  1400. }
  1401. .emi-dim-header {
  1402. display: flex;
  1403. flex-direction: row;
  1404. justify-content: space-between;
  1405. align-items: center;
  1406. margin-bottom: 8rpx;
  1407. }
  1408. .emi-dim-label {
  1409. font-size: 26rpx;
  1410. color: #666;
  1411. }
  1412. .emi-dim-values {
  1413. display: flex;
  1414. flex-direction: row;
  1415. align-items: center;
  1416. }
  1417. .emi-dim-score {
  1418. font-size: 28rpx;
  1419. font-weight: bold;
  1420. color: #FF6B35;
  1421. margin-right: 12rpx;
  1422. }
  1423. .emi-dim-level {
  1424. font-size: 20rpx;
  1425. padding: 2rpx 12rpx;
  1426. border-radius: 8rpx;
  1427. }
  1428. .emi-dim-bar {
  1429. height: 14rpx;
  1430. background: #f0f0f0;
  1431. border-radius: 7rpx;
  1432. overflow: hidden;
  1433. }
  1434. .emi-dim-bar-fill {
  1435. height: 100%;
  1436. border-radius: 7rpx;
  1437. transition: width 0.5s;
  1438. }
  1439. .emi-footer {
  1440. display: flex;
  1441. justify-content: flex-end;
  1442. align-items: center;
  1443. padding-top: 20rpx;
  1444. border-top: 1rpx solid #f0f0f0;
  1445. margin-top: 20rpx;
  1446. }
  1447. .emi-footer-text {
  1448. font-size: 24rpx;
  1449. color: #F97316;
  1450. font-weight: 500;
  1451. }
  1452. .emi-footer-icon {
  1453. font-size: 24rpx;
  1454. margin-left: 8rpx;
  1455. }
  1456. .level-excellent { color: #10B981; background: #ECFDF5; }
  1457. .level-good { color: #3B82F6; background: #EFF6FF; }
  1458. .level-average { color: #F97316; background: #FFF7ED; }
  1459. .level-low { color: #EF4444; background: #FEF2F2; }
  1460. /* 雷达图内的空状态 */
  1461. .placeholder-content {
  1462. display: flex;
  1463. flex-direction: column;
  1464. align-items: center;
  1465. padding: 40rpx 20rpx;
  1466. }
  1467. /* ===== 占位卡 ===== */
  1468. .placeholder-card {
  1469. margin: 30rpx;
  1470. background: #fff;
  1471. border-radius: 24rpx;
  1472. padding: 60rpx 40rpx;
  1473. display: flex;
  1474. flex-direction: column;
  1475. align-items: center;
  1476. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1477. }
  1478. .placeholder-icon {
  1479. font-size: 80rpx;
  1480. margin-bottom: 20rpx;
  1481. }
  1482. .placeholder-title {
  1483. font-size: 32rpx;
  1484. font-weight: bold;
  1485. color: #333;
  1486. margin-bottom: 16rpx;
  1487. }
  1488. .placeholder-desc {
  1489. font-size: 26rpx;
  1490. color: #999;
  1491. text-align: center;
  1492. line-height: 1.6;
  1493. margin-bottom: 30rpx;
  1494. }
  1495. .placeholder-btn {
  1496. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1497. color: #fff;
  1498. font-size: 28rpx;
  1499. font-weight: bold;
  1500. padding: 16rpx 64rpx;
  1501. border-radius: 40rpx;
  1502. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  1503. }
  1504. /* ===== 传统文化卡片 ===== */
  1505. .culture-section {
  1506. margin: 20rpx 30rpx;
  1507. }
  1508. .culture-card {
  1509. background: #fff;
  1510. border-radius: 20rpx;
  1511. padding: 24rpx;
  1512. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1513. margin-bottom: 16rpx;
  1514. }
  1515. .culture-card-header {
  1516. display: flex;
  1517. align-items: center;
  1518. margin-bottom: 16rpx;
  1519. }
  1520. .culture-card-icon {
  1521. font-size: 32rpx;
  1522. margin-right: 10rpx;
  1523. }
  1524. .culture-card-title {
  1525. font-size: 28rpx;
  1526. font-weight: 600;
  1527. color: #333;
  1528. }
  1529. .culture-card-body {
  1530. font-size: 24rpx;
  1531. color: #666;
  1532. line-height: 1.6;
  1533. }
  1534. /* 八字四柱 */
  1535. .bazi-grid {
  1536. display: flex;
  1537. justify-content: space-around;
  1538. padding: 8rpx 0;
  1539. }
  1540. .bazi-column {
  1541. display: flex;
  1542. flex-direction: column;
  1543. align-items: center;
  1544. }
  1545. .bazi-pillar-label {
  1546. font-size: 22rpx;
  1547. color: #999;
  1548. margin-bottom: 6rpx;
  1549. }
  1550. .bazi-pillar-value {
  1551. font-size: 32rpx;
  1552. font-weight: 700;
  1553. color: #8B5CF6;
  1554. background: #F5F0FF;
  1555. padding: 10rpx 14rpx;
  1556. border-radius: 10rpx;
  1557. }
  1558. /* 五行能量 */
  1559. .wuxing-list {
  1560. display: flex;
  1561. flex-direction: column;
  1562. gap: 12rpx;
  1563. }
  1564. .wuxing-item {
  1565. display: flex;
  1566. align-items: center;
  1567. gap: 12rpx;
  1568. }
  1569. .wuxing-label {
  1570. font-size: 26rpx;
  1571. font-weight: 600;
  1572. width: 44rpx;
  1573. text-align: center;
  1574. }
  1575. .wuxing-bar-track {
  1576. flex: 1;
  1577. height: 20rpx;
  1578. background: #F0F0F0;
  1579. border-radius: 10rpx;
  1580. overflow: hidden;
  1581. }
  1582. .wuxing-bar-fill {
  1583. height: 100%;
  1584. border-radius: 10rpx;
  1585. }
  1586. .wuxing-value {
  1587. font-size: 22rpx;
  1588. color: #666;
  1589. width: 56rpx;
  1590. text-align: right;
  1591. }
  1592. .energy-card {
  1593. margin-top: 20rpx;
  1594. padding: 24rpx 20rpx;
  1595. background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  1596. border-radius: 20rpx;
  1597. position: relative;
  1598. overflow: hidden;
  1599. }
  1600. .energy-card::before {
  1601. content: '';
  1602. position: absolute;
  1603. top: -60rpx;
  1604. right: -60rpx;
  1605. width: 200rpx;
  1606. height: 200rpx;
  1607. background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, transparent 70%);
  1608. border-radius: 50%;
  1609. }
  1610. .energy-card::after {
  1611. content: '';
  1612. position: absolute;
  1613. bottom: -40rpx;
  1614. left: -40rpx;
  1615. width: 160rpx;
  1616. height: 160rpx;
  1617. background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  1618. border-radius: 50%;
  1619. }
  1620. .energy-header {
  1621. display: flex;
  1622. align-items: center;
  1623. margin-bottom: 14rpx;
  1624. position: relative;
  1625. z-index: 1;
  1626. }
  1627. .energy-icon {
  1628. font-size: 32rpx;
  1629. margin-right: 10rpx;
  1630. }
  1631. .energy-label {
  1632. font-size: 28rpx;
  1633. font-weight: 700;
  1634. background: linear-gradient(135deg, #F59E0B, #FF6B9D);
  1635. -webkit-background-clip: text;
  1636. -webkit-text-fill-color: transparent;
  1637. background-clip: text;
  1638. }
  1639. .energy-divider {
  1640. height: 2rpx;
  1641. background: linear-gradient(90deg, rgba(255,215,0,0.5), rgba(255,107,157,0.3), transparent);
  1642. margin-bottom: 18rpx;
  1643. position: relative;
  1644. z-index: 1;
  1645. }
  1646. .energy-quote {
  1647. font-size: 26rpx;
  1648. color: #E2E8F0;
  1649. line-height: 1.8;
  1650. display: block;
  1651. margin-bottom: 14rpx;
  1652. position: relative;
  1653. z-index: 1;
  1654. padding-left: 20rpx;
  1655. letter-spacing: 1rpx;
  1656. }
  1657. .energy-quote::before {
  1658. content: '';
  1659. position: absolute;
  1660. left: 0;
  1661. top: 4rpx;
  1662. bottom: 4rpx;
  1663. width: 4rpx;
  1664. background: linear-gradient(180deg, #F59E0B, #FF6B9D);
  1665. border-radius: 2rpx;
  1666. }
  1667. .energy-advice {
  1668. font-size: 24rpx;
  1669. color: #94A3B8;
  1670. line-height: 1.7;
  1671. display: block;
  1672. position: relative;
  1673. z-index: 1;
  1674. padding: 14rpx 18rpx;
  1675. background: rgba(255,255,255,0.05);
  1676. border-radius: 12rpx;
  1677. border: 1rpx solid rgba(255,255,255,0.08);
  1678. }
  1679. .energy-footer {
  1680. display: flex;
  1681. justify-content: center;
  1682. gap: 12rpx;
  1683. margin-top: 18rpx;
  1684. position: relative;
  1685. z-index: 1;
  1686. }
  1687. .energy-footer-dot {
  1688. width: 8rpx;
  1689. height: 8rpx;
  1690. border-radius: 50%;
  1691. background: rgba(255,255,255,0.3);
  1692. }
  1693. .energy-footer-dot:nth-child(2) {
  1694. background: rgba(255,215,0,0.6);
  1695. width: 10rpx;
  1696. height: 10rpx;
  1697. }
  1698. /* 星座+灵数双栏 */
  1699. .culture-dual {
  1700. display: flex;
  1701. gap: 16rpx;
  1702. }
  1703. .culture-dual-item {
  1704. flex: 1;
  1705. background: #fff;
  1706. border-radius: 20rpx;
  1707. padding: 20rpx;
  1708. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1709. display: flex;
  1710. flex-direction: column;
  1711. align-items: center;
  1712. }
  1713. .culture-dual-icon {
  1714. font-size: 36rpx;
  1715. margin-bottom: 8rpx;
  1716. }
  1717. .culture-dual-label {
  1718. font-size: 22rpx;
  1719. color: #999;
  1720. margin-bottom: 6rpx;
  1721. }
  1722. .culture-dual-value {
  1723. font-size: 28rpx;
  1724. font-weight: 700;
  1725. color: #8B5CF6;
  1726. }
  1727. .culture-empty {
  1728. text-align: center;
  1729. padding: 30rpx 0;
  1730. color: #bbb;
  1731. font-size: 24rpx;
  1732. }
  1733. /* ===== 每日心理 ===== */
  1734. .tip-card {
  1735. background: #fff;
  1736. border-radius: 20rpx;
  1737. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1738. display: flex;
  1739. flex-direction: row;
  1740. overflow: hidden;
  1741. }
  1742. .tip-left-bar {
  1743. width: 6rpx;
  1744. background: linear-gradient(180deg, #5B9BD5, #8FC5E8);
  1745. flex-shrink: 0;
  1746. }
  1747. .tip-body {
  1748. flex: 1;
  1749. padding: 28rpx 24rpx;
  1750. }
  1751. .tip-title {
  1752. font-size: 28rpx;
  1753. font-weight: bold;
  1754. color: #5B9BD5;
  1755. display: block;
  1756. margin-bottom: 12rpx;
  1757. }
  1758. .tip-content {
  1759. font-size: 24rpx;
  1760. color: #666;
  1761. line-height: 1.6;
  1762. display: block;
  1763. margin-bottom: 16rpx;
  1764. }
  1765. .tip-footer {
  1766. display: flex;
  1767. flex-direction: row;
  1768. justify-content: flex-end;
  1769. }
  1770. .tip-source {
  1771. font-size: 22rpx;
  1772. color: #bbb;
  1773. }
  1774. /* ===== 通用区块 ===== */
  1775. .section {
  1776. margin: 20rpx 30rpx;
  1777. }
  1778. .section-header {
  1779. margin-bottom: 20rpx;
  1780. }
  1781. .section-title {
  1782. font-size: 30rpx;
  1783. font-weight: bold;
  1784. color: #333;
  1785. }
  1786. /* ===== 推荐阅读 ===== */
  1787. .article-list {
  1788. display: flex;
  1789. flex-direction: column;
  1790. }
  1791. .article-card {
  1792. background: #fff;
  1793. border-radius: 20rpx;
  1794. padding: 28rpx 24rpx;
  1795. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1796. margin-bottom: 20rpx;
  1797. }
  1798. .article-category {
  1799. display: inline-block;
  1800. padding: 4rpx 18rpx;
  1801. border-radius: 20rpx;
  1802. margin-bottom: 14rpx;
  1803. }
  1804. .article-category-text {
  1805. font-size: 20rpx;
  1806. color: #fff;
  1807. font-weight: 500;
  1808. }
  1809. .article-title {
  1810. font-size: 28rpx;
  1811. font-weight: bold;
  1812. color: #333;
  1813. display: block;
  1814. margin-bottom: 10rpx;
  1815. }
  1816. .article-summary {
  1817. font-size: 24rpx;
  1818. color: #888;
  1819. line-height: 1.5;
  1820. display: block;
  1821. margin-bottom: 20rpx;
  1822. }
  1823. .article-meta {
  1824. display: flex;
  1825. flex-direction: row;
  1826. align-items: center;
  1827. justify-content: space-between;
  1828. }
  1829. .meta-item {
  1830. display: flex;
  1831. flex-direction: row;
  1832. align-items: center;
  1833. margin-right: 20rpx;
  1834. }
  1835. .meta-icon {
  1836. font-size: 22rpx;
  1837. margin-right: 4rpx;
  1838. }
  1839. .meta-text {
  1840. font-size: 22rpx;
  1841. color: #bbb;
  1842. }
  1843. .article-date {
  1844. font-size: 22rpx;
  1845. color: #bbb;
  1846. margin-left: auto;
  1847. }
  1848. /* ===== 功能区入口 ===== */
  1849. .func-section {
  1850. margin: 20rpx 30rpx;
  1851. }
  1852. .func-grid {
  1853. display: flex;
  1854. flex-direction: column;
  1855. gap: 16rpx;
  1856. background: #fff;
  1857. border-radius: 20rpx;
  1858. padding: 24rpx 16rpx;
  1859. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1860. }
  1861. .func-row {
  1862. display: flex;
  1863. flex-direction: row;
  1864. justify-content: space-between;
  1865. }
  1866. .func-item {
  1867. display: flex;
  1868. flex-direction: column;
  1869. align-items: center;
  1870. flex: 1;
  1871. }
  1872. .func-icon-wrap {
  1873. width: 80rpx;
  1874. height: 80rpx;
  1875. border-radius: 40rpx;
  1876. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  1877. display: flex;
  1878. align-items: center;
  1879. justify-content: center;
  1880. margin-bottom: 10rpx;
  1881. }
  1882. .func-icon {
  1883. font-size: 40rpx;
  1884. }
  1885. .func-label {
  1886. font-size: 22rpx;
  1887. color: #666;
  1888. font-weight: 500;
  1889. }
  1890. .func-item:active {
  1891. opacity: 0.7;
  1892. }
  1893. /* ===== 底部 ===== */
  1894. .bottom-spacer {
  1895. height: 120rpx;
  1896. }
  1897. /* ===== 肠脑轴 ===== */
  1898. .gut-insight-text {
  1899. font-size: 24rpx;
  1900. color: #666;
  1901. margin-bottom: 16rpx;
  1902. padding: 12rpx 16rpx;
  1903. background: #F0FFF4;
  1904. border-radius: 12rpx;
  1905. line-height: 1.6;
  1906. }
  1907. .gut-indicator-list {
  1908. display: flex;
  1909. flex-direction: column;
  1910. gap: 12rpx;
  1911. }
  1912. .gut-indicator-item {
  1913. display: flex;
  1914. align-items: center;
  1915. gap: 12rpx;
  1916. }
  1917. .gut-indicator-left {
  1918. width: 80rpx;
  1919. flex-shrink: 0;
  1920. }
  1921. .gut-indicator-name {
  1922. font-size: 22rpx;
  1923. color: #666;
  1924. }
  1925. .gut-indicator-bar-track {
  1926. flex: 1;
  1927. height: 16rpx;
  1928. background: #F0F0F0;
  1929. border-radius: 8rpx;
  1930. overflow: hidden;
  1931. }
  1932. .gut-indicator-bar-fill {
  1933. height: 100%;
  1934. border-radius: 8rpx;
  1935. transition: width 0.3s;
  1936. }
  1937. .gut-indicator-value {
  1938. font-size: 22rpx;
  1939. color: #666;
  1940. width: 60rpx;
  1941. text-align: right;
  1942. }
  1943. .gut-indicator-status {
  1944. font-size: 20rpx;
  1945. padding: 2rpx 12rpx;
  1946. border-radius: 10rpx;
  1947. width: 60rpx;
  1948. text-align: center;
  1949. }
  1950. .status-normal {
  1951. background: #D1FAE5;
  1952. color: #059669;
  1953. }
  1954. .status-abnormal {
  1955. background: #FEE2E2;
  1956. color: #DC2626;
  1957. }
  1958. .status-warning {
  1959. background: #FEF3C7;
  1960. color: #D97706;
  1961. }
  1962. /* ===== 关键信息(家庭+个人) ===== */
  1963. .key-info-card {
  1964. background: #fff;
  1965. border-radius: 20rpx;
  1966. padding: 24rpx;
  1967. margin-top: 20rpx;
  1968. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1969. }
  1970. .key-info-header {
  1971. display: flex;
  1972. align-items: center;
  1973. margin-bottom: 20rpx;
  1974. }
  1975. .key-info-icon {
  1976. font-size: 28rpx;
  1977. margin-right: 8rpx;
  1978. }
  1979. .key-info-title {
  1980. font-size: 28rpx;
  1981. font-weight: 600;
  1982. color: #333;
  1983. }
  1984. .key-info-body {
  1985. display: flex;
  1986. flex-direction: row;
  1987. gap: 20rpx;
  1988. }
  1989. .key-info-col {
  1990. flex: 1;
  1991. background: #F8F9FA;
  1992. border-radius: 14rpx;
  1993. padding: 16rpx;
  1994. min-width: 0;
  1995. }
  1996. .ki-subtitle {
  1997. font-size: 22rpx;
  1998. color: #999;
  1999. margin-bottom: 12rpx;
  2000. font-weight: 500;
  2001. }
  2002. .ki-row {
  2003. display: flex;
  2004. align-items: center;
  2005. margin-bottom: 10rpx;
  2006. flex-wrap: nowrap;
  2007. }
  2008. .ki-row:last-child {
  2009. margin-bottom: 0;
  2010. }
  2011. .ki-label {
  2012. font-size: 22rpx;
  2013. color: #888;
  2014. margin-right: 8rpx;
  2015. white-space: nowrap;
  2016. }
  2017. .ki-dot {
  2018. width: 16rpx;
  2019. height: 16rpx;
  2020. border-radius: 50%;
  2021. margin-right: 6rpx;
  2022. flex-shrink: 0;
  2023. }
  2024. .ki-valuel {
  2025. font-size: 24rpx;
  2026. color: #333;
  2027. font-weight: 500;
  2028. white-space: nowrap;
  2029. }
  2030. .ki-valued {
  2031. font-size: 24rpx;
  2032. color: #333;
  2033. font-weight: 500;
  2034. }
  2035. .ki-swatch {
  2036. width: 28rpx;
  2037. height: 28rpx;
  2038. border-radius: 50%;
  2039. margin-right: 6rpx;
  2040. border: 2rpx solid rgba(0,0,0,0.06);
  2041. flex-shrink: 0;
  2042. }
  2043. .ki-num {
  2044. font-size: 30rpx;
  2045. font-weight: 700;
  2046. color: #FF6B9D;
  2047. }
  2048. .ki-fortune {
  2049. font-size: 24rpx;
  2050. font-weight: 700;
  2051. padding: 2rpx 12rpx;
  2052. border-radius: 10rpx;
  2053. }
  2054. .ki-fortune-0 {
  2055. color: #D32F2F;
  2056. background: #FFEBEE;
  2057. }
  2058. .ki-fortune-1 {
  2059. color: #E65100;
  2060. background: #FFF3E0;
  2061. }
  2062. .ki-fortune-2 {
  2063. color: #F9A825;
  2064. background: #FFFDE7;
  2065. }
  2066. .ki-fortune-3 {
  2067. color: #7B1FA2;
  2068. background: #F3E5F5;
  2069. }
  2070. .ki-fortune-4 {
  2071. color: #B71C1C;
  2072. background: #FFCDD2;
  2073. }
  2074. .ki-insight {
  2075. display: flex;
  2076. align-items: flex-start;
  2077. margin-top: 16rpx;
  2078. padding: 16rpx;
  2079. background: #FFF8F0;
  2080. border-radius: 12rpx;
  2081. }
  2082. .ki-insight-icon {
  2083. font-size: 24rpx;
  2084. margin-right: 8rpx;
  2085. flex-shrink: 0;
  2086. }
  2087. .ki-insight-text {
  2088. font-size: 22rpx;
  2089. color: #8B6914;
  2090. line-height: 1.5;
  2091. }
  2092. .ki-footer {
  2093. margin-top: 16rpx;
  2094. text-align: center;
  2095. padding: 12rpx;
  2096. font-size: 24rpx;
  2097. color: #8B5CF6;
  2098. font-weight: 500;
  2099. background: #F5F3FF;
  2100. border-radius: 12rpx;
  2101. }
  2102. .ki-footer:active {
  2103. opacity: 0.7;
  2104. }
  2105. /* DAN 报告卡片 */
  2106. .dan-card {
  2107. background: #fff;
  2108. border-radius: 16rpx;
  2109. padding: 24rpx;
  2110. margin-bottom: 16rpx;
  2111. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  2112. }
  2113. .dan-card-header {
  2114. display: flex;
  2115. justify-content: space-between;
  2116. align-items: center;
  2117. margin-bottom: 12rpx;
  2118. }
  2119. .dan-report-date {
  2120. font-size: 26rpx;
  2121. color: #666;
  2122. }
  2123. .dan-status {
  2124. font-size: 22rpx;
  2125. padding: 4rpx 16rpx;
  2126. border-radius: 8rpx;
  2127. }
  2128. .dan-status.confirmed {
  2129. background: #D1FAE5;
  2130. color: #065F46;
  2131. }
  2132. .dan-status.pending {
  2133. background: #FEF3C7;
  2134. color: #92400E;
  2135. }
  2136. .dan-report-desc {
  2137. font-size: 28rpx;
  2138. color: #333;
  2139. font-weight: 500;
  2140. margin-bottom: 12rpx;
  2141. display: block;
  2142. }
  2143. .dan-card-footer {
  2144. text-align: right;
  2145. }
  2146. .dan-view-link {
  2147. font-size: 26rpx;
  2148. color: #6366F1;
  2149. }
  2150. .section-header {
  2151. display: flex;
  2152. justify-content: space-between;
  2153. align-items: center;
  2154. margin-bottom: 20rpx;
  2155. }
  2156. .section-title {
  2157. font-size: 32rpx;
  2158. font-weight: 700;
  2159. color: #333;
  2160. }
  2161. .section-more {
  2162. font-size: 26rpx;
  2163. color: #6366F1;
  2164. padding: 8rpx 16rpx;
  2165. }
  2166. </style>