index.vue 63 KB

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