index.vue 67 KB

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