index.vue 49 KB

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