index.vue 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963
  1. <template>
  2. <view class="container">
  3. <!-- Tabbar 切换过渡页 -->
  4. <tab-transition v-if="showTabTransition" dimCode="mind" ref="tabTransition" @close="showTabTransition = false" />
  5. <!-- 品牌头部 -->
  6. <PageBanner theme="mind-wisdom"
  7. tagline="心智成长 · 智慧人生"
  8. quote="知己知彼,百战不殆" />
  9. <!-- 品牌定位语(登录前显示) -->
  10. <view class="brand-strap" v-if="!isLoggedIn">
  11. <text class="brand-strap-text">关注全家心理健康与情绪成长</text>
  12. </view>
  13. <!-- ===== 家庭天盘模块(今日运势 / 今日心情 / 吉位) ===== -->
  14. <FamilyTianpanCard
  15. v-if="isLoggedIn"
  16. :visible="isLoggedIn"
  17. :fortune="dailyFortuneSafe"
  18. :mood="todayMood"
  19. :dominantElement="dominantElementSafe"
  20. :weeklyTip="familyWeeklyInsight"
  21. :traditionalData="traditionalData" />
  22. <!-- 家庭成员选择条 -->
  23. <FamilyMemberStrip
  24. v-if="isLoggedIn"
  25. :members="familyMembersVisible"
  26. :selectedMemberId="selectedMemberId"
  27. @select="onFamilyMemberSelect"
  28. @removed="loadFamilyMembersVisible" />
  29. <!-- 游客登录引导卡 -->
  30. <template v-if="!isLoggedIn">
  31. <LoginGuideCard
  32. title="解锁心理成长报告"
  33. :items="[
  34. '完成 EMI 心理测评,查看四维分析报告',
  35. '大五人格测评 · 情绪趋势追踪',
  36. '阅读专属心理文章,参与每日情绪打卡'
  37. ]" />
  38. </template>
  39. <!-- 登录后:五维能量条 -->
  40. <FamilyEnergyBar
  41. v-if="isLoggedIn"
  42. dimensionCode="mind"
  43. :sandboxData="sandboxData" />
  44. <!-- 心理报告卡片(登录后可见) -->
  45. <view class="emi-card" v-if="isLoggedIn && emiData">
  46. <view class="emi-header">
  47. <text class="emi-title">心理测评报告</text>
  48. <view class="emi-overall-wrap">
  49. <text class="emi-overall-label">综合EQ分</text>
  50. <text class="emi-overall-value">{{ emiData.overallScore || 0 }}</text>
  51. <text :class="['emi-overall-level', 'level-' + getScoreLevel(emiData.overallScore || 0)]">
  52. {{ getScoreLevelText(emiData.overallScore || 0) }}
  53. </text>
  54. </view>
  55. </view>
  56. <view class="emi-dimensions">
  57. <view class="emi-dimension" v-for="dim in emiDimensions" :key="dim.key">
  58. <view class="emi-dim-header">
  59. <text class="emi-dim-label">{{ dim.label }}</text>
  60. <view class="emi-dim-values">
  61. <text class="emi-dim-score">{{ emiData[dim.key] || 0 }}</text>
  62. <text :class="['emi-dim-level', 'level-' + getScoreLevel(emiData[dim.key] || 0)]">
  63. {{ getScoreLevelText(emiData[dim.key] || 0) }}
  64. </text>
  65. </view>
  66. </view>
  67. <view class="emi-dim-bar">
  68. <view class="emi-dim-bar-fill" :style="{ width: (emiData[dim.key] || 0) + '%', background: dim.color }"></view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="emi-footer" @click="goEmotionReport">
  73. <text class="emi-footer-text">查看详情</text>
  74. <text class="emi-footer-icon">&#x2192;</text>
  75. </view>
  76. </view>
  77. <!-- 肠脑轴情绪卡片 -->
  78. <view class="section" v-if="gutIndicators && gutIndicators.length > 0">
  79. <view class="section-header">
  80. <text class="section-title">&#x1F9E0; 肠脑情绪关联</text>
  81. </view>
  82. <view class="gut-insight-text" v-if="gutInsight">
  83. <text>{{ gutInsight }}</text>
  84. </view>
  85. <view class="gut-indicator-list">
  86. <view class="gut-indicator-item" v-for="ind in gutIndicators" :key="ind.id">
  87. <view class="gut-indicator-left">
  88. <text class="gut-indicator-name">{{ ind.indicatorName || ind.name }}</text>
  89. </view>
  90. <view class="gut-indicator-bar-track">
  91. <view class="gut-indicator-bar-fill" :style="{ width: (ind.value || 0) + '%', background: indicatorColor(ind.status) }"></view>
  92. </view>
  93. <text class="gut-indicator-value">{{ ind.value }}{{ ind.unit || '%' }}</text>
  94. <text :class="['gut-indicator-status', 'status-' + (ind.status || 'normal')]">{{ statusLabel(ind.status) }}</text>
  95. </view>
  96. </view>
  97. </view>
  98. <!-- ===== Phase 1.2: 心理告警横幅 ===== -->
  99. <PsychCrisisBanner v-if="isLoggedIn" :memberId="currentChildId" source="screening" />
  100. <!-- ===== 底部:功能入口 Grid(通用,两行) ===== -->
  101. <view class="func-section" v-if="sectionVisible('func_entries')">
  102. <view class="func-grid">
  103. <view class="func-row">
  104. <view class="func-item" v-for="item in funcListRow1" :key="item.label" @click="onFuncClick(item)">
  105. <view class="func-icon-wrap">
  106. <text class="func-icon">{{ item.icon }}</text>
  107. </view>
  108. <text class="func-label">{{ item.label }}</text>
  109. </view>
  110. </view>
  111. <view class="func-row">
  112. <view class="func-item" v-for="item in funcListRow2" :key="item.label" @click="onFuncClick(item)">
  113. <view class="func-icon-wrap">
  114. <text class="func-icon">{{ item.icon }}</text>
  115. </view>
  116. <text class="func-label">{{ item.label }}</text>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <!-- 心维度介绍卡片(登录后显示) -->
  122. <DimensionIntroCard dimCode="mind" v-if="isLoggedIn" learn-more-url="/pages/mind-detail/dimension-intro" />
  123. <!-- 底部占位 -->
  124. <view class="bottom-spacer"></view>
  125. <AIFloatingAvatar />
  126. </view>
  127. </template>
  128. <script>
  129. import TabTransition from '../../components/tab-transition.vue'
  130. import PageBanner from '../../components/PageBanner.vue'
  131. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  132. import DimensionIntroCard from '../../components/DimensionIntroCard.vue'
  133. import RadarChart from '../../components/RadarChart.vue'
  134. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  135. import PsychCrisisBanner from '../../components/PsychCrisisBanner.vue'
  136. import AIFloatingAvatar from '../../components/AIFloatingAvatar.vue'
  137. import FamilyTianpanCard from '../../components/FamilyTianpanCard.vue'
  138. import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
  139. import { getVisibleSections, getFamilyEnergySandbox, getChildren, getVisibleFamilyMembers, getEnergyOverview, getContactList, getHealthAlerts, getMilestones, getDanReportByChild, getFamilyFortune } from '../../utils/api.js'
  140. import config from '../../config.js'
  141. import { parseDate } from '../../utils/format.js'
  142. export default {
  143. components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnergyBar, PsychCrisisBanner, AIFloatingAvatar, FamilyTianpanCard, FamilyMemberStrip, DimensionIntroCard },
  144. data() {
  145. return {
  146. isLoggedIn: false,
  147. role: null,
  148. showTabTransition: true,
  149. currentChildId: null,
  150. selectedMemberId: null,
  151. visibleSections: [],
  152. familyMembersVisible: [],
  153. // 心理 Tab 数据
  154. emiData: null,
  155. emiLoading: true,
  156. emiDimensions: [
  157. { key: 'emotionScore', label: '情绪商数', color: '#FF6B35' },
  158. { key: 'resilienceScore', label: '心理韧性', color: '#F97316' },
  159. { key: 'stressCopingScore', label: '压力应对', color: '#FB923C' },
  160. { key: 'selfAwarenessScore', label: '自我认知', color: '#FBBF24' }
  161. ],
  162. // 大五维度(用于雷达图)
  163. personalityDimensions: [
  164. { key: 'opennessScore', label: '开放性' },
  165. { key: 'conscientiousnessScore', label: '尽责性' },
  166. { key: 'extraversionScore', label: '外向性' },
  167. { key: 'agreeablenessScore', label: '宜人性' },
  168. { key: 'neuroticismScore', label: '神经质' }
  169. ],
  170. // 功能入口
  171. funcList: [
  172. { icon: '\u{1F4D6}', label: '阅读', needLogin: false, page: '/pages/mind-extra/articles' },
  173. { icon: '\u{1F4CA}', label: '测评报告', needLogin: true, page: '/pages/mind/emotion-report' },
  174. { icon: '\u{1F4DD}', label: '成长档案', needLogin: true, page: '/pages/growth-main/index' },
  175. { icon: '\u{2728}', label: '情绪打卡', needLogin: true, page: '/pages/mind-detail/emotion-checkin' },
  176. { icon: '\u{1F4C8}', label: '情绪趋势', needLogin: true, page: '/pages/mind-detail/emotion-trend' },
  177. { icon: '\u{1F9E9}', label: '心理自评', needLogin: true, page: '/pages/mind-detail/screening' },
  178. { icon: '\u{1F3E0}', label: '家庭天盘', needLogin: true, page: '/pages/mind-detail/family-dashboard' },
  179. { icon: '\u{1F9D8}', label: '疏导工具', needLogin: true, page: '/pages/mind-detail/soothe-toolbox' }
  180. ],
  181. articles: [],
  182. // 肠脑轴数据
  183. gutIndicators: null,
  184. gutInsight: '',
  185. // 传统文化数据
  186. traditionalData: null,
  187. traditionalLoading: true,
  188. compatibilityData: null,
  189. wuxingConfig: {
  190. wood: { label: '木', color: '#10B981' },
  191. fire: { label: '火', color: '#FF6B9D' },
  192. earth: { label: '土', color: '#FF8C42' },
  193. metal: { label: '金', color: '#6366F1' },
  194. water: { label: '水', color: '#3B82F6' }
  195. },
  196. pillarLabels: { year: '年柱', month: '月柱', day: '日柱', hour: '时柱' },
  197. familyScore: 0,
  198. // 五维组件数据
  199. userName: '',
  200. children: [],
  201. sandboxData: null,
  202. contactList: [],
  203. healthAlerts: [],
  204. milestones: [],
  205. danReports: [],
  206. // 家庭天盘 - 今日心情(占位数据)
  207. todayMood: {
  208. emoji: '\u{1F60A}',
  209. text: '平静',
  210. score: 65
  211. },
  212. // 家庭天盘 - 每日运势数据
  213. dailyFortuneData: null
  214. }
  215. },
  216. computed: {
  217. personalityScores: function() {
  218. if (!this.emiData) return []
  219. return [
  220. this.emiData.opennessScore || 0,
  221. this.emiData.conscientiousnessScore || 0,
  222. this.emiData.extraversionScore || 0,
  223. this.emiData.agreeablenessScore || 0,
  224. this.emiData.neuroticismScore || 0
  225. ]
  226. },
  227. emotionArticles: function() {
  228. if (!this.articles || this.articles.length === 0) return []
  229. var result = []
  230. for (var i = 0; i < this.articles.length; i++) {
  231. var a = this.articles[i]
  232. if (a.relatedDimensions && a.relatedDimensions.indexOf('mind') !== -1) {
  233. result.push(a)
  234. }
  235. }
  236. if (result.length === 0) return this.articles.slice(0, 5)
  237. return result.slice(0, 5)
  238. },
  239. wuxingData: function() {
  240. if (!this.traditionalData || !this.traditionalData.wuxingElements) return []
  241. var elements = this.traditionalData.wuxingElements
  242. var keys = ['wood', 'fire', 'earth', 'metal', 'water']
  243. var result = []
  244. for (var i = 0; i < keys.length; i++) {
  245. var k = keys[i]
  246. if (elements[k] !== undefined) {
  247. result.push({
  248. key: k,
  249. label: this.wuxingConfig[k].label,
  250. color: this.wuxingConfig[k].color,
  251. value: elements[k]
  252. })
  253. }
  254. }
  255. return result.sort(function(a, b) { return b.value - a.value })
  256. },
  257. currentDimensionCode: function() {
  258. return 'mind'
  259. },
  260. funcListRow1: function() {
  261. return this.funcList.slice(0, 4)
  262. },
  263. funcListRow2: function() {
  264. return this.funcList.slice(4)
  265. },
  266. // ===== 关键信息 - 家庭 =====
  267. familyWuxingLabel: function() {
  268. if (!this.compatibilityData || !this.compatibilityData.familyWuxing || !this.compatibilityData.familyWuxing.aggregatePercentages) return null
  269. var pcts = this.compatibilityData.familyWuxing.aggregatePercentages
  270. var keys = ['wood', 'fire', 'earth', 'metal', 'water']
  271. var maxKey = null
  272. var maxVal = -1
  273. for (var i = 0; i < keys.length; i++) {
  274. if (pcts[keys[i]] !== undefined && pcts[keys[i]] > maxVal) {
  275. maxVal = pcts[keys[i]]
  276. maxKey = keys[i]
  277. }
  278. }
  279. if (!maxKey) return null
  280. return { key: maxKey, label: this.wuxingConfig[maxKey].label, color: this.wuxingConfig[maxKey].color, value: maxVal }
  281. },
  282. familyMemberCount: function() {
  283. if (!this.compatibilityData || !this.compatibilityData.members) return 0
  284. return this.compatibilityData.members.length
  285. },
  286. familyWeeklyInsight: function() {
  287. if (!this.compatibilityData || !this.compatibilityData.weeklyInsight) return ''
  288. return this.compatibilityData.weeklyInsight
  289. },
  290. // ===== 关键信息 - 个人 =====
  291. dominantElement: function() {
  292. if (!this.traditionalData || !this.traditionalData.wuxingElements) return null
  293. var elements = this.traditionalData.wuxingElements
  294. var keys = ['wood', 'fire', 'earth', 'metal', 'water']
  295. var maxKey = null
  296. var maxVal = -1
  297. for (var i = 0; i < keys.length; i++) {
  298. if (elements[keys[i]] !== undefined && elements[keys[i]] > maxVal) {
  299. maxVal = elements[keys[i]]
  300. maxKey = keys[i]
  301. }
  302. }
  303. return maxKey
  304. },
  305. luckyColorInfo: function() {
  306. var colorMap = {
  307. wood: { name: '绿', hex: '#10B981' },
  308. fire: { name: '红', hex: '#FF6B9D' },
  309. earth: { name: '黄', hex: '#FF8C42' },
  310. metal: { name: '白', hex: '#6366F1' },
  311. water: { name: '蓝', hex: '#3B82F6' }
  312. }
  313. var elem = this.dominantElement
  314. if (!elem) return null
  315. return colorMap[elem] || null
  316. },
  317. luckyNumber: function() {
  318. if (this.traditionalData && this.traditionalData.lifeNumber) {
  319. return this.traditionalData.lifeNumber
  320. }
  321. var numMap = { wood: 3, fire: 9, earth: 5, metal: 7, water: 1 }
  322. var elem = this.dominantElement
  323. return elem ? numMap[elem] : null
  324. },
  325. fortuneSeed: function() {
  326. if (this.traditionalData && this.traditionalData.lifeNumber) {
  327. return String(this.traditionalData.lifeNumber)
  328. }
  329. return '0'
  330. },
  331. // WXML 不支持模板内 || {} 字面量,需在 computed 中预先做 fallback
  332. dailyFortuneSafe: function() {
  333. return this.dailyFortune || {}
  334. },
  335. // WXML 不支持模板内 || '' 字面量,需在 computed 中预先做 fallback
  336. dominantElementSafe: function() {
  337. return this.dominantElement || ''
  338. },
  339. dailyFortune: function() {
  340. // 优先使用后端接口数据
  341. if (this.dailyFortuneData) {
  342. var levels = ['大吉', '吉', '平', '凶', '大凶']
  343. return {
  344. level: this.dailyFortuneData.level,
  345. text: levels[this.dailyFortuneData.level],
  346. description: this.dailyFortuneData.description
  347. }
  348. }
  349. // 兼容模式:没有接口数据时使用原算法
  350. if (!this.dominantElement) return null
  351. var today = new Date()
  352. var dateStr = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate()
  353. var seedStr = dateStr + (this.fortuneSeed || '')
  354. var hash = 0
  355. for (var i = 0; i < seedStr.length; i++) {
  356. hash = ((hash << 5) - hash) + seedStr.charCodeAt(i)
  357. hash = hash & hash
  358. }
  359. var level = Math.abs(hash) % 5
  360. var levels = ['大吉', '吉', '平', '凶', '大凶']
  361. var descMap = {
  362. wood: ['大吉:木气旺盛,宜规划', '吉:行动力强', '平:静心养性', '凶:谨言慎行', '大凶:忌冲动'],
  363. fire: ['大吉:热情高涨', '吉:精力充沛', '平:适当休息', '凶:注意情绪', '大凶:静心冥想'],
  364. earth: ['大吉:稳重踏实', '吉:贵人运佳', '平:按部就班', '凶:注意肠胃', '大凶:不宜投资'],
  365. metal: ['大吉:决策力强', '吉:思维清晰', '平:保持专注', '凶:注意言辞', '大凶:不宜强求'],
  366. water: ['大吉:灵感丰富', '吉:人际和谐', '平:安静内省', '凶:情绪波动', '大凶:宜藏不宜放']
  367. }
  368. var descList = descMap[this.dominantElement] || descMap.wood
  369. return { level: level, text: levels[level], description: descList[level] }
  370. }
  371. },
  372. onShow() {
  373. this.showTabTransition = true
  374. var token = uni.getStorageSync('token')
  375. this.isLoggedIn = !!token
  376. if (this.isLoggedIn) {
  377. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  378. // FIX: 从 Vuex store 读取 currentChildId,而非仅从 localStorage
  379. this.currentChildId = (this.$store.state && this.$store.state.currentChildId) || uni.getStorageSync('currentChildId') || null
  380. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  381. }
  382. this.loadSectionConfig()
  383. if (this.isLoggedIn) {
  384. this.loadChildren()
  385. this.loadFamilyMembersVisible()
  386. this.loadSandboxData()
  387. this.loadEmiData()
  388. this.loadGutData()
  389. this.loadEnergyData()
  390. this.loadTraditionalCultureData()
  391. this.loadContacts()
  392. this.loadHealthAlerts()
  393. this.loadMilestones()
  394. this.loadDanReports()
  395. }
  396. // 游客也能浏览活动和商品
  397. this.loadFamilyFortune()
  398. this._watchPageReady()
  399. },
  400. methods: {
  401. // ===== 区块可见性 =====
  402. loadSectionConfig: function() {
  403. var self = this
  404. var baseSections = ['func_entries', 'daily_tip', 'recommended_reading']
  405. if (!uni.getStorageSync('token')) {
  406. self.visibleSections = baseSections
  407. return
  408. }
  409. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  410. getVisibleSections({ pageKey: 'mind', role: role }).then(function(res) {
  411. if (res.code === 200 && res.data) {
  412. var keys = res.data.map(function(s) { return s.sectionKey })
  413. var merged = baseSections.slice()
  414. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  415. self.visibleSections = merged
  416. }
  417. }).catch(function() {
  418. self.visibleSections = ['func_entries', 'daily_tip', 'recommended_reading', 'mind_tasks', 'related_activities', 'purchased_courses']
  419. })
  420. },
  421. // 加载家庭天盘数据
  422. loadFamilyFortune: function() {
  423. var self = this
  424. if (!self.isLoggedIn) return
  425. getFamilyFortune().then(function(res) {
  426. if (res.code === 200 && res.data) {
  427. // 更新 todayMood 占位数据为真实接口数据
  428. self.todayMood = {
  429. emoji: res.data.moodEmoji || '\u{1F60A}',
  430. text: res.data.moodText || '平静',
  431. score: res.data.moodScore || 65
  432. }
  433. // 更新 dailyFortune computed 函数依赖的数据
  434. self.dailyFortuneData = {
  435. level: res.data.fortuneLevel,
  436. text: res.data.fortuneLevelText,
  437. description: res.data.fortuneDescription
  438. }
  439. // 更新主导五行
  440. self.traditionalData = self.traditionalData || {}
  441. self.traditionalData.wuxingElements = {}
  442. if (res.data.dominantElement) {
  443. self.traditionalData.wuxingElements[res.data.dominantElement] = 100
  444. }
  445. // 更新周报提示
  446. self.compatibilityData = self.compatibilityData || {}
  447. self.compatibilityData.weeklyInsight = res.data.weeklyTip || self.compatibilityData.weeklyInsight
  448. }
  449. }).catch(function(err) {
  450. console.error('Failed to load family fortune:', err)
  451. })
  452. },
  453. viewReport: function(report) {
  454. if (report && report.fileUrl) {
  455. uni.downloadFile({
  456. url: report.fileUrl,
  457. success: function(res) {
  458. if (res.statusCode === 200) {
  459. uni.openDocument({
  460. filePath: res.tempFilePath,
  461. success: function() {
  462. console.log('打开报告成功')
  463. }
  464. })
  465. }
  466. }
  467. })
  468. }
  469. },
  470. formatDate: function(dateStr) {
  471. if (!dateStr) return ''
  472. var d = parseDate(dateStr)
  473. if (!d) return ''
  474. var month = d.getMonth() + 1
  475. var day = d.getDate()
  476. return month + '月' + day + '日'
  477. },
  478. sectionVisible: function(key) {
  479. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  480. },
  481. // ===== 心理 Tab:EMI 数据 =====
  482. loadEmiData: function() {
  483. var self = this
  484. var memberId = self.currentChildId
  485. if (!memberId) {
  486. self.emiLoading = false
  487. return
  488. }
  489. self.emiLoading = true
  490. getEmiReport(memberId).then(function(res) {
  491. if (res.code === 200 && res.data) {
  492. self.emiData = res.data
  493. }
  494. self.emiLoading = false
  495. }).catch(function() {
  496. self.emiLoading = false
  497. })
  498. },
  499. // ===== 肠脑轴情绪指标 =====
  500. loadGutData: function() {
  501. var self = this
  502. var memberId = self.currentChildId
  503. if (!memberId) return
  504. var token = uni.getStorageSync('token')
  505. // 获取神经递质指标
  506. uni.request({
  507. url: config.API_BASE_URL + '/api/mind/neurotransmitters',
  508. method: 'POST',
  509. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  510. data: { memberId: memberId },
  511. success: function(r) {
  512. if (r.statusCode === 200 && r.data && r.data.code === 200) {
  513. var list = r.data.data
  514. if (Array.isArray(list) && list.length > 0) {
  515. self.gutIndicators = list.slice(0, 4)
  516. }
  517. }
  518. }
  519. })
  520. // 获取情绪洞察摘要
  521. uni.request({
  522. url: config.API_BASE_URL + '/api/mind/gut-emotion-insight',
  523. method: 'POST',
  524. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  525. data: { memberId: memberId },
  526. success: function(r) {
  527. if (r.statusCode === 200 && r.data && r.data.code === 200 && r.data.data) {
  528. self.gutInsight = r.data.data.summary || ''
  529. }
  530. }
  531. })
  532. },
  533. indicatorColor: function(status) {
  534. if (status === 'abnormal' || status === '偏高' || status === '偏低') return '#EF4444'
  535. if (status === 'warning' || status === '偏高' || status === '偏低') return '#F59E0B'
  536. return '#10B981'
  537. },
  538. statusLabel: function(status) {
  539. if (status === 'normal') return '正常'
  540. if (status === 'abnormal') return '异常'
  541. if (status === 'warning') return '警讯'
  542. return status || '正常'
  543. },
  544. // ===== EMI 分数评级 =====
  545. getScoreLevel: function(score) {
  546. if (score >= 85) return 'excellent'
  547. if (score >= 70) return 'good'
  548. if (score >= 55) return 'average'
  549. return 'low'
  550. },
  551. getScoreLevelText: function(score) {
  552. if (score >= 85) return '优秀'
  553. if (score >= 70) return '良好'
  554. if (score >= 55) return '一般'
  555. return '需提升'
  556. },
  557. // ===== 导航 =====
  558. goEmotionReport: function() {
  559. var memberId = this.currentChildId || ''
  560. uni.navigateTo({ url: '/pages/mind-detail/emotion-report?memberId=' + memberId })
  561. },
  562. goArticles: function() {
  563. uni.navigateTo({ url: '/pages/article-center/index?dimension=mind' })
  564. },
  565. onFuncClick: function(item) {
  566. if (item.needLogin && !this.isLoggedIn) {
  567. uni.showModal({
  568. title: '提示',
  569. content: '请先登录后使用此功能',
  570. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  571. })
  572. return
  573. }
  574. if (item.page) uni.navigateTo({ url: item.page })
  575. },
  576. // ===== 孩子列表与维度数据 =====
  577. loadChildren: function() {
  578. var self = this
  579. getChildren().then(function(res) {
  580. if (res.code === 200 && res.data) {
  581. self.children = res.data
  582. var savedChildId = uni.getStorageSync('currentChildId')
  583. var found = false
  584. for (var i = 0; i < self.children.length; i++) {
  585. if (self.children[i].memberId === savedChildId) {
  586. self.currentChildId = savedChildId
  587. found = true
  588. break
  589. }
  590. }
  591. // FIX: 不再自动选择第一个孩子。仅在用户通过 UserQuickEntry 切换时设置 currentChildId
  592. if (found) {
  593. self.loadDimensionData()
  594. self.loadEmiData()
  595. }
  596. }
  597. }).catch(function(e) {
  598. console.log('获取孩子列表失败', e)
  599. })
  600. },
  601. loadDimensionData: function() {
  602. if (this.familyMembersVisible.length > 0) {
  603. this.loadCompatibilityData()
  604. }
  605. },
  606. loadSandboxData: function() {
  607. var self = this
  608. getFamilyEnergySandbox().then(function(res) {
  609. if (res && res.data) {
  610. self.sandboxData = res.data
  611. }
  612. }).catch(function() {})
  613. },
  614. loadEnergyData: function() {
  615. var self = this
  616. if (!this.currentChildId) return
  617. getEnergyOverview(this.currentChildId).then(function(res) {
  618. if (res && res.data) {
  619. var dims = res.data.dimensions
  620. if (dims && dims.length > 0) {
  621. for (var i = 0; i < dims.length; i++) {
  622. if (dims[i] && dims[i].code === 'mind' && res.data.energyScores) {
  623. self.familyScore = res.data.energyScores.mindScore || 0
  624. }
  625. }
  626. }
  627. }
  628. }).catch(function(e) {
  629. console.log('获取能量概览失败', e)
  630. })
  631. },
  632. onFamilyMemberSelect: function(member) {
  633. this.selectedMemberId = member.id
  634. },
  635. onChildChanged: function(child) {
  636. this.currentChildId = child.memberId
  637. // FIX: 同步提交到 Vuex store
  638. this.$store.commit('switchToChild', child.memberId)
  639. this.loadDimensionData()
  640. this.loadEmiData()
  641. this.loadTraditionalCultureData()
  642. },
  643. loadFamilyMembersVisible: function() {
  644. var self = this
  645. getVisibleFamilyMembers().then(function(res) {
  646. self.familyMembersVisible = res.data || []
  647. }).catch(function(e) {
  648. console.log('获取可见家庭成员失败', e)
  649. self.familyMembersVisible = []
  650. })
  651. },
  652. loadCompatibilityData: function() {
  653. var self = this
  654. var token = uni.getStorageSync('token')
  655. uni.request({
  656. url: config.API_BASE_URL + '/api/mind/traditional/family-dashboard',
  657. method: 'POST',
  658. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  659. data: {},
  660. success: function(res) {
  661. if (res.data && res.data.code === 200 && res.data.data) {
  662. self.compatibilityData = res.data.data
  663. }
  664. },
  665. fail: function() {}
  666. })
  667. },
  668. scrollToSection: function(section) {
  669. uni.pageScrollTo({ selector: '#' + section, duration: 300 })
  670. },
  671. goAssessment: function() { uni.navigateTo({ url: '/pages/assessment/apply' }) },
  672. goLogin: function() { uni.navigateTo({ url: '/pages/login/login' }) },
  673. // ===== 传统文化数据 =====
  674. // ===== 联系人 / 关系健康 =====
  675. loadContacts: function() {
  676. var self = this
  677. getContactList({}).then(function(res) {
  678. if (res.code === 200) {
  679. self.contactList = Array.isArray(res.data) ? res.data : []
  680. } else {
  681. self.contactList = []
  682. }
  683. }).catch(function() {
  684. self.contactList = []
  685. })
  686. },
  687. loadHealthAlerts: function() {
  688. var self = this
  689. getHealthAlerts().then(function(res) {
  690. if (res.code === 200) {
  691. self.healthAlerts = Array.isArray(res.data) ? res.data : []
  692. } else {
  693. self.healthAlerts = []
  694. }
  695. }).catch(function() {
  696. self.healthAlerts = []
  697. })
  698. },
  699. loadMilestones: function() {
  700. var self = this
  701. getMilestones(30).then(function(res) {
  702. if (res.code === 200) {
  703. self.milestones = Array.isArray(res.data) ? res.data : []
  704. } else {
  705. self.milestones = []
  706. }
  707. }).catch(function() {
  708. self.milestones = []
  709. })
  710. },
  711. loadTraditionalCultureData: function() {
  712. var self = this
  713. var memberId = this.currentChildId
  714. if (!memberId) {
  715. self.traditionalLoading = false
  716. return
  717. }
  718. self.traditionalLoading = true
  719. uni.request({
  720. url: config.API_BASE_URL + '/api/mind/traditional/mirror',
  721. method: 'POST',
  722. data: { memberId: memberId, memberType: 'child' },
  723. success: function(res) {
  724. self.traditionalLoading = false
  725. if (res.data && res.data.code === 200 && res.data.data) {
  726. var d = res.data.data
  727. if (d.eightCharacters || d.wuxingElements || d.zodiac || d.numSoul) {
  728. self.traditionalData = d
  729. } else {
  730. self.traditionalData = null
  731. }
  732. } else {
  733. self.traditionalData = null
  734. }
  735. },
  736. fail: function() {
  737. self.traditionalLoading = false
  738. self.traditionalData = null
  739. }
  740. })
  741. },
  742. _watchPageReady() {
  743. var self = this
  744. var unwatch = this.$watch(function() {
  745. if (self.isLoggedIn) {
  746. return !!(self.emiData || self.energyOverview)
  747. } }, function(val) {
  748. if (val) {
  749. if (unwatch) unwatch()
  750. if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
  751. }
  752. })
  753. },
  754. // ===== DAN 报告 =====
  755. loadDanReports: function() {
  756. var self = this
  757. var memberId = self.currentChildId
  758. if (!memberId) return
  759. getDanReportByChild(memberId, 'mind').then(function(res) {
  760. if (res.code === 200 && res.data) {
  761. self.danReports = res.data
  762. }
  763. }).catch(function() {})
  764. },
  765. goDanUpload: function(dimension) {
  766. uni.navigateTo({ url: '/pages/dan-assessment/report-upload' })
  767. },
  768. viewDanReport: function(report) {
  769. uni.navigateTo({ url: '/pages/dan-assessment/report-upload?draftId=' + report.id })
  770. },
  771. formatDate: function(dateStr) {
  772. if (!dateStr) return ''
  773. var d = parseDate(dateStr)
  774. if (!d) return ''
  775. return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  776. }
  777. }
  778. }
  779. </script>
  780. <style scoped>
  781. .container {
  782. min-height: 100vh;
  783. background: #f5f7fa;
  784. padding-bottom: 120rpx;
  785. }
  786. /* ===== 心·心理 标题栏 ===== */
  787. .section-title-bar {
  788. display: flex;
  789. flex-direction: row;
  790. align-items: center;
  791. margin: 20rpx 30rpx 10rpx;
  792. padding: 16rpx 24rpx;
  793. background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  794. border-radius: 20rpx;
  795. box-shadow: 0 4rpx 16rpx rgba(139,92,246,0.25);
  796. }
  797. .section-title-icon {
  798. font-size: 32rpx;
  799. color: #fff;
  800. margin-right: 12rpx;
  801. }
  802. .section-title-text {
  803. font-size: 32rpx;
  804. font-weight: bold;
  805. color: #fff;
  806. }
  807. /* ===== 心理报告上传卡片 ===== */
  808. .mind-report-section {
  809. margin: 20rpx 30rpx;
  810. }
  811. .mind-report-card {
  812. display: flex;
  813. flex-direction: row;
  814. align-items: center;
  815. background: linear-gradient(135deg, #F3E8FF, #FCE4EC);
  816. border-radius: 20rpx;
  817. padding: 28rpx 24rpx;
  818. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  819. }
  820. .mind-report-left {
  821. width: 100rpx;
  822. height: 100rpx;
  823. background: rgba(255,255,255,0.7);
  824. border-radius: 20rpx;
  825. display: flex;
  826. align-items: center;
  827. justify-content: center;
  828. margin-right: 20rpx;
  829. flex-shrink: 0;
  830. }
  831. .mind-report-icon {
  832. font-size: 52rpx;
  833. }
  834. .mind-report-right {
  835. flex: 1;
  836. }
  837. .mind-report-title {
  838. font-size: 30rpx;
  839. font-weight: bold;
  840. color: #7C3AED;
  841. display: block;
  842. margin-bottom: 6rpx;
  843. }
  844. .mind-report-desc {
  845. font-size: 22rpx;
  846. color: #A855F7;
  847. line-height: 1.5;
  848. display: block;
  849. margin-bottom: 10rpx;
  850. }
  851. .mind-report-tags {
  852. display: flex;
  853. flex-direction: row;
  854. gap: 10rpx;
  855. }
  856. .mind-tag {
  857. font-size: 20rpx;
  858. color: #7C3AED;
  859. background: rgba(255,255,255,0.6);
  860. padding: 4rpx 14rpx;
  861. border-radius: 20rpx;
  862. }
  863. .mind-report-arrow {
  864. font-size: 36rpx;
  865. color: #C084FC;
  866. margin-left: 10rpx;
  867. flex-shrink: 0;
  868. }
  869. .mind-report-card:active {
  870. opacity: 0.7;
  871. }
  872. .mind-report-list {
  873. margin-top: 12rpx;
  874. }
  875. .mind-report-item {
  876. display: flex;
  877. flex-direction: row;
  878. align-items: center;
  879. background: #fff;
  880. border-radius: 14rpx;
  881. padding: 20rpx 20rpx;
  882. margin-bottom: 8rpx;
  883. box-shadow: 0 1rpx 6rpx rgba(0,0,0,0.05);
  884. }
  885. .mind-report-item:active {
  886. opacity: 0.7;
  887. }
  888. .mind-report-item-icon {
  889. font-size: 28rpx;
  890. margin-right: 14rpx;
  891. }
  892. .mind-report-item-name {
  893. font-size: 26rpx;
  894. color: #333;
  895. flex: 1;
  896. }
  897. .mind-report-item-date {
  898. font-size: 22rpx;
  899. color: #999;
  900. margin-right: 14rpx;
  901. }
  902. .mind-report-item-status {
  903. font-size: 22rpx;
  904. padding: 2rpx 12rpx;
  905. border-radius: 20rpx;
  906. }
  907. .mind-report-item-status.parsed {
  908. color: #7C3AED;
  909. background: #F3E8FF;
  910. }
  911. .mind-report-item-status.pending {
  912. color: #999;
  913. background: #F5F5F5;
  914. }
  915. .mind-report-empty {
  916. display: flex;
  917. flex-direction: row;
  918. align-items: center;
  919. justify-content: center;
  920. padding: 24rpx;
  921. margin-top: 8rpx;
  922. }
  923. .mind-report-empty-icon {
  924. font-size: 32rpx;
  925. margin-right: 10rpx;
  926. }
  927. .mind-report-empty-text {
  928. font-size: 24rpx;
  929. color: #bbb;
  930. }
  931. /* ===== 心理能量概况 ===== */
  932. .energy-overview {
  933. display: flex;
  934. flex-direction: row;
  935. margin: 20rpx 30rpx;
  936. background: #fff;
  937. border-radius: 20rpx;
  938. padding: 24rpx 16rpx;
  939. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  940. justify-content: space-around;
  941. }
  942. .energy-badge {
  943. display: flex;
  944. flex-direction: column;
  945. align-items: center;
  946. flex: 1;
  947. }
  948. .badge-icon {
  949. font-size: 36rpx;
  950. margin-bottom: 8rpx;
  951. }
  952. .badge-value {
  953. font-size: 36rpx;
  954. font-weight: bold;
  955. color: #333;
  956. }
  957. .badge-label {
  958. font-size: 20rpx;
  959. color: #999;
  960. margin-top: 4rpx;
  961. }
  962. /* ===== EMI 四维条形图 ===== */
  963. .emi-section {
  964. margin: 20rpx 30rpx;
  965. }
  966. .emi-card {
  967. background: #fff;
  968. border-radius: 24rpx;
  969. padding: 30rpx;
  970. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  971. }
  972. .emi-card-title {
  973. font-size: 30rpx;
  974. font-weight: bold;
  975. color: #333;
  976. display: block;
  977. }
  978. .personality-header {
  979. display: flex;
  980. flex-direction: row;
  981. align-items: center;
  982. justify-content: space-between;
  983. margin-bottom: 24rpx;
  984. }
  985. .test-btn {
  986. background: #8B5CF6;
  987. padding: 8rpx 28rpx;
  988. border-radius: 30rpx;
  989. }
  990. .test-btn-text {
  991. font-size: 24rpx;
  992. color: #fff;
  993. font-weight: 500;
  994. }
  995. .emi-bar-item {
  996. display: flex;
  997. flex-direction: row;
  998. align-items: center;
  999. margin-bottom: 20rpx;
  1000. }
  1001. .emi-bar-label {
  1002. font-size: 24rpx;
  1003. color: #666;
  1004. width: 120rpx;
  1005. flex-shrink: 0;
  1006. }
  1007. .emi-bar-track {
  1008. flex: 1;
  1009. height: 20rpx;
  1010. background: #f0f0f0;
  1011. border-radius: 10rpx;
  1012. overflow: hidden;
  1013. margin: 0 16rpx;
  1014. }
  1015. .emi-bar-fill {
  1016. height: 100%;
  1017. border-radius: 10rpx;
  1018. transition: width 0.5s;
  1019. }
  1020. .emi-bar-score {
  1021. font-size: 26rpx;
  1022. font-weight: bold;
  1023. color: #333;
  1024. width: 60rpx;
  1025. text-align: right;
  1026. flex-shrink: 0;
  1027. }
  1028. .emi-bar-level {
  1029. font-size: 20rpx;
  1030. width: 80rpx;
  1031. text-align: right;
  1032. flex-shrink: 0;
  1033. }
  1034. .level-excellent { color: #10B981; }
  1035. .level-good { color: #3B82F6; }
  1036. .level-average { color: #F97316; }
  1037. .level-low { color: #EF4444; }
  1038. .emi-footer {
  1039. display: flex;
  1040. flex-direction: row;
  1041. justify-content: space-between;
  1042. align-items: center;
  1043. margin-top: 20rpx;
  1044. padding-top: 20rpx;
  1045. border-top: 1rpx solid #f0f0f0;
  1046. }
  1047. .emi-overall {
  1048. font-size: 28rpx;
  1049. font-weight: bold;
  1050. color: #FF6B35;
  1051. }
  1052. .emi-link {
  1053. display: flex;
  1054. flex-direction: row;
  1055. align-items: center;
  1056. }
  1057. .emi-link-text {
  1058. font-size: 26rpx;
  1059. color: #FF6B35;
  1060. font-weight: 500;
  1061. }
  1062. .emi-link-arrow {
  1063. font-size: 26rpx;
  1064. color: #FF6B35;
  1065. margin-left: 8rpx;
  1066. }
  1067. /* ===== EMI 心理报告卡片 ===== */
  1068. .emi-card {
  1069. margin: 30rpx;
  1070. background: #fff;
  1071. border-radius: 24rpx;
  1072. padding: 30rpx;
  1073. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1074. }
  1075. .emi-header {
  1076. margin-bottom: 24rpx;
  1077. }
  1078. .emi-title {
  1079. font-size: 30rpx;
  1080. font-weight: bold;
  1081. color: #333;
  1082. display: block;
  1083. }
  1084. .emi-overall-wrap {
  1085. display: flex;
  1086. flex-direction: column;
  1087. align-items: center;
  1088. padding: 32rpx 0;
  1089. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1090. border-radius: 16rpx;
  1091. margin: 20rpx 0;
  1092. color: #fff;
  1093. }
  1094. .emi-overall-label {
  1095. font-size: 26rpx;
  1096. margin-bottom: 6rpx;
  1097. }
  1098. .emi-overall-value {
  1099. font-size: 64rpx;
  1100. font-weight: bold;
  1101. margin-bottom: 6rpx;
  1102. }
  1103. .emi-overall-level {
  1104. font-size: 24rpx;
  1105. padding: 4rpx 16rpx;
  1106. border-radius: 12rpx;
  1107. background: rgba(255,255,255,0.2);
  1108. }
  1109. .emi-dimensions {
  1110. display: flex;
  1111. flex-direction: column;
  1112. gap: 20rpx;
  1113. }
  1114. .emi-dimension {
  1115. display: flex;
  1116. flex-direction: column;
  1117. }
  1118. .emi-dim-header {
  1119. display: flex;
  1120. flex-direction: row;
  1121. justify-content: space-between;
  1122. align-items: center;
  1123. margin-bottom: 8rpx;
  1124. }
  1125. .emi-dim-label {
  1126. font-size: 26rpx;
  1127. color: #666;
  1128. }
  1129. .emi-dim-values {
  1130. display: flex;
  1131. flex-direction: row;
  1132. align-items: center;
  1133. }
  1134. .emi-dim-score {
  1135. font-size: 28rpx;
  1136. font-weight: bold;
  1137. color: #FF6B35;
  1138. margin-right: 12rpx;
  1139. }
  1140. .emi-dim-level {
  1141. font-size: 20rpx;
  1142. padding: 2rpx 12rpx;
  1143. border-radius: 8rpx;
  1144. }
  1145. .emi-dim-bar {
  1146. height: 14rpx;
  1147. background: #f0f0f0;
  1148. border-radius: 7rpx;
  1149. overflow: hidden;
  1150. }
  1151. .emi-dim-bar-fill {
  1152. height: 100%;
  1153. border-radius: 7rpx;
  1154. transition: width 0.5s;
  1155. }
  1156. .emi-footer {
  1157. display: flex;
  1158. justify-content: flex-end;
  1159. align-items: center;
  1160. padding-top: 20rpx;
  1161. border-top: 1rpx solid #f0f0f0;
  1162. margin-top: 20rpx;
  1163. }
  1164. .emi-footer-text {
  1165. font-size: 24rpx;
  1166. color: #F97316;
  1167. font-weight: 500;
  1168. }
  1169. .emi-footer-icon {
  1170. font-size: 24rpx;
  1171. margin-left: 8rpx;
  1172. }
  1173. .level-excellent { color: #10B981; background: #ECFDF5; }
  1174. .level-good { color: #3B82F6; background: #EFF6FF; }
  1175. .level-average { color: #F97316; background: #FFF7ED; }
  1176. .level-low { color: #EF4444; background: #FEF2F2; }
  1177. /* 雷达图内的空状态 */
  1178. .placeholder-content {
  1179. display: flex;
  1180. flex-direction: column;
  1181. align-items: center;
  1182. padding: 40rpx 20rpx;
  1183. }
  1184. /* ===== 占位卡 ===== */
  1185. .placeholder-card {
  1186. margin: 30rpx;
  1187. background: #fff;
  1188. border-radius: 24rpx;
  1189. padding: 60rpx 40rpx;
  1190. display: flex;
  1191. flex-direction: column;
  1192. align-items: center;
  1193. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1194. }
  1195. .placeholder-icon {
  1196. font-size: 80rpx;
  1197. margin-bottom: 20rpx;
  1198. }
  1199. .placeholder-title {
  1200. font-size: 32rpx;
  1201. font-weight: bold;
  1202. color: #333;
  1203. margin-bottom: 16rpx;
  1204. }
  1205. .placeholder-desc {
  1206. font-size: 26rpx;
  1207. color: #999;
  1208. text-align: center;
  1209. line-height: 1.6;
  1210. margin-bottom: 30rpx;
  1211. }
  1212. .placeholder-btn {
  1213. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1214. color: #fff;
  1215. font-size: 28rpx;
  1216. font-weight: bold;
  1217. padding: 16rpx 64rpx;
  1218. border-radius: 40rpx;
  1219. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  1220. }
  1221. /* ===== 传统文化卡片 ===== */
  1222. .culture-section {
  1223. margin: 20rpx 30rpx;
  1224. }
  1225. .culture-card {
  1226. background: #fff;
  1227. border-radius: 20rpx;
  1228. padding: 24rpx;
  1229. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1230. margin-bottom: 16rpx;
  1231. }
  1232. .culture-card-header {
  1233. display: flex;
  1234. align-items: center;
  1235. margin-bottom: 16rpx;
  1236. }
  1237. .culture-card-icon {
  1238. font-size: 32rpx;
  1239. margin-right: 10rpx;
  1240. }
  1241. .culture-card-title {
  1242. font-size: 28rpx;
  1243. font-weight: 600;
  1244. color: #333;
  1245. }
  1246. .culture-card-body {
  1247. font-size: 24rpx;
  1248. color: #666;
  1249. line-height: 1.6;
  1250. }
  1251. /* 八字四柱 */
  1252. .bazi-grid {
  1253. display: flex;
  1254. justify-content: space-around;
  1255. padding: 8rpx 0;
  1256. }
  1257. .bazi-column {
  1258. display: flex;
  1259. flex-direction: column;
  1260. align-items: center;
  1261. }
  1262. .bazi-pillar-label {
  1263. font-size: 22rpx;
  1264. color: #999;
  1265. margin-bottom: 6rpx;
  1266. }
  1267. .bazi-pillar-value {
  1268. font-size: 32rpx;
  1269. font-weight: 700;
  1270. color: #8B5CF6;
  1271. background: #F5F0FF;
  1272. padding: 10rpx 14rpx;
  1273. border-radius: 10rpx;
  1274. }
  1275. /* 五行能量 */
  1276. .wuxing-list {
  1277. display: flex;
  1278. flex-direction: column;
  1279. gap: 12rpx;
  1280. }
  1281. .wuxing-item {
  1282. display: flex;
  1283. align-items: center;
  1284. gap: 12rpx;
  1285. }
  1286. .wuxing-label {
  1287. font-size: 26rpx;
  1288. font-weight: 600;
  1289. width: 44rpx;
  1290. text-align: center;
  1291. }
  1292. .wuxing-bar-track {
  1293. flex: 1;
  1294. height: 20rpx;
  1295. background: #F0F0F0;
  1296. border-radius: 10rpx;
  1297. overflow: hidden;
  1298. }
  1299. .wuxing-bar-fill {
  1300. height: 100%;
  1301. border-radius: 10rpx;
  1302. }
  1303. .wuxing-value {
  1304. font-size: 22rpx;
  1305. color: #666;
  1306. width: 56rpx;
  1307. text-align: right;
  1308. }
  1309. .energy-card {
  1310. margin-top: 20rpx;
  1311. padding: 24rpx 20rpx;
  1312. background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  1313. border-radius: 20rpx;
  1314. position: relative;
  1315. overflow: hidden;
  1316. }
  1317. .energy-card::before {
  1318. content: '';
  1319. position: absolute;
  1320. top: -60rpx;
  1321. right: -60rpx;
  1322. width: 200rpx;
  1323. height: 200rpx;
  1324. background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, transparent 70%);
  1325. border-radius: 50%;
  1326. }
  1327. .energy-card::after {
  1328. content: '';
  1329. position: absolute;
  1330. bottom: -40rpx;
  1331. left: -40rpx;
  1332. width: 160rpx;
  1333. height: 160rpx;
  1334. background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  1335. border-radius: 50%;
  1336. }
  1337. .energy-header {
  1338. display: flex;
  1339. align-items: center;
  1340. margin-bottom: 14rpx;
  1341. position: relative;
  1342. z-index: 1;
  1343. }
  1344. .energy-icon {
  1345. font-size: 32rpx;
  1346. margin-right: 10rpx;
  1347. }
  1348. .energy-label {
  1349. font-size: 28rpx;
  1350. font-weight: 700;
  1351. background: linear-gradient(135deg, #F59E0B, #FF6B9D);
  1352. -webkit-background-clip: text;
  1353. -webkit-text-fill-color: transparent;
  1354. background-clip: text;
  1355. }
  1356. .energy-divider {
  1357. height: 2rpx;
  1358. background: linear-gradient(90deg, rgba(255,215,0,0.5), rgba(255,107,157,0.3), transparent);
  1359. margin-bottom: 18rpx;
  1360. position: relative;
  1361. z-index: 1;
  1362. }
  1363. .energy-quote {
  1364. font-size: 26rpx;
  1365. color: #E2E8F0;
  1366. line-height: 1.8;
  1367. display: block;
  1368. margin-bottom: 14rpx;
  1369. position: relative;
  1370. z-index: 1;
  1371. padding-left: 20rpx;
  1372. letter-spacing: 1rpx;
  1373. }
  1374. .energy-quote::before {
  1375. content: '';
  1376. position: absolute;
  1377. left: 0;
  1378. top: 4rpx;
  1379. bottom: 4rpx;
  1380. width: 4rpx;
  1381. background: linear-gradient(180deg, #F59E0B, #FF6B9D);
  1382. border-radius: 2rpx;
  1383. }
  1384. .energy-advice {
  1385. font-size: 24rpx;
  1386. color: #94A3B8;
  1387. line-height: 1.7;
  1388. display: block;
  1389. position: relative;
  1390. z-index: 1;
  1391. padding: 14rpx 18rpx;
  1392. background: rgba(255,255,255,0.05);
  1393. border-radius: 12rpx;
  1394. border: 1rpx solid rgba(255,255,255,0.08);
  1395. }
  1396. .energy-footer {
  1397. display: flex;
  1398. justify-content: center;
  1399. gap: 12rpx;
  1400. margin-top: 18rpx;
  1401. position: relative;
  1402. z-index: 1;
  1403. }
  1404. .energy-footer-dot {
  1405. width: 8rpx;
  1406. height: 8rpx;
  1407. border-radius: 50%;
  1408. background: rgba(255,255,255,0.3);
  1409. }
  1410. .energy-footer-dot:nth-child(2) {
  1411. background: rgba(255,215,0,0.6);
  1412. width: 10rpx;
  1413. height: 10rpx;
  1414. }
  1415. /* 星座+灵数双栏 */
  1416. .culture-dual {
  1417. display: flex;
  1418. gap: 16rpx;
  1419. }
  1420. .culture-dual-item {
  1421. flex: 1;
  1422. background: #fff;
  1423. border-radius: 20rpx;
  1424. padding: 20rpx;
  1425. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
  1426. display: flex;
  1427. flex-direction: column;
  1428. align-items: center;
  1429. }
  1430. .culture-dual-icon {
  1431. font-size: 36rpx;
  1432. margin-bottom: 8rpx;
  1433. }
  1434. .culture-dual-label {
  1435. font-size: 22rpx;
  1436. color: #999;
  1437. margin-bottom: 6rpx;
  1438. }
  1439. .culture-dual-value {
  1440. font-size: 28rpx;
  1441. font-weight: 700;
  1442. color: #8B5CF6;
  1443. }
  1444. .culture-empty {
  1445. text-align: center;
  1446. padding: 30rpx 0;
  1447. color: #bbb;
  1448. font-size: 24rpx;
  1449. }
  1450. /* ===== 每日心理 ===== */
  1451. .tip-card {
  1452. background: #fff;
  1453. border-radius: 20rpx;
  1454. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1455. display: flex;
  1456. flex-direction: row;
  1457. overflow: hidden;
  1458. }
  1459. .tip-left-bar {
  1460. width: 6rpx;
  1461. background: linear-gradient(180deg, #5B9BD5, #8FC5E8);
  1462. flex-shrink: 0;
  1463. }
  1464. .tip-body {
  1465. flex: 1;
  1466. padding: 28rpx 24rpx;
  1467. }
  1468. .tip-title {
  1469. font-size: 28rpx;
  1470. font-weight: bold;
  1471. color: #5B9BD5;
  1472. display: block;
  1473. margin-bottom: 12rpx;
  1474. }
  1475. .tip-content {
  1476. font-size: 24rpx;
  1477. color: #666;
  1478. line-height: 1.6;
  1479. display: block;
  1480. margin-bottom: 16rpx;
  1481. }
  1482. .tip-footer {
  1483. display: flex;
  1484. flex-direction: row;
  1485. justify-content: flex-end;
  1486. }
  1487. .tip-source {
  1488. font-size: 22rpx;
  1489. color: #bbb;
  1490. }
  1491. /* ===== 通用区块 ===== */
  1492. .section {
  1493. margin: 20rpx 30rpx;
  1494. }
  1495. .section-header {
  1496. margin-bottom: 20rpx;
  1497. }
  1498. .section-title {
  1499. font-size: 30rpx;
  1500. font-weight: bold;
  1501. color: #333;
  1502. }
  1503. /* ===== 推荐阅读 ===== */
  1504. .article-list {
  1505. display: flex;
  1506. flex-direction: column;
  1507. }
  1508. .article-card {
  1509. background: #fff;
  1510. border-radius: 20rpx;
  1511. padding: 28rpx 24rpx;
  1512. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1513. margin-bottom: 20rpx;
  1514. }
  1515. .article-category {
  1516. display: inline-block;
  1517. padding: 4rpx 18rpx;
  1518. border-radius: 20rpx;
  1519. margin-bottom: 14rpx;
  1520. }
  1521. .article-category-text {
  1522. font-size: 20rpx;
  1523. color: #fff;
  1524. font-weight: 500;
  1525. }
  1526. .article-title {
  1527. font-size: 28rpx;
  1528. font-weight: bold;
  1529. color: #333;
  1530. display: block;
  1531. margin-bottom: 10rpx;
  1532. }
  1533. .article-summary {
  1534. font-size: 24rpx;
  1535. color: #888;
  1536. line-height: 1.5;
  1537. display: block;
  1538. margin-bottom: 20rpx;
  1539. }
  1540. .article-meta {
  1541. display: flex;
  1542. flex-direction: row;
  1543. align-items: center;
  1544. justify-content: space-between;
  1545. }
  1546. .meta-item {
  1547. display: flex;
  1548. flex-direction: row;
  1549. align-items: center;
  1550. margin-right: 20rpx;
  1551. }
  1552. .meta-icon {
  1553. font-size: 22rpx;
  1554. margin-right: 4rpx;
  1555. }
  1556. .meta-text {
  1557. font-size: 22rpx;
  1558. color: #bbb;
  1559. }
  1560. .article-date {
  1561. font-size: 22rpx;
  1562. color: #bbb;
  1563. margin-left: auto;
  1564. }
  1565. /* ===== 功能区入口 ===== */
  1566. .func-section {
  1567. margin: 20rpx 30rpx;
  1568. }
  1569. .func-grid {
  1570. display: flex;
  1571. flex-direction: column;
  1572. gap: 16rpx;
  1573. background: #fff;
  1574. border-radius: 20rpx;
  1575. padding: 24rpx 16rpx;
  1576. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1577. }
  1578. .func-row {
  1579. display: flex;
  1580. flex-direction: row;
  1581. justify-content: space-between;
  1582. }
  1583. .func-item {
  1584. display: flex;
  1585. flex-direction: column;
  1586. align-items: center;
  1587. flex: 1;
  1588. }
  1589. .func-icon-wrap {
  1590. width: 80rpx;
  1591. height: 80rpx;
  1592. border-radius: 40rpx;
  1593. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  1594. display: flex;
  1595. align-items: center;
  1596. justify-content: center;
  1597. margin-bottom: 10rpx;
  1598. }
  1599. .func-icon {
  1600. font-size: 40rpx;
  1601. }
  1602. .func-label {
  1603. font-size: 22rpx;
  1604. color: #666;
  1605. font-weight: 500;
  1606. }
  1607. .func-item:active {
  1608. opacity: 0.7;
  1609. }
  1610. /* ===== 底部 ===== */
  1611. .bottom-spacer {
  1612. height: 120rpx;
  1613. }
  1614. /* ===== 肠脑轴 ===== */
  1615. .gut-insight-text {
  1616. font-size: 24rpx;
  1617. color: #666;
  1618. margin-bottom: 16rpx;
  1619. padding: 12rpx 16rpx;
  1620. background: #F0FFF4;
  1621. border-radius: 12rpx;
  1622. line-height: 1.6;
  1623. }
  1624. .gut-indicator-list {
  1625. display: flex;
  1626. flex-direction: column;
  1627. gap: 12rpx;
  1628. }
  1629. .gut-indicator-item {
  1630. display: flex;
  1631. align-items: center;
  1632. gap: 12rpx;
  1633. }
  1634. .gut-indicator-left {
  1635. width: 80rpx;
  1636. flex-shrink: 0;
  1637. }
  1638. .gut-indicator-name {
  1639. font-size: 22rpx;
  1640. color: #666;
  1641. }
  1642. .gut-indicator-bar-track {
  1643. flex: 1;
  1644. height: 16rpx;
  1645. background: #F0F0F0;
  1646. border-radius: 8rpx;
  1647. overflow: hidden;
  1648. }
  1649. .gut-indicator-bar-fill {
  1650. height: 100%;
  1651. border-radius: 8rpx;
  1652. transition: width 0.3s;
  1653. }
  1654. .gut-indicator-value {
  1655. font-size: 22rpx;
  1656. color: #666;
  1657. width: 60rpx;
  1658. text-align: right;
  1659. }
  1660. .gut-indicator-status {
  1661. font-size: 20rpx;
  1662. padding: 2rpx 12rpx;
  1663. border-radius: 10rpx;
  1664. width: 60rpx;
  1665. text-align: center;
  1666. }
  1667. .status-normal {
  1668. background: #D1FAE5;
  1669. color: #059669;
  1670. }
  1671. .status-abnormal {
  1672. background: #FEE2E2;
  1673. color: #DC2626;
  1674. }
  1675. .status-warning {
  1676. background: #FEF3C7;
  1677. color: #D97706;
  1678. }
  1679. /* ===== 关键信息(家庭+个人) ===== */
  1680. .key-info-card {
  1681. background: #fff;
  1682. border-radius: 20rpx;
  1683. padding: 24rpx;
  1684. margin-top: 20rpx;
  1685. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1686. }
  1687. .key-info-header {
  1688. display: flex;
  1689. align-items: center;
  1690. margin-bottom: 20rpx;
  1691. }
  1692. .key-info-icon {
  1693. font-size: 28rpx;
  1694. margin-right: 8rpx;
  1695. }
  1696. .key-info-title {
  1697. font-size: 28rpx;
  1698. font-weight: 600;
  1699. color: #333;
  1700. }
  1701. .key-info-body {
  1702. display: flex;
  1703. flex-direction: row;
  1704. gap: 20rpx;
  1705. }
  1706. .key-info-col {
  1707. flex: 1;
  1708. background: #F8F9FA;
  1709. border-radius: 14rpx;
  1710. padding: 16rpx;
  1711. min-width: 0;
  1712. }
  1713. .ki-subtitle {
  1714. font-size: 22rpx;
  1715. color: #999;
  1716. margin-bottom: 12rpx;
  1717. font-weight: 500;
  1718. }
  1719. .ki-row {
  1720. display: flex;
  1721. align-items: center;
  1722. margin-bottom: 10rpx;
  1723. flex-wrap: nowrap;
  1724. }
  1725. .ki-row:last-child {
  1726. margin-bottom: 0;
  1727. }
  1728. .ki-label {
  1729. font-size: 22rpx;
  1730. color: #888;
  1731. margin-right: 8rpx;
  1732. white-space: nowrap;
  1733. }
  1734. .ki-dot {
  1735. width: 16rpx;
  1736. height: 16rpx;
  1737. border-radius: 50%;
  1738. margin-right: 6rpx;
  1739. flex-shrink: 0;
  1740. }
  1741. .ki-valuel {
  1742. font-size: 24rpx;
  1743. color: #333;
  1744. font-weight: 500;
  1745. white-space: nowrap;
  1746. }
  1747. .ki-valued {
  1748. font-size: 24rpx;
  1749. color: #333;
  1750. font-weight: 500;
  1751. }
  1752. .ki-swatch {
  1753. width: 28rpx;
  1754. height: 28rpx;
  1755. border-radius: 50%;
  1756. margin-right: 6rpx;
  1757. border: 2rpx solid rgba(0,0,0,0.06);
  1758. flex-shrink: 0;
  1759. }
  1760. .ki-num {
  1761. font-size: 30rpx;
  1762. font-weight: 700;
  1763. color: #FF6B9D;
  1764. }
  1765. .ki-fortune {
  1766. font-size: 24rpx;
  1767. font-weight: 700;
  1768. padding: 2rpx 12rpx;
  1769. border-radius: 10rpx;
  1770. }
  1771. .ki-fortune-0 {
  1772. color: #D32F2F;
  1773. background: #FFEBEE;
  1774. }
  1775. .ki-fortune-1 {
  1776. color: #E65100;
  1777. background: #FFF3E0;
  1778. }
  1779. .ki-fortune-2 {
  1780. color: #F9A825;
  1781. background: #FFFDE7;
  1782. }
  1783. .ki-fortune-3 {
  1784. color: #7B1FA2;
  1785. background: #F3E5F5;
  1786. }
  1787. .ki-fortune-4 {
  1788. color: #B71C1C;
  1789. background: #FFCDD2;
  1790. }
  1791. .ki-insight {
  1792. display: flex;
  1793. align-items: flex-start;
  1794. margin-top: 16rpx;
  1795. padding: 16rpx;
  1796. background: #FFF8F0;
  1797. border-radius: 12rpx;
  1798. }
  1799. .ki-insight-icon {
  1800. font-size: 24rpx;
  1801. margin-right: 8rpx;
  1802. flex-shrink: 0;
  1803. }
  1804. .ki-insight-text {
  1805. font-size: 22rpx;
  1806. color: #8B6914;
  1807. line-height: 1.5;
  1808. }
  1809. .ki-footer {
  1810. margin-top: 16rpx;
  1811. text-align: center;
  1812. padding: 12rpx;
  1813. font-size: 24rpx;
  1814. color: #8B5CF6;
  1815. font-weight: 500;
  1816. background: #F5F3FF;
  1817. border-radius: 12rpx;
  1818. }
  1819. .ki-footer:active {
  1820. opacity: 0.7;
  1821. }
  1822. /* DAN 报告卡片 */
  1823. .dan-card {
  1824. background: #fff;
  1825. border-radius: 16rpx;
  1826. padding: 24rpx;
  1827. margin-bottom: 16rpx;
  1828. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  1829. }
  1830. .dan-card-header {
  1831. display: flex;
  1832. justify-content: space-between;
  1833. align-items: center;
  1834. margin-bottom: 12rpx;
  1835. }
  1836. .dan-report-date {
  1837. font-size: 26rpx;
  1838. color: #666;
  1839. }
  1840. .dan-status {
  1841. font-size: 22rpx;
  1842. padding: 4rpx 16rpx;
  1843. border-radius: 8rpx;
  1844. }
  1845. .dan-status.confirmed {
  1846. background: #D1FAE5;
  1847. color: #065F46;
  1848. }
  1849. .dan-status.pending {
  1850. background: #FEF3C7;
  1851. color: #92400E;
  1852. }
  1853. .dan-report-desc {
  1854. font-size: 28rpx;
  1855. color: #333;
  1856. font-weight: 500;
  1857. margin-bottom: 12rpx;
  1858. display: block;
  1859. }
  1860. .dan-card-footer {
  1861. text-align: right;
  1862. }
  1863. .dan-view-link {
  1864. font-size: 26rpx;
  1865. color: #6366F1;
  1866. }
  1867. .section-header {
  1868. display: flex;
  1869. justify-content: space-between;
  1870. align-items: center;
  1871. margin-bottom: 20rpx;
  1872. }
  1873. .section-title {
  1874. font-size: 32rpx;
  1875. font-weight: 700;
  1876. color: #333;
  1877. }
  1878. .section-more {
  1879. font-size: 26rpx;
  1880. color: #6366F1;
  1881. padding: 8rpx 16rpx;
  1882. }
  1883. /* 品牌定位语 */
  1884. .brand-strap {
  1885. margin: 16rpx 30rpx 0;
  1886. padding: 20rpx 28rpx;
  1887. background: linear-gradient(135deg, #FFF0F5, rgba(255,107,157,0.12));
  1888. border-radius: 16rpx;
  1889. border-left: 4rpx solid #FF6B9D;
  1890. }
  1891. .brand-strap-text {
  1892. font-size: 26rpx;
  1893. color: #9D174D;
  1894. font-weight: 500;
  1895. }
  1896. </style>