index.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407
  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: true,
  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. }, 1800)
  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-detail/activity-detail/activity-detail?id=' + act.id })
  755. },
  756. goMoreActivities: function() {
  757. uni.navigateTo({ url: '/pages/activity/index' })
  758. },
  759. goProductDetail: function(prod) {
  760. if (prod && prod.id) uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  761. },
  762. goMoreProducts: function() {
  763. var dimCode = this.currentDimensionCode
  764. uni.navigateTo({ url: '/pages/discover/index?type=product&domain=' + dimCode })
  765. },
  766. goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  767. goMemberDetail: function(member) {
  768. if (!member || !member.memberId) return
  769. var currentId = this.currentChildId
  770. uni.navigateTo({
  771. url: '/pages/mind-detail/duo-compatibility?memberId1=' + currentId + '&memberId2=' + member.memberId
  772. })
  773. },
  774. goAssessment: function() { uni.navigateTo({ url: '/pages/assessment/apply' }) },
  775. goLogin: function() { uni.navigateTo({ url: '/pages/login/login' }) },
  776. // ===== 传统文化数据 =====
  777. loadTraditionalCultureData: function() {
  778. var self = this
  779. var memberId = this.currentChildId
  780. if (!memberId) {
  781. self.traditionalLoading = false
  782. return
  783. }
  784. self.traditionalLoading = true
  785. uni.request({
  786. url: config.API_BASE_URL + '/api/mind/traditional/mirror',
  787. method: 'POST',
  788. data: { memberId: memberId, memberType: 'child' },
  789. success: function(res) {
  790. self.traditionalLoading = false
  791. if (res.data && res.data.code === 200 && res.data.data) {
  792. var d = res.data.data
  793. if (d.eightCharacters || d.wuxingElements || d.zodiac || d.numSoul) {
  794. self.traditionalData = d
  795. } else {
  796. self.traditionalData = null
  797. }
  798. } else {
  799. self.traditionalData = null
  800. }
  801. },
  802. fail: function() {
  803. self.traditionalLoading = false
  804. self.traditionalData = null
  805. }
  806. })
  807. }
  808. }
  809. }
  810. </script>
  811. <style scoped>
  812. .container {
  813. min-height: 100vh;
  814. background: #f5f7fa;
  815. padding-bottom: 120rpx;
  816. }
  817. /* ===== 心·心理 标题栏 ===== */
  818. .section-title-bar {
  819. display: flex;
  820. flex-direction: row;
  821. align-items: center;
  822. margin: 20rpx 30rpx 10rpx;
  823. padding: 16rpx 24rpx;
  824. background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  825. border-radius: 20rpx;
  826. box-shadow: 0 4rpx 16rpx rgba(139,92,246,0.25);
  827. }
  828. .section-title-icon {
  829. font-size: 32rpx;
  830. color: #fff;
  831. margin-right: 12rpx;
  832. }
  833. .section-title-text {
  834. font-size: 32rpx;
  835. font-weight: bold;
  836. color: #fff;
  837. }
  838. /* ===== 心理能量概况 ===== */
  839. .energy-overview {
  840. display: flex;
  841. flex-direction: row;
  842. margin: 20rpx 30rpx;
  843. background: #fff;
  844. border-radius: 20rpx;
  845. padding: 24rpx 16rpx;
  846. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  847. justify-content: space-around;
  848. }
  849. .energy-badge {
  850. display: flex;
  851. flex-direction: column;
  852. align-items: center;
  853. flex: 1;
  854. }
  855. .badge-icon {
  856. font-size: 36rpx;
  857. margin-bottom: 8rpx;
  858. }
  859. .badge-value {
  860. font-size: 36rpx;
  861. font-weight: bold;
  862. color: #333;
  863. }
  864. .badge-label {
  865. font-size: 20rpx;
  866. color: #999;
  867. margin-top: 4rpx;
  868. }
  869. /* ===== EMI 四维条形图 ===== */
  870. .emi-section {
  871. margin: 20rpx 30rpx;
  872. }
  873. .emi-card {
  874. background: #fff;
  875. border-radius: 24rpx;
  876. padding: 30rpx;
  877. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  878. }
  879. .emi-card-title {
  880. font-size: 30rpx;
  881. font-weight: bold;
  882. color: #333;
  883. margin-bottom: 24rpx;
  884. display: block;
  885. }
  886. .emi-bar-item {
  887. display: flex;
  888. flex-direction: row;
  889. align-items: center;
  890. margin-bottom: 20rpx;
  891. }
  892. .emi-bar-label {
  893. font-size: 24rpx;
  894. color: #666;
  895. width: 120rpx;
  896. flex-shrink: 0;
  897. }
  898. .emi-bar-track {
  899. flex: 1;
  900. height: 20rpx;
  901. background: #f0f0f0;
  902. border-radius: 10rpx;
  903. overflow: hidden;
  904. margin: 0 16rpx;
  905. }
  906. .emi-bar-fill {
  907. height: 100%;
  908. border-radius: 10rpx;
  909. transition: width 0.5s;
  910. }
  911. .emi-bar-score {
  912. font-size: 26rpx;
  913. font-weight: bold;
  914. color: #333;
  915. width: 60rpx;
  916. text-align: right;
  917. flex-shrink: 0;
  918. }
  919. .emi-bar-level {
  920. font-size: 20rpx;
  921. width: 80rpx;
  922. text-align: right;
  923. flex-shrink: 0;
  924. }
  925. .level-excellent { color: #10B981; }
  926. .level-good { color: #3B82F6; }
  927. .level-average { color: #F97316; }
  928. .level-low { color: #EF4444; }
  929. .emi-footer {
  930. display: flex;
  931. flex-direction: row;
  932. justify-content: space-between;
  933. align-items: center;
  934. margin-top: 20rpx;
  935. padding-top: 20rpx;
  936. border-top: 1rpx solid #f0f0f0;
  937. }
  938. .emi-overall {
  939. font-size: 28rpx;
  940. font-weight: bold;
  941. color: #FF6B35;
  942. }
  943. .emi-link {
  944. display: flex;
  945. flex-direction: row;
  946. align-items: center;
  947. }
  948. .emi-link-text {
  949. font-size: 26rpx;
  950. color: #FF6B35;
  951. font-weight: 500;
  952. }
  953. .emi-link-arrow {
  954. font-size: 26rpx;
  955. color: #FF6B35;
  956. margin-left: 8rpx;
  957. }
  958. /* ===== 占位卡 ===== */
  959. .placeholder-card {
  960. margin: 30rpx;
  961. background: #fff;
  962. border-radius: 24rpx;
  963. padding: 60rpx 40rpx;
  964. display: flex;
  965. flex-direction: column;
  966. align-items: center;
  967. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  968. }
  969. .placeholder-icon {
  970. font-size: 80rpx;
  971. margin-bottom: 20rpx;
  972. }
  973. .placeholder-title {
  974. font-size: 32rpx;
  975. font-weight: bold;
  976. color: #333;
  977. margin-bottom: 16rpx;
  978. }
  979. .placeholder-desc {
  980. font-size: 26rpx;
  981. color: #999;
  982. text-align: center;
  983. line-height: 1.6;
  984. margin-bottom: 30rpx;
  985. }
  986. .placeholder-btn {
  987. background: linear-gradient(135deg, #FF6B35, #FFD700);
  988. color: #fff;
  989. font-size: 28rpx;
  990. font-weight: bold;
  991. padding: 16rpx 64rpx;
  992. border-radius: 40rpx;
  993. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  994. }
  995. /* ===== 传统文化卡片 ===== */
  996. .culture-section {
  997. margin: 20rpx 30rpx;
  998. }
  999. .culture-card {
  1000. background: #fff;
  1001. border-radius: 20rpx;
  1002. padding: 24rpx;
  1003. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1004. margin-bottom: 16rpx;
  1005. }
  1006. .culture-card-header {
  1007. display: flex;
  1008. align-items: center;
  1009. margin-bottom: 16rpx;
  1010. }
  1011. .culture-card-icon {
  1012. font-size: 32rpx;
  1013. margin-right: 10rpx;
  1014. }
  1015. .culture-card-title {
  1016. font-size: 28rpx;
  1017. font-weight: 600;
  1018. color: #333;
  1019. }
  1020. .culture-card-body {
  1021. font-size: 24rpx;
  1022. color: #666;
  1023. line-height: 1.6;
  1024. }
  1025. /* 八字四柱 */
  1026. .bazi-grid {
  1027. display: flex;
  1028. justify-content: space-around;
  1029. padding: 8rpx 0;
  1030. }
  1031. .bazi-column {
  1032. display: flex;
  1033. flex-direction: column;
  1034. align-items: center;
  1035. }
  1036. .bazi-pillar-label {
  1037. font-size: 22rpx;
  1038. color: #999;
  1039. margin-bottom: 6rpx;
  1040. }
  1041. .bazi-pillar-value {
  1042. font-size: 32rpx;
  1043. font-weight: 700;
  1044. color: #8B5CF6;
  1045. background: #F5F0FF;
  1046. padding: 10rpx 14rpx;
  1047. border-radius: 10rpx;
  1048. }
  1049. /* 五行能量 */
  1050. .wuxing-list {
  1051. display: flex;
  1052. flex-direction: column;
  1053. gap: 12rpx;
  1054. }
  1055. .wuxing-item {
  1056. display: flex;
  1057. align-items: center;
  1058. gap: 12rpx;
  1059. }
  1060. .wuxing-label {
  1061. font-size: 26rpx;
  1062. font-weight: 600;
  1063. width: 44rpx;
  1064. text-align: center;
  1065. }
  1066. .wuxing-bar-track {
  1067. flex: 1;
  1068. height: 20rpx;
  1069. background: #F0F0F0;
  1070. border-radius: 10rpx;
  1071. overflow: hidden;
  1072. }
  1073. .wuxing-bar-fill {
  1074. height: 100%;
  1075. border-radius: 10rpx;
  1076. }
  1077. .wuxing-value {
  1078. font-size: 22rpx;
  1079. color: #666;
  1080. width: 56rpx;
  1081. text-align: right;
  1082. }
  1083. .wuxing-reading {
  1084. margin-top: 12rpx;
  1085. padding: 12rpx 14rpx;
  1086. background: #F8F6F0;
  1087. border-radius: 12rpx;
  1088. font-size: 24rpx;
  1089. color: #666;
  1090. line-height: 1.5;
  1091. }
  1092. /* 星座+灵数双栏 */
  1093. .culture-dual {
  1094. display: flex;
  1095. gap: 16rpx;
  1096. }
  1097. .culture-dual-item {
  1098. flex: 1;
  1099. background: #fff;
  1100. border-radius: 20rpx;
  1101. padding: 20rpx;
  1102. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1103. display: flex;
  1104. flex-direction: column;
  1105. align-items: center;
  1106. }
  1107. .culture-dual-icon {
  1108. font-size: 36rpx;
  1109. margin-bottom: 8rpx;
  1110. }
  1111. .culture-dual-label {
  1112. font-size: 22rpx;
  1113. color: #999;
  1114. margin-bottom: 6rpx;
  1115. }
  1116. .culture-dual-value {
  1117. font-size: 28rpx;
  1118. font-weight: 700;
  1119. color: #8B5CF6;
  1120. }
  1121. .culture-empty {
  1122. text-align: center;
  1123. padding: 30rpx 0;
  1124. color: #bbb;
  1125. font-size: 24rpx;
  1126. }
  1127. /* ===== 每日心理 ===== */
  1128. .tip-card {
  1129. background: #fff;
  1130. border-radius: 20rpx;
  1131. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1132. display: flex;
  1133. flex-direction: row;
  1134. overflow: hidden;
  1135. }
  1136. .tip-left-bar {
  1137. width: 6rpx;
  1138. background: linear-gradient(180deg, #5B9BD5, #8FC5E8);
  1139. flex-shrink: 0;
  1140. }
  1141. .tip-body {
  1142. flex: 1;
  1143. padding: 28rpx 24rpx;
  1144. }
  1145. .tip-title {
  1146. font-size: 28rpx;
  1147. font-weight: bold;
  1148. color: #5B9BD5;
  1149. display: block;
  1150. margin-bottom: 12rpx;
  1151. }
  1152. .tip-content {
  1153. font-size: 24rpx;
  1154. color: #666;
  1155. line-height: 1.6;
  1156. display: block;
  1157. margin-bottom: 16rpx;
  1158. }
  1159. .tip-footer {
  1160. display: flex;
  1161. flex-direction: row;
  1162. justify-content: flex-end;
  1163. }
  1164. .tip-source {
  1165. font-size: 22rpx;
  1166. color: #bbb;
  1167. }
  1168. /* ===== 通用区块 ===== */
  1169. .section {
  1170. margin: 20rpx 30rpx;
  1171. }
  1172. .section-header {
  1173. margin-bottom: 20rpx;
  1174. }
  1175. .section-title {
  1176. font-size: 30rpx;
  1177. font-weight: bold;
  1178. color: #333;
  1179. }
  1180. /* ===== 推荐阅读 ===== */
  1181. .article-list {
  1182. display: flex;
  1183. flex-direction: column;
  1184. }
  1185. .article-card {
  1186. background: #fff;
  1187. border-radius: 20rpx;
  1188. padding: 28rpx 24rpx;
  1189. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1190. margin-bottom: 20rpx;
  1191. }
  1192. .article-category {
  1193. display: inline-block;
  1194. padding: 4rpx 18rpx;
  1195. border-radius: 20rpx;
  1196. margin-bottom: 14rpx;
  1197. }
  1198. .article-category-text {
  1199. font-size: 20rpx;
  1200. color: #fff;
  1201. font-weight: 500;
  1202. }
  1203. .article-title {
  1204. font-size: 28rpx;
  1205. font-weight: bold;
  1206. color: #333;
  1207. display: block;
  1208. margin-bottom: 10rpx;
  1209. }
  1210. .article-summary {
  1211. font-size: 24rpx;
  1212. color: #888;
  1213. line-height: 1.5;
  1214. display: block;
  1215. margin-bottom: 20rpx;
  1216. }
  1217. .article-meta {
  1218. display: flex;
  1219. flex-direction: row;
  1220. align-items: center;
  1221. justify-content: space-between;
  1222. }
  1223. .meta-item {
  1224. display: flex;
  1225. flex-direction: row;
  1226. align-items: center;
  1227. margin-right: 20rpx;
  1228. }
  1229. .meta-icon {
  1230. font-size: 22rpx;
  1231. margin-right: 4rpx;
  1232. }
  1233. .meta-text {
  1234. font-size: 22rpx;
  1235. color: #bbb;
  1236. }
  1237. .article-date {
  1238. font-size: 22rpx;
  1239. color: #bbb;
  1240. margin-left: auto;
  1241. }
  1242. /* ===== 功能区入口 ===== */
  1243. .func-section {
  1244. margin: 20rpx 30rpx;
  1245. }
  1246. .func-grid {
  1247. display: flex;
  1248. flex-direction: column;
  1249. gap: 16rpx;
  1250. background: #fff;
  1251. border-radius: 20rpx;
  1252. padding: 24rpx 16rpx;
  1253. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1254. }
  1255. .func-row {
  1256. display: flex;
  1257. flex-direction: row;
  1258. justify-content: space-between;
  1259. }
  1260. .func-item {
  1261. display: flex;
  1262. flex-direction: column;
  1263. align-items: center;
  1264. flex: 1;
  1265. }
  1266. .func-icon-wrap {
  1267. width: 80rpx;
  1268. height: 80rpx;
  1269. border-radius: 40rpx;
  1270. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  1271. display: flex;
  1272. align-items: center;
  1273. justify-content: center;
  1274. margin-bottom: 10rpx;
  1275. }
  1276. .func-icon {
  1277. font-size: 40rpx;
  1278. }
  1279. .func-label {
  1280. font-size: 22rpx;
  1281. color: #666;
  1282. font-weight: 500;
  1283. }
  1284. .func-item:active {
  1285. opacity: 0.7;
  1286. }
  1287. /* ===== 底部 ===== */
  1288. .bottom-spacer {
  1289. height: 120rpx;
  1290. }
  1291. /* ===== 肠脑轴 ===== */
  1292. .gut-insight-text {
  1293. font-size: 24rpx;
  1294. color: #666;
  1295. margin-bottom: 16rpx;
  1296. padding: 12rpx 16rpx;
  1297. background: #F0FFF4;
  1298. border-radius: 12rpx;
  1299. line-height: 1.6;
  1300. }
  1301. .gut-indicator-list {
  1302. display: flex;
  1303. flex-direction: column;
  1304. gap: 12rpx;
  1305. }
  1306. .gut-indicator-item {
  1307. display: flex;
  1308. align-items: center;
  1309. gap: 12rpx;
  1310. }
  1311. .gut-indicator-left {
  1312. width: 80rpx;
  1313. flex-shrink: 0;
  1314. }
  1315. .gut-indicator-name {
  1316. font-size: 22rpx;
  1317. color: #666;
  1318. }
  1319. .gut-indicator-bar-track {
  1320. flex: 1;
  1321. height: 16rpx;
  1322. background: #F0F0F0;
  1323. border-radius: 8rpx;
  1324. overflow: hidden;
  1325. }
  1326. .gut-indicator-bar-fill {
  1327. height: 100%;
  1328. border-radius: 8rpx;
  1329. transition: width 0.3s;
  1330. }
  1331. .gut-indicator-value {
  1332. font-size: 22rpx;
  1333. color: #666;
  1334. width: 60rpx;
  1335. text-align: right;
  1336. }
  1337. .gut-indicator-status {
  1338. font-size: 20rpx;
  1339. padding: 2rpx 12rpx;
  1340. border-radius: 10rpx;
  1341. width: 60rpx;
  1342. text-align: center;
  1343. }
  1344. .status-normal {
  1345. background: #D1FAE5;
  1346. color: #059669;
  1347. }
  1348. .status-abnormal {
  1349. background: #FEE2E2;
  1350. color: #DC2626;
  1351. }
  1352. .status-warning {
  1353. background: #FEF3C7;
  1354. color: #D97706;
  1355. }
  1356. </style>