index.vue 42 KB

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