index.vue 39 KB

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