index.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392
  1. <template>
  2. <view class="container">
  3. <!-- Tabbar 切换过渡页 -->
  4. <tab-transition v-if="showTabTransition" dimCode="mind" />
  5. <!-- 品牌头部 -->
  6. <PageBanner theme="mind-wisdom"
  7. tagline="心智成长 · 智慧人生"
  8. quote="知己知彼,百战不殆" />
  9. <!-- ===== 心·心理 ===== -->
  10. <view class="section-title-bar">
  11. <text class="section-title-icon">&#x2764;</text>
  12. <text class="section-title-text">心·心理</text>
  13. </view>
  14. <!-- 游客登录引导卡 -->
  15. <template v-if="!isLoggedIn">
  16. <LoginGuideCard
  17. title="登录后查看心理成长报告"
  18. :items="[
  19. '查看EMI心理测评四维分析',
  20. '查看大五人格分析报告',
  21. '阅读专属文章、参与情绪打卡'
  22. ]" />
  23. </template>
  24. <!-- 登录后:五维能量条 -->
  25. <FamilyEnergyBar
  26. v-if="isLoggedIn"
  27. dimensionCode="mind"
  28. :sandboxData="sandboxData" />
  29. <!-- 关系图谱(登录后可见) -->
  30. <FamilyRelationGraph
  31. v-if="isLoggedIn && familyMembersVisible.length > 0"
  32. dimensionCode="mind"
  33. :selfId="activeChildId"
  34. :members="familyMembersVisible"
  35. :energyMap="energyMapForGraph"
  36. :intimacyMap="intimacyMapForGraph"
  37. :compatibilityMap="compatibilityMapForGraph"
  38. @memberTap="goMemberDetail" />
  39. <!-- 登录后:用户快捷入口 -->
  40. <UserQuickEntry
  41. v-if="isLoggedIn"
  42. :userName="userName"
  43. roleName="家长"
  44. :currentChildName="currentChildName"
  45. :children="children"
  46. @childChanged="onChildChanged"
  47. @scrollTo="scrollToSection" />
  48. <!-- ===== 心理能量概况 ===== -->
  49. <view class="energy-overview" v-if="emiData">
  50. <view class="energy-badge">
  51. <text class="badge-icon">&#x2764;</text>
  52. <text class="badge-value">{{ emiData.overallScore || 0 }}</text>
  53. <text class="badge-label">心能量</text>
  54. </view>
  55. <view class="energy-badge">
  56. <text class="badge-icon">&#x1F4AA;</text>
  57. <text class="badge-value">{{ emiData.resilienceScore || 0 }}</text>
  58. <text class="badge-label">韧性评分</text>
  59. </view>
  60. <view class="energy-badge">
  61. <text class="badge-icon">&#x1F64F;</text>
  62. <text class="badge-value">{{ emiData.emotionScore || 0 }}</text>
  63. <text class="badge-label">情绪评分</text>
  64. </view>
  65. </view>
  66. <!-- EMI 四维条形图 -->
  67. <view class="emi-section" v-if="emiData">
  68. <view class="emi-card">
  69. <text class="emi-card-title">EMI 心理四维</text>
  70. <view class="emi-bar-item" v-for="dim in emiDimensions" :key="dim.key">
  71. <text class="emi-bar-label">{{ dim.label }}</text>
  72. <view class="emi-bar-track">
  73. <view class="emi-bar-fill" :style="{ width: (emiData[dim.key] || 0) + '%', background: dim.color }"></view>
  74. </view>
  75. <text class="emi-bar-score">{{ emiData[dim.key] || 0 }}</text>
  76. <text :class="['emi-bar-level', 'level-' + getScoreLevel(emiData[dim.key] || 0)]">{{ getScoreLevelText(emiData[dim.key] || 0) }}</text>
  77. </view>
  78. <view class="emi-footer">
  79. <text class="emi-overall">综合EQ分: {{ emiData.overallScore || 0 }}</text>
  80. <view class="emi-link" @click="goEmotionReport">
  81. <text class="emi-link-text">查看完整报告</text>
  82. <text class="emi-link-arrow">&#x2192;</text>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <!-- 无 EMI 数据占位 -->
  88. <view class="placeholder-card" v-if="!emiData && !emiLoading">
  89. <text class="placeholder-icon">&#x1F9E0;</text>
  90. <text class="placeholder-title">心理评估</text>
  91. <text class="placeholder-desc">完成 EMI 心理测评后,可在此查看详细的心理分析报告</text>
  92. <view class="placeholder-btn" @click="goAssessment" v-if="isLoggedIn">预约测评</view>
  93. <view class="placeholder-btn" @click="goLogin" v-else>立即登录</view>
  94. </view>
  95. <!-- ===== 大五人格雷达图(从EMI数据中提取) ===== -->
  96. <view class="section personality-section" v-if="emiData">
  97. <view class="section-header">
  98. <text class="section-title">大五人格</text>
  99. </view>
  100. <RadarChart
  101. :dimensions="personalityDimensions"
  102. :scores="personalityScores"
  103. :childName="currentChildName || '孩子'"
  104. fillColor="#8B5CF6"
  105. gridColor="#EDE9FE"
  106. labelColor="#6D28D9" />
  107. </view>
  108. <!-- 每日心理 -->
  109. <view class="section" v-if="sectionVisible('daily_tip')">
  110. <view class="section-header">
  111. <text class="section-title">每日心理</text>
  112. </view>
  113. <view class="tip-card">
  114. <view class="tip-left-bar"></view>
  115. <view class="tip-body">
  116. <text class="tip-title">{{ dailyTip.title }}</text>
  117. <text class="tip-content">{{ dailyTip.content }}</text>
  118. <view class="tip-footer">
  119. <text class="tip-source">{{ dailyTip.source }}</text>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 肠脑轴情绪卡片 -->
  125. <view class="section" v-if="gutIndicators && gutIndicators.length > 0">
  126. <view class="section-header">
  127. <text class="section-title">&#x1F9E0; 肠脑情绪关联</text>
  128. </view>
  129. <view class="gut-insight-text" v-if="gutInsight">
  130. <text>{{ gutInsight }}</text>
  131. </view>
  132. <view class="gut-indicator-list">
  133. <view class="gut-indicator-item" v-for="ind in gutIndicators" :key="ind.id">
  134. <view class="gut-indicator-left">
  135. <text class="gut-indicator-name">{{ ind.indicatorName || ind.name }}</text>
  136. </view>
  137. <view class="gut-indicator-bar-track">
  138. <view class="gut-indicator-bar-fill" :style="{ width: (ind.value || 0) + '%', background: indicatorColor(ind.status) }"></view>
  139. </view>
  140. <text class="gut-indicator-value">{{ ind.value }}{{ ind.unit || '%' }}</text>
  141. <text :class="['gut-indicator-status', 'status-' + (ind.status || 'normal')]">{{ statusLabel(ind.status) }}</text>
  142. </view>
  143. </view>
  144. </view>
  145. <!-- 推荐阅读 -->
  146. <DimensionArticles
  147. dimensionCode="mind"
  148. :articles="emotionArticles"
  149. :isLoggedIn="isLoggedIn"
  150. @articleClick="goArticleDetail"
  151. @moreArticles="goArticles" />
  152. <!-- ===== 传统文化(八字/五行/星座/灵数) ===== -->
  153. <view class="culture-section" v-if="isLoggedIn && traditionalData">
  154. <!-- 八字四柱 -->
  155. <view class="culture-card" v-if="traditionalData.eightCharacters">
  156. <view class="culture-card-header">
  157. <text class="culture-card-icon">&#x2637;</text>
  158. <text class="culture-card-title">八字四柱</text>
  159. </view>
  160. <view class="bazi-grid">
  161. <view class="bazi-column" v-for="(val, key) in traditionalData.eightCharacters" :key="key">
  162. <text class="bazi-pillar-label">{{ pillarLabels[key] || key }}</text>
  163. <text class="bazi-pillar-value">{{ val }}</text>
  164. </view>
  165. </view>
  166. </view>
  167. <!-- 五行能量 -->
  168. <view class="culture-card" v-if="traditionalData.wuxingElements">
  169. <view class="culture-card-header">
  170. <text class="culture-card-icon">&#x267E;</text>
  171. <text class="culture-card-title">五行能量</text>
  172. </view>
  173. <view class="wuxing-list">
  174. <view class="wuxing-item" v-for="wx in wuxingData" :key="wx.key">
  175. <text class="wuxing-label">{{ wx.label }}</text>
  176. <view class="wuxing-bar-track">
  177. <view class="wuxing-bar-fill" :style="{ width: wx.value + '%', background: wx.color }"></view>
  178. </view>
  179. <text class="wuxing-value">{{ wx.value }}%</text>
  180. </view>
  181. </view>
  182. <view class="wuxing-reading" v-if="traditionalData.wuxingReading">
  183. <text>{{ traditionalData.wuxingReading.personalTrait || '' }}</text>
  184. </view>
  185. </view>
  186. <!-- 太阳星座 + 生命灵数 双栏 -->
  187. <view class="culture-dual">
  188. <view class="culture-dual-item" v-if="traditionalData.zodiac">
  189. <text class="culture-dual-icon">&#x2600;</text>
  190. <text class="culture-dual-label">太阳星座</text>
  191. <text class="culture-dual-value">{{ traditionalData.zodiac }}</text>
  192. </view>
  193. <view class="culture-dual-item" v-if="traditionalData.numSoul">
  194. <text class="culture-dual-icon">&#x1F52E;</text>
  195. <text class="culture-dual-label">生命灵数</text>
  196. <text class="culture-dual-value">{{ traditionalData.lifeNumber || '' }}</text>
  197. </view>
  198. </view>
  199. <!-- 查看家庭天盘入口 -->
  200. <view class="culture-card" style="text-align:center; padding:16rpx;" @click="onFuncClick({needLogin:true, page:'/pages/mind-detail/family-dashboard'})">
  201. <text style="font-size:24rpx; color:#8B5CF6;">查看家庭天盘 &#x2192;</text>
  202. </view>
  203. </view>
  204. <!-- ===== 底部:维度任务/活动/商品 ===== -->
  205. <DimensionTasks
  206. v-if="isLoggedIn"
  207. :dimensionCode="currentDimensionCode"
  208. :tasks="dimensionTasks"
  209. @taskClick="onTaskClick"
  210. @moreTasks="goTasks" />
  211. <DimensionActivities
  212. :dimensionCode="currentDimensionCode"
  213. :activities="dimensionActivities"
  214. :isLoggedIn="isLoggedIn"
  215. @activityClick="goActivityDetail"
  216. @moreActivities="goMoreActivities" />
  217. <DimensionProducts
  218. :dimensionCode="currentDimensionCode"
  219. :products="dimensionProducts"
  220. @productClick="goProductDetail"
  221. @moreProducts="goMoreProducts" />
  222. <!-- ===== Phase 1.2: 心理告警横幅 ===== -->
  223. <PsychCrisisBanner v-if="isLoggedIn" :childId="currentChildId" source="screening" />
  224. <!-- ===== 底部:功能入口 Grid(通用,两行) ===== -->
  225. <view class="func-section" v-if="sectionVisible('func_entries')">
  226. <view class="func-grid">
  227. <view class="func-row">
  228. <view class="func-item" v-for="item in funcListRow1" :key="item.label" @click="onFuncClick(item)">
  229. <view class="func-icon-wrap">
  230. <text class="func-icon">{{ item.icon }}</text>
  231. </view>
  232. <text class="func-label">{{ item.label }}</text>
  233. </view>
  234. </view>
  235. <view class="func-row">
  236. <view class="func-item" v-for="item in funcListRow2" :key="item.label" @click="onFuncClick(item)">
  237. <view class="func-icon-wrap">
  238. <text class="func-icon">{{ item.icon }}</text>
  239. </view>
  240. <text class="func-label">{{ item.label }}</text>
  241. </view>
  242. </view>
  243. </view>
  244. </view>
  245. <!-- 底部占位 -->
  246. <view class="bottom-spacer"></view>
  247. <AIFloatingAvatar />
  248. </view>
  249. </template>
  250. <script>
  251. import TabTransition from '../../components/tab-transition.vue'
  252. import PageBanner from '../../components/PageBanner.vue'
  253. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  254. import RadarChart from '../../components/RadarChart.vue'
  255. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  256. import UserQuickEntry from '../../components/UserQuickEntry.vue'
  257. import DimensionTasks from '../../components/DimensionTasks.vue'
  258. import DimensionActivities from '../../components/DimensionActivities.vue'
  259. import DimensionProducts from '../../components/DimensionProducts.vue'
  260. import DimensionArticles from '../../components/DimensionArticles.vue'
  261. import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
  262. import PsychCrisisBanner from '../../components/PsychCrisisBanner.vue'
  263. import AIFloatingAvatar from '../../components/AIFloatingAvatar.vue'
  264. import { getVisibleSections, getFeaturedArticles, getEmiReport, getDailyTip, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren, getVisibleFamilyMembers, getEnergyOverview } from '../../utils/api.js'
  265. import config from '../../config.js'
  266. export default {
  267. components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnergyBar, UserQuickEntry, DimensionTasks, DimensionActivities, DimensionProducts, DimensionArticles, FamilyRelationGraph, PsychCrisisBanner, AIFloatingAvatar },
  268. data() {
  269. return {
  270. isLoggedIn: false,
  271. role: null,
  272. showTabTransition: true,
  273. currentChildId: null,
  274. visibleSections: [],
  275. familyMembersVisible: [],
  276. // 心理 Tab 数据
  277. emiData: null,
  278. emiLoading: true,
  279. personalityDimensions: [
  280. { key: 'opennessScore', label: '开放性' },
  281. { key: 'conscientiousnessScore', label: '尽责性' },
  282. { key: 'extraversionScore', label: '外向性' },
  283. { key: 'agreeablenessScore', label: '宜人性' },
  284. { key: 'neuroticismScore', label: '神经质' }
  285. ],
  286. dailyTip: {
  287. title: '成长型思维',
  288. content: '拥有成长型思维的孩子相信自己的能力可以通过努力提升,他们更愿意接受挑战,从失败中学习。作为家长,多鼓励孩子的努力而非天赋,可以帮助孩子建立成长型思维。',
  289. source: '—— 卡罗尔·德韦克《终身成长》'
  290. },
  291. emiDimensions: [
  292. { key: 'emotionScore', label: '情绪商数', color: '#FF6B35' },
  293. { key: 'resilienceScore', label: '心理韧性', color: '#F97316' },
  294. { key: 'stressCopingScore', label: '压力应对', color: '#FB923C' },
  295. { key: 'selfAwarenessScore', label: '自我认知', color: '#FBBF24' }
  296. ],
  297. // 功能入口
  298. funcList: [
  299. { icon: '\u{1F4D6}', label: '阅读', needLogin: false, page: '/pages/mind/articles' },
  300. { icon: '\u{1F4CA}', label: '测评报告', needLogin: true, page: '/pages/mind/emotion-report' },
  301. { icon: '\u{1F4DD}', label: '成长档案', needLogin: true, page: '/pages/growth/index' },
  302. { icon: '\u{2728}', label: '情绪打卡', needLogin: true, page: '/pages/mind-detail/emotion-checkin' },
  303. { icon: '\u{1F4C8}', label: '情绪趋势', needLogin: true, page: '/pages/mind-detail/emotion-trend' },
  304. { icon: '\u{1F9E9}', label: '心理自评', needLogin: true, page: '/pages/mind-detail/screening' },
  305. { icon: '\u{1F3E0}', label: '家庭天盘', needLogin: true, page: '/pages/mind-detail/family-dashboard' },
  306. { icon: '\u{1F9D8}', label: '疏导工具', needLogin: true, page: '/pages/mind-detail/soothe-toolbox' }
  307. ],
  308. articles: [],
  309. // 肠脑轴数据
  310. gutIndicators: null,
  311. gutInsight: '',
  312. // 传统文化数据
  313. traditionalData: null,
  314. traditionalLoading: true,
  315. compatibilityData: null,
  316. wuxingConfig: {
  317. wood: { label: '木', color: '#10B981' },
  318. fire: { label: '火', color: '#FF6B9D' },
  319. earth: { label: '土', color: '#FF8C42' },
  320. metal: { label: '金', color: '#6366F1' },
  321. water: { label: '水', color: '#3B82F6' }
  322. },
  323. pillarLabels: { year: '年柱', month: '月柱', day: '日柱', hour: '时柱' },
  324. familyScore: 0,
  325. // 五维组件数据
  326. userName: '',
  327. children: [],
  328. sandboxData: null,
  329. dimensionTasks: [],
  330. dimensionActivities: [],
  331. dimensionProducts: []
  332. }
  333. },
  334. computed: {
  335. personalityScores: function() {
  336. if (!this.emiData) return []
  337. return [
  338. this.emiData.opennessScore || 0,
  339. this.emiData.conscientiousnessScore || 0,
  340. this.emiData.extraversionScore || 0,
  341. this.emiData.agreeablenessScore || 0,
  342. this.emiData.neuroticismScore || 0
  343. ]
  344. },
  345. energyMapForGraph: function() {
  346. var map = {}
  347. if (this.sandboxData && this.sandboxData.members) {
  348. for (var i = 0; i < this.sandboxData.members.length; i++) {
  349. var m = this.sandboxData.members[i]
  350. map[m.memberId || m.id] = {
  351. bodyScore: m.bodyScore || 0,
  352. mindScore: m.mindScore || 0,
  353. actionScore: m.actionScore || 0
  354. }
  355. }
  356. }
  357. return map
  358. },
  359. intimacyMapForGraph: function() {
  360. return {}
  361. },
  362. compatibilityMapForGraph: function() {
  363. var map = {}
  364. if (this.compatibilityData && this.compatibilityData.relationships) {
  365. for (var i = 0; i < this.compatibilityData.relationships.length; i++) {
  366. var r = this.compatibilityData.relationships[i]
  367. var key = r.memberId1 < r.memberId2 ? r.memberId1 + '-' + r.memberId2 : r.memberId2 + '-' + r.memberId1
  368. map[key] = { overallScore: r.overallScore }
  369. }
  370. }
  371. return map
  372. },
  373. emotionArticles: function() {
  374. if (!this.articles || this.articles.length === 0) return []
  375. var result = []
  376. for (var i = 0; i < this.articles.length; i++) {
  377. var a = this.articles[i]
  378. if (a.relatedDimensions && a.relatedDimensions.indexOf('mind') !== -1) {
  379. result.push(a)
  380. }
  381. }
  382. if (result.length === 0) return this.articles.slice(0, 5)
  383. return result.slice(0, 5)
  384. },
  385. wuxingData: function() {
  386. if (!this.traditionalData || !this.traditionalData.wuxingElements) return []
  387. var elements = this.traditionalData.wuxingElements
  388. var keys = ['wood', 'fire', 'earth', 'metal', 'water']
  389. var result = []
  390. for (var i = 0; i < keys.length; i++) {
  391. var k = keys[i]
  392. if (elements[k] !== undefined) {
  393. result.push({
  394. key: k,
  395. label: this.wuxingConfig[k].label,
  396. color: this.wuxingConfig[k].color,
  397. value: elements[k]
  398. })
  399. }
  400. }
  401. return result.sort(function(a, b) { return b.value - a.value })
  402. },
  403. currentDimensionCode: function() {
  404. return 'mind'
  405. },
  406. funcListRow1: function() {
  407. return this.funcList.slice(0, 4)
  408. },
  409. funcListRow2: function() {
  410. return this.funcList.slice(4)
  411. }
  412. },
  413. onShow() {
  414. // Tabbar 切换过渡动画(最少停留 1 秒)
  415. this.showTabTransition = true
  416. var self = this
  417. setTimeout(function() {
  418. self.showTabTransition = false
  419. }, 1800)
  420. var token = uni.getStorageSync('token')
  421. this.isLoggedIn = !!token
  422. if (this.isLoggedIn) {
  423. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  424. this.currentChildId = uni.getStorageSync('currentChildId') || null
  425. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  426. }
  427. this.loadSectionConfig()
  428. this.loadFeaturedArticles()
  429. this.loadDailyTip()
  430. if (this.isLoggedIn) {
  431. this.loadChildren()
  432. this.loadFamilyMembersVisible()
  433. this.loadSandboxData()
  434. this.loadEmiData()
  435. this.loadGutData()
  436. this.loadEnergyData()
  437. this.loadTraditionalCultureData()
  438. }
  439. // 游客也能浏览活动和商品
  440. this.loadDimensionActivities()
  441. this.loadDimensionProducts()
  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. var dimCode = this.currentDimensionCode
  749. uni.navigateTo({ url: '/pages/discover/index?type=product&domain=' + dimCode })
  750. },
  751. goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  752. goMemberDetail: function(member) {
  753. if (!member || !member.memberId) return
  754. var currentId = this.currentChildId
  755. uni.navigateTo({
  756. url: '/pages/mind-detail/duo-compatibility?memberId1=' + currentId + '&memberId2=' + member.memberId
  757. })
  758. },
  759. goAssessment: function() { uni.navigateTo({ url: '/pages/assessment/apply' }) },
  760. goLogin: function() { uni.navigateTo({ url: '/pages/login/login' }) },
  761. // ===== 传统文化数据 =====
  762. loadTraditionalCultureData: function() {
  763. var self = this
  764. var memberId = this.currentChildId
  765. if (!memberId) {
  766. self.traditionalLoading = false
  767. return
  768. }
  769. self.traditionalLoading = true
  770. uni.request({
  771. url: config.API_BASE_URL + '/api/mind/traditional/mirror',
  772. method: 'POST',
  773. data: { memberId: memberId, memberType: 'child' },
  774. success: function(res) {
  775. self.traditionalLoading = false
  776. if (res.data && res.data.code === 200 && res.data.data) {
  777. var d = res.data.data
  778. if (d.eightCharacters || d.wuxingElements || d.zodiac || d.numSoul) {
  779. self.traditionalData = d
  780. } else {
  781. self.traditionalData = null
  782. }
  783. } else {
  784. self.traditionalData = null
  785. }
  786. },
  787. fail: function() {
  788. self.traditionalLoading = false
  789. self.traditionalData = null
  790. }
  791. })
  792. }
  793. }
  794. }
  795. </script>
  796. <style scoped>
  797. .container {
  798. min-height: 100vh;
  799. background: #f5f7fa;
  800. padding-bottom: 120rpx;
  801. }
  802. /* ===== 心·心理 标题栏 ===== */
  803. .section-title-bar {
  804. display: flex;
  805. flex-direction: row;
  806. align-items: center;
  807. margin: 20rpx 30rpx 10rpx;
  808. padding: 16rpx 24rpx;
  809. background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  810. border-radius: 20rpx;
  811. box-shadow: 0 4rpx 16rpx rgba(139,92,246,0.25);
  812. }
  813. .section-title-icon {
  814. font-size: 32rpx;
  815. color: #fff;
  816. margin-right: 12rpx;
  817. }
  818. .section-title-text {
  819. font-size: 32rpx;
  820. font-weight: bold;
  821. color: #fff;
  822. }
  823. /* ===== 心理能量概况 ===== */
  824. .energy-overview {
  825. display: flex;
  826. flex-direction: row;
  827. margin: 20rpx 30rpx;
  828. background: #fff;
  829. border-radius: 20rpx;
  830. padding: 24rpx 16rpx;
  831. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  832. justify-content: space-around;
  833. }
  834. .energy-badge {
  835. display: flex;
  836. flex-direction: column;
  837. align-items: center;
  838. flex: 1;
  839. }
  840. .badge-icon {
  841. font-size: 36rpx;
  842. margin-bottom: 8rpx;
  843. }
  844. .badge-value {
  845. font-size: 36rpx;
  846. font-weight: bold;
  847. color: #333;
  848. }
  849. .badge-label {
  850. font-size: 20rpx;
  851. color: #999;
  852. margin-top: 4rpx;
  853. }
  854. /* ===== EMI 四维条形图 ===== */
  855. .emi-section {
  856. margin: 20rpx 30rpx;
  857. }
  858. .emi-card {
  859. background: #fff;
  860. border-radius: 24rpx;
  861. padding: 30rpx;
  862. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  863. }
  864. .emi-card-title {
  865. font-size: 30rpx;
  866. font-weight: bold;
  867. color: #333;
  868. margin-bottom: 24rpx;
  869. display: block;
  870. }
  871. .emi-bar-item {
  872. display: flex;
  873. flex-direction: row;
  874. align-items: center;
  875. margin-bottom: 20rpx;
  876. }
  877. .emi-bar-label {
  878. font-size: 24rpx;
  879. color: #666;
  880. width: 120rpx;
  881. flex-shrink: 0;
  882. }
  883. .emi-bar-track {
  884. flex: 1;
  885. height: 20rpx;
  886. background: #f0f0f0;
  887. border-radius: 10rpx;
  888. overflow: hidden;
  889. margin: 0 16rpx;
  890. }
  891. .emi-bar-fill {
  892. height: 100%;
  893. border-radius: 10rpx;
  894. transition: width 0.5s;
  895. }
  896. .emi-bar-score {
  897. font-size: 26rpx;
  898. font-weight: bold;
  899. color: #333;
  900. width: 60rpx;
  901. text-align: right;
  902. flex-shrink: 0;
  903. }
  904. .emi-bar-level {
  905. font-size: 20rpx;
  906. width: 80rpx;
  907. text-align: right;
  908. flex-shrink: 0;
  909. }
  910. .level-excellent { color: #10B981; }
  911. .level-good { color: #3B82F6; }
  912. .level-average { color: #F97316; }
  913. .level-low { color: #EF4444; }
  914. .emi-footer {
  915. display: flex;
  916. flex-direction: row;
  917. justify-content: space-between;
  918. align-items: center;
  919. margin-top: 20rpx;
  920. padding-top: 20rpx;
  921. border-top: 1rpx solid #f0f0f0;
  922. }
  923. .emi-overall {
  924. font-size: 28rpx;
  925. font-weight: bold;
  926. color: #FF6B35;
  927. }
  928. .emi-link {
  929. display: flex;
  930. flex-direction: row;
  931. align-items: center;
  932. }
  933. .emi-link-text {
  934. font-size: 26rpx;
  935. color: #FF6B35;
  936. font-weight: 500;
  937. }
  938. .emi-link-arrow {
  939. font-size: 26rpx;
  940. color: #FF6B35;
  941. margin-left: 8rpx;
  942. }
  943. /* ===== 占位卡 ===== */
  944. .placeholder-card {
  945. margin: 30rpx;
  946. background: #fff;
  947. border-radius: 24rpx;
  948. padding: 60rpx 40rpx;
  949. display: flex;
  950. flex-direction: column;
  951. align-items: center;
  952. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  953. }
  954. .placeholder-icon {
  955. font-size: 80rpx;
  956. margin-bottom: 20rpx;
  957. }
  958. .placeholder-title {
  959. font-size: 32rpx;
  960. font-weight: bold;
  961. color: #333;
  962. margin-bottom: 16rpx;
  963. }
  964. .placeholder-desc {
  965. font-size: 26rpx;
  966. color: #999;
  967. text-align: center;
  968. line-height: 1.6;
  969. margin-bottom: 30rpx;
  970. }
  971. .placeholder-btn {
  972. background: linear-gradient(135deg, #FF6B35, #FFD700);
  973. color: #fff;
  974. font-size: 28rpx;
  975. font-weight: bold;
  976. padding: 16rpx 64rpx;
  977. border-radius: 40rpx;
  978. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  979. }
  980. /* ===== 传统文化卡片 ===== */
  981. .culture-section {
  982. margin: 20rpx 30rpx;
  983. }
  984. .culture-card {
  985. background: #fff;
  986. border-radius: 20rpx;
  987. padding: 24rpx;
  988. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  989. margin-bottom: 16rpx;
  990. }
  991. .culture-card-header {
  992. display: flex;
  993. align-items: center;
  994. margin-bottom: 16rpx;
  995. }
  996. .culture-card-icon {
  997. font-size: 32rpx;
  998. margin-right: 10rpx;
  999. }
  1000. .culture-card-title {
  1001. font-size: 28rpx;
  1002. font-weight: 600;
  1003. color: #333;
  1004. }
  1005. .culture-card-body {
  1006. font-size: 24rpx;
  1007. color: #666;
  1008. line-height: 1.6;
  1009. }
  1010. /* 八字四柱 */
  1011. .bazi-grid {
  1012. display: flex;
  1013. justify-content: space-around;
  1014. padding: 8rpx 0;
  1015. }
  1016. .bazi-column {
  1017. display: flex;
  1018. flex-direction: column;
  1019. align-items: center;
  1020. }
  1021. .bazi-pillar-label {
  1022. font-size: 22rpx;
  1023. color: #999;
  1024. margin-bottom: 6rpx;
  1025. }
  1026. .bazi-pillar-value {
  1027. font-size: 32rpx;
  1028. font-weight: 700;
  1029. color: #8B5CF6;
  1030. background: #F5F0FF;
  1031. padding: 10rpx 14rpx;
  1032. border-radius: 10rpx;
  1033. }
  1034. /* 五行能量 */
  1035. .wuxing-list {
  1036. display: flex;
  1037. flex-direction: column;
  1038. gap: 12rpx;
  1039. }
  1040. .wuxing-item {
  1041. display: flex;
  1042. align-items: center;
  1043. gap: 12rpx;
  1044. }
  1045. .wuxing-label {
  1046. font-size: 26rpx;
  1047. font-weight: 600;
  1048. width: 44rpx;
  1049. text-align: center;
  1050. }
  1051. .wuxing-bar-track {
  1052. flex: 1;
  1053. height: 20rpx;
  1054. background: #F0F0F0;
  1055. border-radius: 10rpx;
  1056. overflow: hidden;
  1057. }
  1058. .wuxing-bar-fill {
  1059. height: 100%;
  1060. border-radius: 10rpx;
  1061. }
  1062. .wuxing-value {
  1063. font-size: 22rpx;
  1064. color: #666;
  1065. width: 56rpx;
  1066. text-align: right;
  1067. }
  1068. .wuxing-reading {
  1069. margin-top: 12rpx;
  1070. padding: 12rpx 14rpx;
  1071. background: #F8F6F0;
  1072. border-radius: 12rpx;
  1073. font-size: 24rpx;
  1074. color: #666;
  1075. line-height: 1.5;
  1076. }
  1077. /* 星座+灵数双栏 */
  1078. .culture-dual {
  1079. display: flex;
  1080. gap: 16rpx;
  1081. }
  1082. .culture-dual-item {
  1083. flex: 1;
  1084. background: #fff;
  1085. border-radius: 20rpx;
  1086. padding: 20rpx;
  1087. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1088. display: flex;
  1089. flex-direction: column;
  1090. align-items: center;
  1091. }
  1092. .culture-dual-icon {
  1093. font-size: 36rpx;
  1094. margin-bottom: 8rpx;
  1095. }
  1096. .culture-dual-label {
  1097. font-size: 22rpx;
  1098. color: #999;
  1099. margin-bottom: 6rpx;
  1100. }
  1101. .culture-dual-value {
  1102. font-size: 28rpx;
  1103. font-weight: 700;
  1104. color: #8B5CF6;
  1105. }
  1106. .culture-empty {
  1107. text-align: center;
  1108. padding: 30rpx 0;
  1109. color: #bbb;
  1110. font-size: 24rpx;
  1111. }
  1112. /* ===== 每日心理 ===== */
  1113. .tip-card {
  1114. background: #fff;
  1115. border-radius: 20rpx;
  1116. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1117. display: flex;
  1118. flex-direction: row;
  1119. overflow: hidden;
  1120. }
  1121. .tip-left-bar {
  1122. width: 6rpx;
  1123. background: linear-gradient(180deg, #5B9BD5, #8FC5E8);
  1124. flex-shrink: 0;
  1125. }
  1126. .tip-body {
  1127. flex: 1;
  1128. padding: 28rpx 24rpx;
  1129. }
  1130. .tip-title {
  1131. font-size: 28rpx;
  1132. font-weight: bold;
  1133. color: #5B9BD5;
  1134. display: block;
  1135. margin-bottom: 12rpx;
  1136. }
  1137. .tip-content {
  1138. font-size: 24rpx;
  1139. color: #666;
  1140. line-height: 1.6;
  1141. display: block;
  1142. margin-bottom: 16rpx;
  1143. }
  1144. .tip-footer {
  1145. display: flex;
  1146. flex-direction: row;
  1147. justify-content: flex-end;
  1148. }
  1149. .tip-source {
  1150. font-size: 22rpx;
  1151. color: #bbb;
  1152. }
  1153. /* ===== 通用区块 ===== */
  1154. .section {
  1155. margin: 20rpx 30rpx;
  1156. }
  1157. .section-header {
  1158. margin-bottom: 20rpx;
  1159. }
  1160. .section-title {
  1161. font-size: 30rpx;
  1162. font-weight: bold;
  1163. color: #333;
  1164. }
  1165. /* ===== 推荐阅读 ===== */
  1166. .article-list {
  1167. display: flex;
  1168. flex-direction: column;
  1169. }
  1170. .article-card {
  1171. background: #fff;
  1172. border-radius: 20rpx;
  1173. padding: 28rpx 24rpx;
  1174. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1175. margin-bottom: 20rpx;
  1176. }
  1177. .article-category {
  1178. display: inline-block;
  1179. padding: 4rpx 18rpx;
  1180. border-radius: 20rpx;
  1181. margin-bottom: 14rpx;
  1182. }
  1183. .article-category-text {
  1184. font-size: 20rpx;
  1185. color: #fff;
  1186. font-weight: 500;
  1187. }
  1188. .article-title {
  1189. font-size: 28rpx;
  1190. font-weight: bold;
  1191. color: #333;
  1192. display: block;
  1193. margin-bottom: 10rpx;
  1194. }
  1195. .article-summary {
  1196. font-size: 24rpx;
  1197. color: #888;
  1198. line-height: 1.5;
  1199. display: block;
  1200. margin-bottom: 20rpx;
  1201. }
  1202. .article-meta {
  1203. display: flex;
  1204. flex-direction: row;
  1205. align-items: center;
  1206. justify-content: space-between;
  1207. }
  1208. .meta-item {
  1209. display: flex;
  1210. flex-direction: row;
  1211. align-items: center;
  1212. margin-right: 20rpx;
  1213. }
  1214. .meta-icon {
  1215. font-size: 22rpx;
  1216. margin-right: 4rpx;
  1217. }
  1218. .meta-text {
  1219. font-size: 22rpx;
  1220. color: #bbb;
  1221. }
  1222. .article-date {
  1223. font-size: 22rpx;
  1224. color: #bbb;
  1225. margin-left: auto;
  1226. }
  1227. /* ===== 功能区入口 ===== */
  1228. .func-section {
  1229. margin: 20rpx 30rpx;
  1230. }
  1231. .func-grid {
  1232. display: flex;
  1233. flex-direction: column;
  1234. gap: 16rpx;
  1235. background: #fff;
  1236. border-radius: 20rpx;
  1237. padding: 24rpx 16rpx;
  1238. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1239. }
  1240. .func-row {
  1241. display: flex;
  1242. flex-direction: row;
  1243. justify-content: space-between;
  1244. }
  1245. .func-item {
  1246. display: flex;
  1247. flex-direction: column;
  1248. align-items: center;
  1249. flex: 1;
  1250. }
  1251. .func-icon-wrap {
  1252. width: 80rpx;
  1253. height: 80rpx;
  1254. border-radius: 40rpx;
  1255. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  1256. display: flex;
  1257. align-items: center;
  1258. justify-content: center;
  1259. margin-bottom: 10rpx;
  1260. }
  1261. .func-icon {
  1262. font-size: 40rpx;
  1263. }
  1264. .func-label {
  1265. font-size: 22rpx;
  1266. color: #666;
  1267. font-weight: 500;
  1268. }
  1269. .func-item:active {
  1270. opacity: 0.7;
  1271. }
  1272. /* ===== 底部 ===== */
  1273. .bottom-spacer {
  1274. height: 120rpx;
  1275. }
  1276. /* ===== 肠脑轴 ===== */
  1277. .gut-insight-text {
  1278. font-size: 24rpx;
  1279. color: #666;
  1280. margin-bottom: 16rpx;
  1281. padding: 12rpx 16rpx;
  1282. background: #F0FFF4;
  1283. border-radius: 12rpx;
  1284. line-height: 1.6;
  1285. }
  1286. .gut-indicator-list {
  1287. display: flex;
  1288. flex-direction: column;
  1289. gap: 12rpx;
  1290. }
  1291. .gut-indicator-item {
  1292. display: flex;
  1293. align-items: center;
  1294. gap: 12rpx;
  1295. }
  1296. .gut-indicator-left {
  1297. width: 80rpx;
  1298. flex-shrink: 0;
  1299. }
  1300. .gut-indicator-name {
  1301. font-size: 22rpx;
  1302. color: #666;
  1303. }
  1304. .gut-indicator-bar-track {
  1305. flex: 1;
  1306. height: 16rpx;
  1307. background: #F0F0F0;
  1308. border-radius: 8rpx;
  1309. overflow: hidden;
  1310. }
  1311. .gut-indicator-bar-fill {
  1312. height: 100%;
  1313. border-radius: 8rpx;
  1314. transition: width 0.3s;
  1315. }
  1316. .gut-indicator-value {
  1317. font-size: 22rpx;
  1318. color: #666;
  1319. width: 60rpx;
  1320. text-align: right;
  1321. }
  1322. .gut-indicator-status {
  1323. font-size: 20rpx;
  1324. padding: 2rpx 12rpx;
  1325. border-radius: 10rpx;
  1326. width: 60rpx;
  1327. text-align: center;
  1328. }
  1329. .status-normal {
  1330. background: #D1FAE5;
  1331. color: #059669;
  1332. }
  1333. .status-abnormal {
  1334. background: #FEE2E2;
  1335. color: #DC2626;
  1336. }
  1337. .status-warning {
  1338. background: #FEF3C7;
  1339. color: #D97706;
  1340. }
  1341. </style>