index.vue 50 KB

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