index.vue 50 KB

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