index.vue 40 KB

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