index.vue 53 KB

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