index.vue 53 KB

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