index.vue 50 KB

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