index.vue 50 KB

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