index.vue 40 KB

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