index.vue 49 KB

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