index.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387
  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. <view class="section" v-if="sectionVisible('recommended_reading')">
  147. <view class="section-header">
  148. <text class="section-title">推荐阅读</text>
  149. </view>
  150. <view class="article-list">
  151. <view class="article-card" v-for="article in emotionArticles" :key="article.id" @click="goArticleDetail(article.id)">
  152. <view class="article-category" :style="{ background: article.categoryColor }">
  153. <text class="article-category-text">{{ article.category }}</text>
  154. </view>
  155. <text class="article-title">{{ article.title }}</text>
  156. <text class="article-summary">{{ article.summary }}</text>
  157. <view class="article-meta">
  158. <view class="meta-item">
  159. <text class="meta-icon">&#x1F4D6;</text>
  160. <text class="meta-text">{{ article.views }}</text>
  161. </view>
  162. <view class="meta-item">
  163. <text class="meta-icon">&#x1F44D;</text>
  164. <text class="meta-text">{{ article.likes }}</text>
  165. </view>
  166. <text class="article-date">{{ article.date }}</text>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. <!-- ===== 传统文化(八字/五行/星座/灵数) ===== -->
  172. <view class="culture-section" v-if="isLoggedIn && traditionalData">
  173. <!-- 八字四柱 -->
  174. <view class="culture-card" v-if="traditionalData.eightCharacters">
  175. <view class="culture-card-header">
  176. <text class="culture-card-icon">&#x2637;</text>
  177. <text class="culture-card-title">八字四柱</text>
  178. </view>
  179. <view class="bazi-grid">
  180. <view class="bazi-column" v-for="(val, key) in traditionalData.eightCharacters" :key="key">
  181. <text class="bazi-pillar-label">{{ pillarLabels[key] || key }}</text>
  182. <text class="bazi-pillar-value">{{ val }}</text>
  183. </view>
  184. </view>
  185. </view>
  186. <!-- 五行能量 -->
  187. <view class="culture-card" v-if="traditionalData.wuxingElements">
  188. <view class="culture-card-header">
  189. <text class="culture-card-icon">&#x267E;</text>
  190. <text class="culture-card-title">五行能量</text>
  191. </view>
  192. <view class="wuxing-list">
  193. <view class="wuxing-item" v-for="wx in wuxingData" :key="wx.key">
  194. <text class="wuxing-label">{{ wx.label }}</text>
  195. <view class="wuxing-bar-track">
  196. <view class="wuxing-bar-fill" :style="{ width: wx.value + '%', background: wx.color }"></view>
  197. </view>
  198. <text class="wuxing-value">{{ wx.value }}%</text>
  199. </view>
  200. </view>
  201. <view class="wuxing-reading" v-if="traditionalData.wuxingReading">
  202. <text>{{ traditionalData.wuxingReading.personalTrait || '' }}</text>
  203. </view>
  204. </view>
  205. <!-- 太阳星座 + 生命灵数 双栏 -->
  206. <view class="culture-dual">
  207. <view class="culture-dual-item" v-if="traditionalData.zodiac">
  208. <text class="culture-dual-icon">&#x2600;</text>
  209. <text class="culture-dual-label">太阳星座</text>
  210. <text class="culture-dual-value">{{ traditionalData.zodiac }}</text>
  211. </view>
  212. <view class="culture-dual-item" v-if="traditionalData.numSoul">
  213. <text class="culture-dual-icon">&#x1F52E;</text>
  214. <text class="culture-dual-label">生命灵数</text>
  215. <text class="culture-dual-value">{{ traditionalData.lifeNumber || '' }}</text>
  216. </view>
  217. </view>
  218. <!-- 查看家庭天盘入口 -->
  219. <view class="culture-card" style="text-align:center; padding:16rpx;" @click="onFuncClick({needLogin:true, page:'/pages/mind-detail/family-dashboard'})">
  220. <text style="font-size:24rpx; color:#8B5CF6;">查看家庭天盘 &#x2192;</text>
  221. </view>
  222. </view>
  223. <!-- ===== 底部:维度任务/活动/商品 ===== -->
  224. <DimensionTasks
  225. v-if="isLoggedIn"
  226. :dimensionCode="currentDimensionCode"
  227. :tasks="dimensionTasks"
  228. @taskClick="onTaskClick"
  229. @moreTasks="goTasks" />
  230. <DimensionActivities
  231. :dimensionCode="currentDimensionCode"
  232. :activities="dimensionActivities"
  233. @activityClick="goActivityDetail"
  234. @moreActivities="goMoreActivities" />
  235. <DimensionProducts
  236. :dimensionCode="currentDimensionCode"
  237. :products="dimensionProducts"
  238. @productClick="goProductDetail"
  239. @moreProducts="goMoreProducts" />
  240. <!-- ===== Phase 1.2: 心理告警横幅 ===== -->
  241. <PsychCrisisBanner v-if="isLoggedIn" :childId="currentChildId" source="screening" />
  242. <!-- ===== 底部:功能入口 Grid(通用) ===== -->
  243. <view class="func-section" v-if="sectionVisible('func_entries')">
  244. <view class="func-grid">
  245. <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
  246. <view class="func-icon-wrap">
  247. <text class="func-icon">{{ item.icon }}</text>
  248. </view>
  249. <text class="func-label">{{ item.label }}</text>
  250. </view>
  251. </view>
  252. </view>
  253. <!-- 底部占位 -->
  254. <view class="bottom-spacer"></view>
  255. </view>
  256. </template>
  257. <script>
  258. import TabTransition from '../../components/tab-transition.vue'
  259. import PageBanner from '../../components/PageBanner.vue'
  260. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  261. import RadarChart from '../../components/RadarChart.vue'
  262. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  263. import UserQuickEntry from '../../components/UserQuickEntry.vue'
  264. import DimensionTasks from '../../components/DimensionTasks.vue'
  265. import DimensionActivities from '../../components/DimensionActivities.vue'
  266. import DimensionProducts from '../../components/DimensionProducts.vue'
  267. import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
  268. import PsychCrisisBanner from '../../components/PsychCrisisBanner.vue'
  269. import { getVisibleSections, getFeaturedArticles, getEmiReport, getDailyTip, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren, getVisibleFamilyMembers, getEnergyOverview } from '../../utils/api.js'
  270. import config from '../../config.js'
  271. export default {
  272. components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnergyBar, UserQuickEntry, DimensionTasks, DimensionActivities, DimensionProducts, FamilyRelationGraph, PsychCrisisBanner },
  273. data() {
  274. return {
  275. isLoggedIn: false,
  276. role: null,
  277. showTabTransition: false,
  278. currentChildId: null,
  279. visibleSections: [],
  280. familyMembersVisible: [],
  281. // 心理 Tab 数据
  282. emiData: null,
  283. emiLoading: true,
  284. personalityDimensions: [
  285. { key: 'opennessScore', label: '开放性' },
  286. { key: 'conscientiousnessScore', label: '尽责性' },
  287. { key: 'extraversionScore', label: '外向性' },
  288. { key: 'agreeablenessScore', label: '宜人性' },
  289. { key: 'neuroticismScore', label: '神经质' }
  290. ],
  291. dailyTip: {
  292. title: '成长型思维',
  293. content: '拥有成长型思维的孩子相信自己的能力可以通过努力提升,他们更愿意接受挑战,从失败中学习。作为家长,多鼓励孩子的努力而非天赋,可以帮助孩子建立成长型思维。',
  294. source: '—— 卡罗尔·德韦克《终身成长》'
  295. },
  296. emiDimensions: [
  297. { key: 'emotionScore', label: '情绪商数', color: '#FF6B35' },
  298. { key: 'resilienceScore', label: '心理韧性', color: '#F97316' },
  299. { key: 'stressCopingScore', label: '压力应对', color: '#FB923C' },
  300. { key: 'selfAwarenessScore', label: '自我认知', color: '#FBBF24' }
  301. ],
  302. // 功能入口
  303. funcList: [
  304. { icon: '\u{1F4D6}', label: '阅读', needLogin: false, page: '/pages/mind/articles' },
  305. { icon: '\u{1F4CA}', label: '测评报告', needLogin: true, page: '/pages/mind/emotion-report' },
  306. { icon: '\u{1F4DD}', label: '成长档案', needLogin: true, page: '/pages/growth/index' },
  307. { icon: '\u{2728}', label: '情绪打卡', needLogin: true, page: '/pages/mind-detail/emotion-checkin' },
  308. { icon: '\u{1F4C8}', label: '情绪趋势', needLogin: true, page: '/pages/mind-detail/emotion-trend' },
  309. { icon: '\u{1F9E9}', label: '心理自评', needLogin: true, page: '/pages/mind-detail/screening' },
  310. { icon: '\u{1F3E0}', label: '家庭天盘', needLogin: true, page: '/pages/mind-detail/family-dashboard' },
  311. { icon: '\u{1F9D8}', label: '疏导工具', needLogin: true, page: '/pages/mind-detail/soothe-toolbox' }
  312. ],
  313. articles: [],
  314. // 肠脑轴数据
  315. gutIndicators: null,
  316. gutInsight: '',
  317. // 传统文化数据
  318. traditionalData: null,
  319. traditionalLoading: true,
  320. compatibilityData: null,
  321. wuxingConfig: {
  322. wood: { label: '木', color: '#10B981' },
  323. fire: { label: '火', color: '#FF6B9D' },
  324. earth: { label: '土', color: '#FF8C42' },
  325. metal: { label: '金', color: '#6366F1' },
  326. water: { label: '水', color: '#3B82F6' }
  327. },
  328. pillarLabels: { year: '年柱', month: '月柱', day: '日柱', hour: '时柱' },
  329. familyScore: 0,
  330. // 五维组件数据
  331. userName: '',
  332. children: [],
  333. sandboxData: null,
  334. dimensionTasks: [],
  335. dimensionActivities: [],
  336. dimensionProducts: []
  337. }
  338. },
  339. computed: {
  340. personalityScores: function() {
  341. if (!this.emiData) return []
  342. return [
  343. this.emiData.opennessScore || 0,
  344. this.emiData.conscientiousnessScore || 0,
  345. this.emiData.extraversionScore || 0,
  346. this.emiData.agreeablenessScore || 0,
  347. this.emiData.neuroticismScore || 0
  348. ]
  349. },
  350. energyMapForGraph: function() {
  351. var map = {}
  352. if (this.sandboxData && this.sandboxData.members) {
  353. for (var i = 0; i < this.sandboxData.members.length; i++) {
  354. var m = this.sandboxData.members[i]
  355. map[m.memberId || m.id] = {
  356. bodyScore: m.bodyScore || 0,
  357. mindScore: m.mindScore || 0,
  358. actionScore: m.actionScore || 0
  359. }
  360. }
  361. }
  362. return map
  363. },
  364. intimacyMapForGraph: function() {
  365. return {}
  366. },
  367. compatibilityMapForGraph: function() {
  368. var map = {}
  369. if (this.compatibilityData && this.compatibilityData.relationships) {
  370. for (var i = 0; i < this.compatibilityData.relationships.length; i++) {
  371. var r = this.compatibilityData.relationships[i]
  372. var key = r.memberId1 < r.memberId2 ? r.memberId1 + '-' + r.memberId2 : r.memberId2 + '-' + r.memberId1
  373. map[key] = { overallScore: r.overallScore }
  374. }
  375. }
  376. return map
  377. },
  378. emotionArticles: function() {
  379. if (!this.articles || this.articles.length === 0) return []
  380. var result = []
  381. for (var i = 0; i < this.articles.length; i++) {
  382. var a = this.articles[i]
  383. if (a.relatedDimensions && a.relatedDimensions.indexOf('mind') !== -1) {
  384. result.push(a)
  385. }
  386. }
  387. if (result.length === 0) return this.articles.slice(0, 5)
  388. return result.slice(0, 5)
  389. },
  390. wuxingData: function() {
  391. if (!this.traditionalData || !this.traditionalData.wuxingElements) return []
  392. var elements = this.traditionalData.wuxingElements
  393. var keys = ['wood', 'fire', 'earth', 'metal', 'water']
  394. var result = []
  395. for (var i = 0; i < keys.length; i++) {
  396. var k = keys[i]
  397. if (elements[k] !== undefined) {
  398. result.push({
  399. key: k,
  400. label: this.wuxingConfig[k].label,
  401. color: this.wuxingConfig[k].color,
  402. value: elements[k]
  403. })
  404. }
  405. }
  406. return result.sort(function(a, b) { return b.value - a.value })
  407. },
  408. currentDimensionCode: function() {
  409. return 'mind'
  410. }
  411. },
  412. onShow() {
  413. // Tabbar 切换过渡动画(最少停留 1 秒)
  414. this.showTabTransition = true
  415. var self = this
  416. setTimeout(function() {
  417. self.showTabTransition = false
  418. }, 1100)
  419. var token = uni.getStorageSync('token')
  420. this.isLoggedIn = !!token
  421. if (this.isLoggedIn) {
  422. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  423. this.currentChildId = uni.getStorageSync('currentChildId') || null
  424. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  425. }
  426. this.loadSectionConfig()
  427. this.loadFeaturedArticles()
  428. this.loadDailyTip()
  429. if (this.isLoggedIn) {
  430. this.loadChildren()
  431. this.loadFamilyMembersVisible()
  432. this.loadSandboxData()
  433. this.loadEmiData()
  434. this.loadGutData()
  435. this.loadEnergyData()
  436. this.loadTraditionalCultureData()
  437. }
  438. // 游客也能浏览活动和商品
  439. this.loadDimensionActivities()
  440. this.loadDimensionProducts()
  441. },
  442. methods: {
  443. // ===== 区块可见性 =====
  444. loadSectionConfig: function() {
  445. var self = this
  446. var baseSections = ['func_entries', 'daily_tip', 'recommended_reading']
  447. if (!uni.getStorageSync('token')) {
  448. self.visibleSections = baseSections
  449. return
  450. }
  451. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  452. getVisibleSections({ pageKey: 'mind', role: role }).then(function(res) {
  453. if (res.code === 200 && res.data) {
  454. var keys = res.data.map(function(s) { return s.sectionKey })
  455. var merged = baseSections.slice()
  456. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  457. self.visibleSections = merged
  458. }
  459. }).catch(function() {
  460. self.visibleSections = ['func_entries', 'daily_tip', 'recommended_reading', 'mind_tasks', 'related_activities', 'purchased_courses']
  461. })
  462. },
  463. sectionVisible: function(key) {
  464. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  465. },
  466. // ===== 心理 Tab:EMI 数据 =====
  467. loadEmiData: function() {
  468. var self = this
  469. var childId = self.currentChildId
  470. if (!childId) {
  471. self.emiLoading = false
  472. return
  473. }
  474. self.emiLoading = true
  475. getEmiReport(childId).then(function(res) {
  476. if (res.code === 200 && res.data) {
  477. self.emiData = res.data
  478. }
  479. self.emiLoading = false
  480. }).catch(function() {
  481. self.emiLoading = false
  482. })
  483. },
  484. // ===== 每日心理 =====
  485. loadDailyTip: function() {
  486. var self = this
  487. getDailyTip().then(function(res) {
  488. if (res.code === 200 && res.data) {
  489. self.dailyTip = res.data
  490. }
  491. }).catch(function() {})
  492. },
  493. // ===== 肠脑轴情绪指标 =====
  494. loadGutData: function() {
  495. var self = this
  496. var childId = self.currentChildId
  497. if (!childId) return
  498. var token = uni.getStorageSync('token')
  499. // 获取神经递质指标
  500. uni.request({
  501. url: config.API_BASE_URL + '/api/mind/neurotransmitters',
  502. method: 'POST',
  503. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  504. data: { childId: childId },
  505. success: function(r) {
  506. if (r.statusCode === 200 && r.data && r.data.code === 200) {
  507. var list = r.data.data
  508. if (Array.isArray(list) && list.length > 0) {
  509. self.gutIndicators = list.slice(0, 4)
  510. }
  511. }
  512. }
  513. })
  514. // 获取情绪洞察摘要
  515. uni.request({
  516. url: config.API_BASE_URL + '/api/mind/gut-emotion-insight',
  517. method: 'POST',
  518. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  519. data: { childId: childId },
  520. success: function(r) {
  521. if (r.statusCode === 200 && r.data && r.data.code === 200 && r.data.data) {
  522. self.gutInsight = r.data.data.summary || ''
  523. }
  524. }
  525. })
  526. },
  527. indicatorColor: function(status) {
  528. if (status === 'abnormal' || status === '偏高' || status === '偏低') return '#EF4444'
  529. if (status === 'warning' || status === '偏高' || status === '偏低') return '#F59E0B'
  530. return '#10B981'
  531. },
  532. statusLabel: function(status) {
  533. if (status === 'normal') return '正常'
  534. if (status === 'abnormal') return '异常'
  535. if (status === 'warning') return '警讯'
  536. return status || '正常'
  537. },
  538. // ===== 文章 =====
  539. loadFeaturedArticles: function() {
  540. var self = this
  541. getFeaturedArticles({ size: 5 }).then(function(res) {
  542. if (res.code === 200 && res.data) {
  543. var gradientColors = [
  544. 'linear-gradient(135deg, #8B5CF6, #A78BFA)',
  545. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  546. 'linear-gradient(135deg, #10B981, #34D399)',
  547. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  548. 'linear-gradient(135deg, #F97316, #FB923C)'
  549. ]
  550. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  551. self.articles = list.map(function(item, index) {
  552. return {
  553. id: item.id,
  554. category: item.categoryName || '成长文章',
  555. categoryColor: gradientColors[index % gradientColors.length],
  556. title: item.title || '',
  557. summary: item.summary || '',
  558. views: item.viewCount ? String(item.viewCount) : '0',
  559. likes: '0',
  560. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  561. relatedDimensions: item.relatedDimensions || []
  562. }
  563. })
  564. }
  565. }).catch(function() {})
  566. },
  567. // ===== EMI 分数评级 =====
  568. getScoreLevel: function(score) {
  569. if (score >= 85) return 'excellent'
  570. if (score >= 70) return 'good'
  571. if (score >= 55) return 'average'
  572. return 'low'
  573. },
  574. getScoreLevelText: function(score) {
  575. if (score >= 85) return '优秀'
  576. if (score >= 70) return '良好'
  577. if (score >= 55) return '一般'
  578. return '需提升'
  579. },
  580. // ===== 导航 =====
  581. goEmotionReport: function() {
  582. var childId = this.currentChildId || ''
  583. uni.navigateTo({ url: '/pages/mind-detail/emotion-report?childId=' + childId })
  584. },
  585. goArticles: function() {
  586. uni.navigateTo({ url: '/pages/mind-detail/articles' })
  587. },
  588. onFuncClick: function(item) {
  589. if (item.needLogin && !this.isLoggedIn) {
  590. uni.showModal({
  591. title: '提示',
  592. content: '请先登录后使用此功能',
  593. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  594. })
  595. return
  596. }
  597. if (item.page) uni.navigateTo({ url: item.page })
  598. },
  599. goArticleDetail: function(id) {
  600. var url = '/pages/mind-detail/article-detail?id=' + id
  601. uni.navigateTo({ url: url })
  602. },
  603. // ===== 孩子列表与维度数据 =====
  604. loadChildren: function() {
  605. var self = this
  606. getChildren().then(function(res) {
  607. if (res.code === 200 && res.data) {
  608. self.children = res.data
  609. var savedChildId = uni.getStorageSync('currentChildId')
  610. var found = false
  611. for (var i = 0; i < self.children.length; i++) {
  612. if (self.children[i].childId === savedChildId) {
  613. self.currentChildId = savedChildId
  614. found = true
  615. break
  616. }
  617. }
  618. if (!found && self.children.length > 0) {
  619. self.currentChildId = self.children[0].childId
  620. uni.setStorageSync('currentChildId', self.currentChildId)
  621. }
  622. if (self.currentChildId) {
  623. self.loadDimensionData()
  624. }
  625. }
  626. }).catch(function(e) {
  627. console.log('获取孩子列表失败', e)
  628. })
  629. },
  630. loadDimensionData: function() {
  631. this.loadDimensionTasks()
  632. this.loadDimensionActivities()
  633. this.loadDimensionProducts()
  634. if (this.familyMembersVisible.length > 0) {
  635. this.loadCompatibilityData()
  636. }
  637. },
  638. loadSandboxData: function() {
  639. var self = this
  640. getFamilyEnergySandbox().then(function(res) {
  641. if (res && res.data) {
  642. self.sandboxData = res.data
  643. }
  644. }).catch(function() {})
  645. },
  646. loadEnergyData: function() {
  647. var self = this
  648. if (!this.currentChildId) return
  649. getEnergyOverview(this.currentChildId).then(function(res) {
  650. if (res && res.data) {
  651. var dims = res.data.dimensions
  652. if (dims && dims.length > 0) {
  653. for (var i = 0; i < dims.length; i++) {
  654. if (dims[i] && dims[i].code === 'mind' && res.data.energyScores) {
  655. self.familyScore = res.data.energyScores.mindScore || 0
  656. }
  657. }
  658. }
  659. }
  660. }).catch(function(e) {
  661. console.log('获取能量概览失败', e)
  662. })
  663. },
  664. loadDimensionTasks: function() {
  665. var self = this
  666. if (!this.currentChildId) return
  667. getTodayTasksByCategory(this.currentChildId, 'mind').then(function(res) {
  668. if (res && res.data) {
  669. self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
  670. }
  671. }).catch(function() { self.dimensionTasks = [] })
  672. },
  673. loadDimensionActivities: function() {
  674. var self = this
  675. var dimCode = self.currentDimensionCode
  676. getActivityList({ dimensionCode: dimCode, page: 1, size: 3 }).then(function(res) {
  677. if (res && res.data) {
  678. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  679. self.dimensionActivities = list.slice(0, 3)
  680. }
  681. }).catch(function() { self.dimensionActivities = [] })
  682. },
  683. loadDimensionProducts: function() {
  684. var self = this
  685. var dimCode = self.currentDimensionCode
  686. getProductsByDomain(dimCode, 1, 4).then(function(res) {
  687. if (res && res.data) {
  688. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  689. self.dimensionProducts = list.slice(0, 4)
  690. }
  691. }).catch(function() { self.dimensionProducts = [] })
  692. },
  693. onChildChanged: function(child) {
  694. this.currentChildId = child.childId
  695. uni.setStorageSync('currentChildId', child.childId)
  696. this.loadDimensionData()
  697. this.loadEmiData()
  698. this.loadTraditionalCultureData()
  699. },
  700. loadFamilyMembersVisible: function() {
  701. var self = this
  702. getVisibleFamilyMembers().then(function(res) {
  703. self.familyMembersVisible = res.data || []
  704. }).catch(function(e) {
  705. console.log('获取可见家庭成员失败', e)
  706. self.familyMembersVisible = []
  707. })
  708. },
  709. loadCompatibilityData: function() {
  710. var self = this
  711. var familyId = uni.getStorageSync('currentFamilyId')
  712. if (!familyId) {
  713. var userInfo = uni.getStorageSync('userInfo')
  714. if (userInfo && userInfo.familyId) familyId = userInfo.familyId
  715. }
  716. if (!familyId) return
  717. var token = uni.getStorageSync('token')
  718. uni.request({
  719. url: config.API_BASE_URL + '/api/mind/traditional/family-dashboard',
  720. method: 'POST',
  721. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  722. data: { familyId: familyId },
  723. success: function(res) {
  724. if (res.data && res.data.code === 200 && res.data.data) {
  725. self.compatibilityData = res.data.data
  726. }
  727. },
  728. fail: function() {}
  729. })
  730. },
  731. scrollToSection: function(section) {
  732. uni.pageScrollTo({ selector: '#' + section, duration: 300 })
  733. },
  734. onTaskClick: function(task) {
  735. uni.navigateTo({ url: '/pages/tasks/tasks' })
  736. },
  737. goActivityDetail: function(act) {
  738. if (act && act.id) uni.navigateTo({ url: '/pages/discover/activity-detail/activity-detail?id=' + act.id })
  739. },
  740. goMoreActivities: function() {
  741. var dimCode = this.currentDimensionCode
  742. uni.navigateTo({ url: '/pages/discover/index?type=activity&dimension=' + dimCode })
  743. },
  744. goProductDetail: function(prod) {
  745. if (prod && prod.id) uni.navigateTo({ url: '/pages/discover/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: row;
  1234. justify-content: space-between;
  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-item {
  1241. display: flex;
  1242. flex-direction: column;
  1243. align-items: center;
  1244. flex: 1;
  1245. }
  1246. .func-icon-wrap {
  1247. width: 80rpx;
  1248. height: 80rpx;
  1249. border-radius: 40rpx;
  1250. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  1251. display: flex;
  1252. align-items: center;
  1253. justify-content: center;
  1254. margin-bottom: 10rpx;
  1255. }
  1256. .func-icon {
  1257. font-size: 40rpx;
  1258. }
  1259. .func-label {
  1260. font-size: 22rpx;
  1261. color: #666;
  1262. font-weight: 500;
  1263. }
  1264. .func-item:active {
  1265. opacity: 0.7;
  1266. }
  1267. /* ===== 底部 ===== */
  1268. .bottom-spacer {
  1269. height: 120rpx;
  1270. }
  1271. /* ===== 肠脑轴 ===== */
  1272. .gut-insight-text {
  1273. font-size: 24rpx;
  1274. color: #666;
  1275. margin-bottom: 16rpx;
  1276. padding: 12rpx 16rpx;
  1277. background: #F0FFF4;
  1278. border-radius: 12rpx;
  1279. line-height: 1.6;
  1280. }
  1281. .gut-indicator-list {
  1282. display: flex;
  1283. flex-direction: column;
  1284. gap: 12rpx;
  1285. }
  1286. .gut-indicator-item {
  1287. display: flex;
  1288. align-items: center;
  1289. gap: 12rpx;
  1290. }
  1291. .gut-indicator-left {
  1292. width: 80rpx;
  1293. flex-shrink: 0;
  1294. }
  1295. .gut-indicator-name {
  1296. font-size: 22rpx;
  1297. color: #666;
  1298. }
  1299. .gut-indicator-bar-track {
  1300. flex: 1;
  1301. height: 16rpx;
  1302. background: #F0F0F0;
  1303. border-radius: 8rpx;
  1304. overflow: hidden;
  1305. }
  1306. .gut-indicator-bar-fill {
  1307. height: 100%;
  1308. border-radius: 8rpx;
  1309. transition: width 0.3s;
  1310. }
  1311. .gut-indicator-value {
  1312. font-size: 22rpx;
  1313. color: #666;
  1314. width: 60rpx;
  1315. text-align: right;
  1316. }
  1317. .gut-indicator-status {
  1318. font-size: 20rpx;
  1319. padding: 2rpx 12rpx;
  1320. border-radius: 10rpx;
  1321. width: 60rpx;
  1322. text-align: center;
  1323. }
  1324. .status-normal {
  1325. background: #D1FAE5;
  1326. color: #059669;
  1327. }
  1328. .status-abnormal {
  1329. background: #FEE2E2;
  1330. color: #DC2626;
  1331. }
  1332. .status-warning {
  1333. background: #FEF3C7;
  1334. color: #D97706;
  1335. }
  1336. </style>