index.vue 50 KB

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