index.vue 42 KB

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