index.vue 67 KB

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