index.vue 49 KB

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