index.vue 48 KB

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