index.vue 53 KB

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