index.vue 42 KB

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