index.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354
  1. <template>
  2. <view class="wisdom-container" :style="{ '--font-scale': fontScale }">
  3. <!-- 通用登录浮层 -->
  4. <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" />
  5. <!-- Tabbar 切换过渡页 -->
  6. <tab-transition v-if="showTabTransition" dimCode="wisdom" ref="tabTransition" @close="showTabTransition = false" />
  7. <!-- 品牌头部 -->
  8. <PageBanner theme="wisdom" tagline="认知成长 · 提升学习效率" quote="认知成长 · 智慧人生" />
  9. <DimensionPageSkeleton v-if="pageLoading" dim-code="wisdom" />
  10. <!-- 品牌定位语(登录前显示) -->
  11. <view class="brand-strap" v-if="!isLoggedIn">
  12. <text class="brand-strap-text">提升全家认知能力与学习效率</text>
  13. </view>
  14. <!-- 2. 学习能力评估图(始终显示,无数据时仅显示人群平均值) -->
  15. <view class="section">
  16. <view class="section-header">
  17. <text class="section-title">学习能力评估</text>
  18. <text class="section-sub">通过测评了解全家认知能力,找出可以提升的方向</text>
  19. <text class="avg-badge" v-if="!cognitiveReport">同龄平均值 · 完成认知测评后显示个人数据</text>
  20. <text class="section-more" v-if="isLoggedIn" @click="goCognitiveReport">查看详情 ›</text>
  21. </view>
  22. <RadarChart
  23. :dimensions="cognitiveDimensions"
  24. :scores="cognitiveScores"
  25. :avg-scores="cognitiveFamilyScores"
  26. :population-scores="cognitivePopulationScores"
  27. :childName="activeChildName"
  28. :fillColor="wisdomColor"
  29. :gridColor="gridColor"
  30. :labelColor="labelColor" />
  31. </view>
  32. <!-- 家庭成员选择条 -->
  33. <MemberSelector
  34. variant="tabs"
  35. v-if="currentView === 'self' && isLoggedIn"
  36. :members="familyMembersVisible"
  37. :selectedMemberId="selectedMemberId"
  38. dimension-code="wisdom"
  39. :score-map="memberScoreMap"
  40. @select="onFamilyMemberSelect"
  41. @longpress="onMemberLongPress"
  42. @manage="onMemberManage"
  43. @removed="loadFamilyMembersVisible" />
  44. <!-- 游客引导语 -->
  45. <view class="monthly-guidance" v-if="!isLoggedIn">
  46. <text class="guidance-icon">⚡</text>
  47. <text class="guidance-text">{{ monthlyGuidance }}</text>
  48. </view>
  49. <!-- 游客价值卡(统一组件:维度色 CTA + 价值预览) -->
  50. <DimensionVisitorCard
  51. v-if="!isLoggedIn"
  52. dimCode="wisdom"
  53. card-title="智维度 · 认知成长"
  54. :benefits="[
  55. '全家认知能力评估与强项分析',
  56. '学习解读与认知训练建议',
  57. '认知趋势与同龄对比'
  58. ]"
  59. cta-text="登录做认知测评"
  60. secondary-text="了解认知维度"
  61. secondary-url="/pages/wisdom-detail/dimension-intro"
  62. preview-text="登录后展示你的认知能力雷达图" />
  63. <!-- 4. 五维能量条(登录后) -->
  64. <FamilyEnergyBar
  65. v-if="isLoggedIn"
  66. dimensionCode="wisdom"
  67. :sandboxData="sandboxData"
  68. :dualDimension="dualDimension" />
  69. <!-- 认知指标卡片 -->
  70. <view class="indicator-cards-section" v-if="isLoggedIn && wisdomIndicators.length > 0">
  71. <view class="section-header">
  72. <text class="section-title">⚡ 认知指标</text>
  73. <text class="section-more" @click="goWisdomDetail">更多 ›</text>
  74. </view>
  75. <view class="indicator-cards">
  76. <view
  77. v-for="(ind, i) in wisdomIndicators"
  78. :key="ind.code"
  79. class="indicator-card"
  80. :class="{ 'no-data': !ind.value }"
  81. @click="goWisdomDetail()"
  82. >
  83. <view class="indicator-header">
  84. <text class="indicator-name">{{ ind.name }}</text>
  85. <text class="indicator-unit" v-if="ind.unit">{{ ind.unit }}</text>
  86. </view>
  87. <view class="indicator-body">
  88. <text class="indicator-value" v-if="ind.value || ind.numericValue !== null">{{ ind.value || formatNumeric(ind.numericValue) }}</text>
  89. <text class="indicator-placeholder" v-else>暂无数据</text>
  90. </view>
  91. <view class="indicator-footer">
  92. <text class="indicator-range" v-if="ind.refRange">参考: {{ ind.refRange }}</text>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 学习解读 -->
  98. <view class="section score-explain-card" v-if="isLoggedIn && currentView === 'self' && dualDimension">
  99. <view class="explain-header">
  100. <text class="explain-icon">{{ (dualDimension.primary && dualDimension.primary.score || 0) >= 80 ? '✅' : (dualDimension.primary && dualDimension.primary.score || 0) >= 60 ? '⚠️' : '❗' }}</text>
  101. <text class="explain-title">学习解读</text>
  102. </view>
  103. <text class="explain-text">{{ (dualDimension.primary && dualDimension.primary.score || 0) >= 80 ? '学习能力良好,继续保持学习节奏。' : (dualDimension.primary && dualDimension.primary.score || 0) >= 60 ? '学习能力一般,建议多做认知训练。' : '学习能力需要提升,建议进行专业评估。' }}</text>
  104. </view>
  105. <!-- ===== 认知强项与提升空间 ===== -->
  106. <view class="section cognitive-insight" v-if="isLoggedIn && cognitiveReport">
  107. <view class="section-header">
  108. <text class="section-title">📈 认知强项与提升</text>
  109. </view>
  110. <template v-if="cogStrengths.length > 0 || cogImproves.length > 0">
  111. <view class="insight-group" v-if="cogStrengths.length > 0">
  112. <text class="insight-group-title">💪 你的强项</text>
  113. <view class="insight-item" v-for="(item, idx) in cogStrengths" :key="getInsightKey('s', idx)">
  114. <text class="insight-item-name">{{ item.label }}</text>
  115. <text class="insight-item-score">{{ item.score }}分</text>
  116. <text class="insight-item-tag tag-strong">强项</text>
  117. </view>
  118. </view>
  119. <view class="insight-group" v-if="cogImproves.length > 0">
  120. <text class="insight-group-title">🌱 提升空间</text>
  121. <view class="insight-item" v-for="(item, idx) in cogImproves" :key="getInsightKey('i', idx)">
  122. <text class="insight-item-name">{{ item.label }}</text>
  123. <text class="insight-item-score">{{ item.score }}分</text>
  124. <text class="insight-item-tag tag-improve">待提升</text>
  125. </view>
  126. </view>
  127. <view class="insight-tip" v-if="cogStrengths.length > 0 && cogImproves.length > 0">
  128. <text class="insight-tip-text">强项保持,薄弱维建议通过训练中心针对性提升</text>
  129. </view>
  130. </template>
  131. <view class="insight-empty" v-else-if="!cognitiveReport || !hasCognitiveScore">
  132. <text class="insight-empty-text">完成认知测评,查看强项与提升建议</text>
  133. <button class="insight-btn" @click="goCognitiveReport">去测评</button>
  134. </view>
  135. </view>
  136. <!-- 心维度画像 - 总体说明 -->
  137. <view class="dimension-portrait-section" v-if="isLoggedIn && wisdomPortrait">
  138. <view class="section-header">
  139. <text class="section-title">🧭 心维度画像</text>
  140. <text class="portrait-tier">{{ wisdomPortrait.tierLabel }}</text>
  141. </view>
  142. <view class="portrait-summary">
  143. <text class="portrait-desc">{{ wisdomPortrait.summary }}</text>
  144. </view>
  145. <view class="portrait-dimensions">
  146. <view class="portrait-dim-item" v-for="dim in wisdomPortrait.dims" :key="dim.code">
  147. <view class="portrait-dim-header">
  148. <view class="portrait-dim-icon" :style="{ background: dim.color }">{{ dim.icon }}</view>
  149. <text class="portrait-dim-name">{{ dim.name }}</text>
  150. <text class="portrait-dim-score">{{ dim.score }}</text>
  151. </view>
  152. <view class="portrait-dim-bar-track">
  153. <view class="portrait-dim-bar-fill" :style="{ width: dim.score + '%', background: dim.color }"></view>
  154. </view>
  155. <text class="portrait-dim-desc">{{ dim.desc }}</text>
  156. </view>
  157. </view>
  158. <view class="portrait-tip" v-if="wisdomPortrait.tip">
  159. <text class="portrait-tip-text">💡 {{ wisdomPortrait.tip }}</text>
  160. </view>
  161. </view>
  162. <!-- ===== DAN 报告(登录后) ===== -->
  163. <view class="section" v-if="isLoggedIn">
  164. <view class="section-header">
  165. <text class="section-title">&#x1F4CA; DAN 报告</text>
  166. <text class="section-more" @click="goDanUpload">上传 +</text>
  167. </view>
  168. <view class="dan-card" v-for="report in danReports" :key="report.id" @click="viewDanReport(report)">
  169. <view class="dan-card-header">
  170. <text class="dan-report-date">{{ formatDate(report.assessmentDate) }}</text>
  171. <text :class="['dan-status', report.draftStatus === 'confirmed' ? 'confirmed' : 'pending']">
  172. {{ report.draftStatus === 'confirmed' ? '已确认' : '待确认' }}
  173. </text>
  174. </view>
  175. <text class="dan-report-desc">DAN B4 智维度测评报告</text>
  176. </view>
  177. <view class="dan-empty" v-if="danReports.length === 0">
  178. <text class="dan-empty-text">暂无 DAN 报告,点击上方「上传 +」上传测评报告</text>
  179. </view>
  180. </view>
  181. <!-- 肠胃与认知卡片(有菌群报告显示认知指标,无报告引导上传) -->
  182. <view class="section gut-cognition-card" v-if="isLoggedIn">
  183. <view class="section-header">
  184. <text class="section-title">🦠 肠胃与认知</text>
  185. </view>
  186. <text class="gut-cog-subtitle">肠脑轴 · 肠道菌群,影响学习与思维</text>
  187. <template v-if="cognitionGutIndicators && cognitionGutIndicators.length > 0">
  188. <view class="gut-indicator-list">
  189. <view class="gut-indicator-item" v-for="ind in cognitionGutIndicators" :key="ind.id">
  190. <view class="gut-indicator-left">
  191. <text class="gut-indicator-name">{{ ind.indicatorName || ind.name }}</text>
  192. <text class="gut-indicator-impact" v-if="cognitiveImpactLabel(ind.indicatorName || ind.name)">影响{{ cognitiveImpactLabel(ind.indicatorName || ind.name) }}</text>
  193. </view>
  194. <view class="gut-indicator-bar-track">
  195. <view class="gut-indicator-bar-fill" :style="{ width: indicatorBarWidth(ind), background: indicatorColor(ind.status) }"></view>
  196. </view>
  197. <text class="gut-indicator-value">{{ formatIndicatorValue(ind) }}{{ ind.unit || '%' }}</text>
  198. <text :class="['gut-indicator-status', 'status-' + (ind.status || 'normal')]">{{ statusLabel(ind.status) }}</text>
  199. </view>
  200. </view>
  201. </template>
  202. <view class="gut-empty" v-else>
  203. <text class="gut-empty-icon">📄</text>
  204. <text class="gut-empty-text">上传菌群报告,查看认知相关指标</text>
  205. <button class="gut-upload-btn" @click="goReportUpload">去上传</button>
  206. </view>
  207. </view>
  208. <!-- 6. 功能入口 -->
  209. <view class="func-section" v-if="sectionVisible('func_entries')">
  210. <view class="func-grid">
  211. <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
  212. <view class="func-icon-wrap">
  213. <text class="func-icon">{{ item.icon }}</text>
  214. </view>
  215. <text class="func-label">{{ item.label }}</text>
  216. </view>
  217. </view>
  218. </view>
  219. <!-- 智维度介绍卡片(登录后显示) -->
  220. <DimensionIntroCard dimCode="wisdom" v-if="isLoggedIn" learn-more-url="/pages/wisdom-detail/dimension-intro" />
  221. <!-- 底部占位 -->
  222. <view class="bottom-spacer"></view>
  223. <FloatingAvatar />
  224. </view>
  225. </template>
  226. <script>
  227. import { BrandColors } from '../../utils/brand-colors.js'
  228. import nav from '../../utils/nav'
  229. import TabTransition from '../../components/tab-transition.vue'
  230. import RadarChart from '../../components/RadarChart.vue'
  231. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  232. import FloatingAvatar from '../../components/AIFloatingAvatar.vue'
  233. import DimensionIntroCard from '../../components/DimensionIntroCard.vue'
  234. import DimensionVisitorCard from '../../components/DimensionVisitorCard.vue'
  235. import DimensionPageSkeleton from '../../components/DimensionPageSkeleton.vue'
  236. import MemberSelector from '@/components/MemberSelector.vue'
  237. import { getVisibleSections, getChildren, getFamilyEnergySandbox, getEnergySandbox, getAssessmentLatestResult, getDanReportByChild, getGutCognitionIndicators, getLatestIndicators, getRadarData, getFamilyMemberList, kickFamilyMemberById } from '../../utils/api.js'
  238. import { parseDate } from '../../utils/format.js'
  239. import fontScaleMixin from '@/mixins/font-scale.js'
  240. export default {
  241. mixins: [fontScaleMixin],
  242. components: { TabTransition, RadarChart, FamilyEnergyBar, FloatingAvatar, MemberSelector, DimensionIntroCard, DimensionVisitorCard, DimensionPageSkeleton },
  243. data() {
  244. return {
  245. gridColor: BrandColors.indigo100,
  246. labelColor: BrandColors.indigo800,
  247. wisdomColor: BrandColors.wisdom,
  248. memberScoreMap: {},
  249. pageLoading: false,
  250. isLoggedIn: false,
  251. role: null,
  252. showTabTransition: true,
  253. activeChildId: null,
  254. activeChildName: '',
  255. userName: '',
  256. children: [],
  257. familyMembersVisible: [],
  258. selectedMemberId: null,
  259. wisdomSubDims: [],
  260. wisdomIndicators: [],
  261. sandboxData: null,
  262. currentView: 'self', // 'self' | 'family'
  263. dualDimension: null,
  264. visibleSections: [],
  265. cognitiveReport: null,
  266. articles: [],
  267. /** 认知雷达图:家庭平均分(默认取同龄同性 P50 常模) */
  268. cognitiveFamilyScores: [],
  269. /** 认知雷达图:人群位置(同龄同性 P50 常模,接口返回,失败时不显示假数据) */
  270. cognitivePopulationScores: [],
  271. danReports: [],
  272. cognitionGutIndicators: [],
  273. funcList: [
  274. { icon: '\u{1F4CA}', label: '认知报告', needLogin: true, page: '/pages/wisdom-detail/cognitive-report' },
  275. { icon: '\u{1F9E0}', label: '训练中心', needLogin: true, page: '/pages/wisdom-detail/training-hub' },
  276. { icon: '\u{1F3AF}', label: '测评预约', needLogin: false, page: '/pages/assessment/apply' },
  277. { icon: '\u{1F4D6}', label: '阅读天地', needLogin: false, page: '/pages/article-center/index?dimension=wisdom' }
  278. ]
  279. }
  280. },
  281. computed: {
  282. wisdomArticles: function() {
  283. if (!this.articles || this.articles.length === 0) return []
  284. var result = []
  285. for (var i = 0; i < this.articles.length; i++) {
  286. var a = this.articles[i]
  287. if (a.relatedDimensions && a.relatedDimensions.indexOf('wisdom') !== -1) {
  288. result.push(a)
  289. }
  290. }
  291. if (result.length === 0) return this.articles.slice(0, 5)
  292. return result.slice(0, 5)
  293. },
  294. cognitiveDimensions: function() {
  295. return [
  296. { label: '感知能力', key: 'perceptionScore' },
  297. { label: '专注力', key: 'focusScore' },
  298. { label: '记忆力', key: 'memoryScore' },
  299. { label: '逻辑思维', key: 'logicScore' },
  300. { label: '空间思维', key: 'spatialScore' },
  301. { label: '加工速度', key: 'processingSpeedScore' },
  302. { label: '成长型思维', key: 'wisdomGrowthMindset' }
  303. ]
  304. },
  305. cognitiveScores: function() {
  306. if (!this.cognitiveReport) return []
  307. var dims = this.cognitiveDimensions
  308. var scores = []
  309. // 解析 structuredAnalysis 中的成长型思维
  310. var growthMindset = 0
  311. if (this.cognitiveReport.structuredAnalysis) {
  312. try {
  313. var analysis = JSON.parse(this.cognitiveReport.structuredAnalysis)
  314. if (analysis && analysis.extra && analysis.extra.growthMindset) {
  315. var gm = analysis.extra.growthMindset
  316. var vals = Object.values(gm)
  317. if (vals.length > 0) growthMindset = parseInt(vals[0]) || 0
  318. }
  319. } catch (e) { /* ignore parse error */ }
  320. }
  321. for (var i = 0; i < dims.length; i++) {
  322. var key = dims[i].key
  323. if (key === 'wisdomGrowthMindset') {
  324. scores.push(growthMindset)
  325. } else {
  326. scores.push(this.cognitiveReport[key] || 0)
  327. }
  328. }
  329. return scores
  330. },
  331. /** 认知测评是否已有有效得分(任一维度 > 0) */
  332. hasCognitiveScore: function() {
  333. if (!this.cognitiveReport) return false
  334. var dims = this.cognitiveDimensions
  335. for (var i = 0; i < dims.length; i++) {
  336. var key = dims[i].key
  337. var v = 0
  338. if (key === 'wisdomGrowthMindset') {
  339. v = this.cognitiveScores[this.cognitiveDimensions.length - 1] || 0
  340. } else {
  341. v = this.cognitiveReport[key] || 0
  342. }
  343. if (v > 0) return true
  344. }
  345. return false
  346. },
  347. /** 认知强项:得分 ≥75 的维度 */
  348. cogStrengths: function() {
  349. var dims = this.cognitiveDimensions
  350. var result = []
  351. for (var i = 0; i < dims.length; i++) {
  352. var score = this.cognitiveScores[i] || 0
  353. if (score >= 75) {
  354. result.push({ label: dims[i].label, score: score })
  355. }
  356. }
  357. return result
  358. },
  359. /** 认知提升空间:得分 <60 的维度 */
  360. cogImproves: function() {
  361. var dims = this.cognitiveDimensions
  362. var result = []
  363. for (var i = 0; i < dims.length; i++) {
  364. var score = this.cognitiveScores[i] || 0
  365. if (score > 0 && score < 60) {
  366. result.push({ label: dims[i].label, score: score })
  367. }
  368. }
  369. return result
  370. },
  371. /** 每月引导语 */
  372. monthlyGuidance: function() {
  373. var month = new Date().getMonth()
  374. var messages = [
  375. '一月:新年新目标,制定学习计划',
  376. '二月:春节收获知识,拓展认知边界',
  377. '三月:植树节到,播种智慧种子',
  378. '四月:清明踏青,激发创造力',
  379. '五月:劳动节后,专注能力提升',
  380. '六月:考试季,科学备考策略',
  381. '七月:暑期黄金期,查漏补缺',
  382. '八月:开学准备,提前规划学习',
  383. '九月:新学期,设定学习目标',
  384. '十月:国庆假期,阅读充电',
  385. '十一月:年终冲刺,巩固知识',
  386. '十二月:年度总结,规划来年学习'
  387. ]
  388. return messages[month] || messages[0]
  389. },
  390. wisdomPortrait: function() {
  391. var self = this
  392. if (!this.isLoggedIn || !this.cognitiveReport) return null
  393. var cognitiveReport = this.cognitiveReport
  394. var dims = [
  395. { key: 'perceptionScore', label: '感知能力', color: BrandColors.mind, desc: '感官获取信息的能力' },
  396. { key: 'focusScore', label: '专注力', color: BrandColors.wealth, desc: '保持注意力集中的能力' },
  397. { key: 'memoryScore', label: '记忆力', color: BrandColors.wisdom, desc: '记忆和回忆信息的能力' },
  398. { key: 'logicScore', label: '逻辑思维', color: BrandColors.success, desc: '分析和推理能力' },
  399. { key: 'spatialScore', label: '空间思维', color: BrandColors.wealth, desc: '操作空间关系的能力' },
  400. { key: 'processingSpeedScore', label: '加工速度', color: BrandColors.body, desc: '快速处理信息的能力' },
  401. { key: 'growthMindset', label: '成长型思维', color: BrandColors.pink, desc: '相信能力可提升的信念' }
  402. ]
  403. var result = { overall: 0, tierLabel: '', summary: '', dims: [], tip: '' }
  404. var total = 0
  405. var count = 0
  406. var dimList = []
  407. for (var i = 0; i < dims.length; i++) {
  408. var key = dims[i].key
  409. var score = 0
  410. if (key === 'growthMindset' && cognitiveReport.structuredAnalysis) {
  411. try {
  412. var analysis = JSON.parse(cognitiveReport.structuredAnalysis)
  413. if (analysis && analysis.extra && analysis.extra.growthMindset) {
  414. var gm = analysis.extra.growthMindset
  415. var vals = Object.values(gm)
  416. if (vals.length > 0) score = parseInt(vals[0]) || 0
  417. }
  418. } catch (e) { /* ignore parse error */ }
  419. } else {
  420. score = cognitiveReport[key] || 0
  421. }
  422. if (isNaN(score)) score = 0
  423. score = Math.max(0, Math.min(100, Number(score)))
  424. total += score
  425. count++
  426. var matched = dims.find(function(d) { return d.key === key })
  427. dimList.push({
  428. code: key,
  429. name: matched ? matched.label : key,
  430. score: Math.round(score),
  431. color: matched ? matched.color : BrandColors.mind,
  432. desc: matched ? matched.desc : ''
  433. })
  434. }
  435. if (count === 0) return null
  436. result.overall = Math.round(total / count)
  437. result.dims = dimList
  438. var o = result.overall
  439. if (o >= 80) {
  440. result.tierLabel = '认知卓越者'
  441. result.summary = '您的认知能力卓越,各项能力均衡强劲,学习效率高。'
  442. result.tip = '保持学习节奏,可进一步拓展更广的知识边界'
  443. } else if (o >= 60) {
  444. result.tierLabel = '认知进取者'
  445. result.summary = '您的认知能力处于良好水平,具备较强的学习潜力。'
  446. result.tip = '针对薄弱维度进行针对性训练,逐步突破瓶颈'
  447. } else if (o >= 40) {
  448. result.tierLabel = '认知探索者'
  449. result.summary = '您的认知能力正在建立基础,关注学习习惯的养成很重要。'
  450. result.tip = '从最容易提升的维度开始,每天投入少量学习时间'
  451. } else {
  452. result.tierLabel = '认知起步者'
  453. result.summary = '您的认知能力需要更多关注和引导,建议从基础认能训练开始。'
  454. result.tip = '建议咨询专业教育者,制定个性化认知发展计划'
  455. }
  456. return result
  457. }
  458. },
  459. created() {
  460. // 首屏加载骨架:已登录用户的数据请求期间占位,稳态视觉零变化
  461. // 未登录走静态内容,不进 loading,故此处不读 isLoggedIn
  462. var token = uni.getStorageSync('token')
  463. if (token) {
  464. this.pageLoading = true
  465. var self = this
  466. setTimeout(function() { self.pageLoading = false }, 600)
  467. }
  468. },
  469. onShow() {
  470. this.showTabTransition = true
  471. var token = uni.getStorageSync('token')
  472. this.isLoggedIn = !!token
  473. if (this.isLoggedIn) {
  474. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  475. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '本人'
  476. }
  477. this.loadSectionConfig()
  478. if (this.isLoggedIn) {
  479. this.loadChildren()
  480. this.loadFamilyMembersVisible()
  481. this.loadCognitiveReport()
  482. this.loadDanReports()
  483. this.loadGutCognitionData()
  484. }
  485. // 游客也能浏览文章
  486. this._watchPageReady()
  487. },
  488. methods: {
  489. getInsightKey: function(prefix, idx) { return prefix + idx },
  490. // 切换成员:同步成员ID并持久化,重载该页全部成员相关数据
  491. onFamilyMemberSelect: function(member) {
  492. if (!member || member.id === this.selectedMemberId) return
  493. this.selectedMemberId = member.id
  494. this.activeChildId = member.id
  495. uni.setStorageSync('currentChildId', member.id)
  496. this.reloadForMember()
  497. },
  498. // 切换成员后的统一重载入口
  499. reloadForMember: function() {
  500. if (!this.isLoggedIn) return
  501. this.loadCognitiveReport()
  502. this.loadDanReports()
  503. this.loadGutCognitionData()
  504. },
  505. // 成员标签长按:唤出管理动作面板
  506. onMemberLongPress: function(member) {
  507. this.showMemberActions(member)
  508. },
  509. // 成员标签管理入口
  510. onMemberManage: function() {
  511. uni.navigateTo({ url: '/pages/profile-extra/family-members' })
  512. },
  513. // 成员管理动作面板(系统 ActionSheet,触摸目标由微信保证)
  514. showMemberActions: function(member) {
  515. if (!member) return
  516. var self = this
  517. var items = ['切换到该成员视角', '编辑资料', '移除成员']
  518. uni.showActionSheet({
  519. itemList: items,
  520. success: function(res) {
  521. if (res.tapIndex === 0) {
  522. uni.navigateTo({ url: '/pages/action-detail/relationship-questionnaire?memberId=' + member.id })
  523. } else if (res.tapIndex === 1) {
  524. uni.navigateTo({ url: '/pages/family/add-member?memberId=' + member.id })
  525. } else if (res.tapIndex === 2) {
  526. uni.showModal({
  527. title: '确认移除',
  528. content: '确定要移除 ' + (member.nickname || '该成员') + ' 吗?',
  529. success: function(m) {
  530. if (m.confirm) {
  531. uni.showLoading({ title: '移除中...' })
  532. kickFamilyMemberById(member.id).then(function() {
  533. uni.hideLoading()
  534. uni.showToast({ title: '已移除', icon: 'success' })
  535. self.loadFamilyMembersVisible()
  536. }).catch(function(err) {
  537. uni.hideLoading()
  538. uni.showToast({ title: (err && err.message) || '移除失败', icon: 'none' })
  539. })
  540. }
  541. }
  542. })
  543. }
  544. }
  545. })
  546. },
  547. loadSectionConfig: function() {
  548. var baseSections = ['func_entries', 'recommended_reading']
  549. if (!uni.getStorageSync('token')) {
  550. this.visibleSections = baseSections
  551. return
  552. }
  553. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  554. var self = this
  555. getVisibleSections({ pageKey: 'wisdom', role: role }).then(function(res) {
  556. if (res.code === 200 && res.data) {
  557. var keys = res.data.map(function(s) { return s.sectionKey })
  558. var merged = baseSections.slice()
  559. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  560. self.visibleSections = merged
  561. }
  562. }).catch(function(e) {
  563. self.visibleSections = ['func_entries', 'recommended_reading']
  564. })
  565. },
  566. loadChildren: function() {
  567. var self = this
  568. getChildren().then(function(res) {
  569. if (res.code === 200 && res.data) {
  570. self.children = res.data
  571. if (self.children.length > 0) {
  572. var activeId = uni.getStorageSync('currentChildId')
  573. if (activeId) {
  574. for (var i = 0; i < self.children.length; i++) {
  575. if (self.children[i].id == activeId) {
  576. self.activeChildId = activeId
  577. self.activeChildName = self.children[i].nickname || self.children[i].name || ''
  578. break
  579. }
  580. }
  581. }
  582. // Fallback: 首次进入或未选成员时,默认选第一个成员以加载认知数据(仅本地状态,不触发全局切换)
  583. if (!self.activeChildId && self.children.length > 0) {
  584. self.activeChildId = self.children[0].id
  585. self.activeChildName = self.children[0].nickname || self.children[0].name || ''
  586. }
  587. }
  588. // Load cognitive report if activeChildId is available
  589. if (self.activeChildId) {
  590. self.loadCognitiveReport()
  591. }
  592. }
  593. }).catch(function(e) {})
  594. },
  595. loadWisdomIndicators: function(memberId) {
  596. var self = this
  597. getLatestIndicators({ memberId: memberId, domain: 'wisdom' }).then(function(res) {
  598. if (res.code === 200) self.wisdomIndicators = res.data || []
  599. }).catch(function(e) { console.log('[wisdom] loadWisdomIndicators failed', e) })
  600. },
  601. goWisdomDetail: function() {
  602. var id = this.activeChildId || uni.getStorageSync('currentChildId')
  603. if (!id) return
  604. uni.navigateTo({ url: '/pages/wisdom-detail/member-wisdom-detail?memberId=' + id })
  605. },
  606. formatNumeric: function(v) {
  607. if (v === null || v === undefined) return ''
  608. var n = parseFloat(v)
  609. if (isNaN(n)) return String(v)
  610. return n % 1 === 0 ? String(n) : n.toFixed(1)
  611. },
  612. loadFamilyMembersVisible: function() {
  613. var self = this
  614. getFamilyMemberList({}).then(function(res) {
  615. if (res.code === 200 && res.data) {
  616. // 保留后端全字段:成员标签需要 relationship/relativeLabel/roleLabel/effectiveRole/isSelf 等
  617. self.familyMembersVisible = res.data.map(function(m) {
  618. return {
  619. id: m.id,
  620. memberId: m.memberId,
  621. nickname: m.nickname,
  622. avatar: m.avatar,
  623. relationship: m.relationship,
  624. relativeLabel: m.relativeLabel,
  625. roleLabel: m.roleLabel,
  626. effectiveRole: m.effectiveRole,
  627. generation: m.generation,
  628. phone: m.phone,
  629. isSelf: m.isSelf,
  630. isSwitchable: m.isSwitchable
  631. }
  632. })
  633. }
  634. }).catch(function(e) { console.log('获取家庭成员失败', e) })
  635. },
  636. loadCognitiveReport: function() {
  637. var self = this
  638. var memberId = this.activeChildId
  639. if (!memberId) return
  640. getAssessmentLatestResult(memberId).then(function(res) {
  641. if (res.code === 200 && res.data) {
  642. self.cognitiveReport = res.data
  643. self.wisdomSubDims = (function() { var r = self.cognitiveReport || {}; return [{label:'感知能力', score:r.perceptionScore||0, desc:'通过感官获取信息'}, {label:'专注力', score:r.focusScore||0, desc:'保持注意力集中'}, {label:'记忆力', score:r.memoryScore||0, desc:'记忆和回忆信息'}, {label:'逻辑思维', score:r.logicScore||0, desc:'分析和推理能力'}, {label:'空间思维', score:r.spatialScore||0, desc:'操作空间关系'}, {label:'加工速度', score:r.processingSpeedScore||0, desc:'快速处理信息'}, {label:'成长型思维', score:r.growthMindset||0, desc:'相信能力可提升'}]; })();
  644. self.loadWisdomIndicators(memberId)
  645. self.loadCognitiveRadarData(memberId)
  646. }
  647. }).catch(function(e) {})
  648. },
  649. loadCognitiveRadarData: function(memberId) {
  650. var self = this
  651. if (!memberId) return
  652. getRadarData({ memberId: memberId, dimensions: ['perception','focus','memory','logic','spatial','processingSpeed','wisdomGrowthMindset'] }).then(function(res) {
  653. if (res && res.data) {
  654. self.cognitiveFamilyScores = res.data.familyScores || []
  655. self.cognitivePopulationScores = res.data.populationScores || []
  656. }
  657. }).catch(function(e) {
  658. console.warn('[wisdom] radar-data failed', e)
  659. })
  660. },
  661. onChildChanged: function(memberId) {
  662. this.activeChildId = memberId
  663. // FIX: 同步提交到 Vuex store
  664. this.$store.commit('switchToChild', memberId)
  665. for (var i = 0; i < this.children.length; i++) {
  666. if (this.children[i].id == memberId) {
  667. this.activeChildName = this.children[i].nickname || this.children[i].name || ''
  668. break
  669. }
  670. }
  671. this.loadFamilyMembersVisible()
  672. this.loadCognitiveReport()
  673. this.loadDanReports()
  674. },
  675. sectionVisible: function(key) {
  676. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  677. },
  678. onFuncClick: function(item) {
  679. if (item.needLogin && !this.isLoggedIn) {
  680. uni.showModal({
  681. title: '提示',
  682. content: '请先登录后使用此功能',
  683. success: (res) => { if (res.confirm) this.openLoginSheet() }
  684. })
  685. return
  686. }
  687. if (item.page) {
  688. nav.goPage(item.page)
  689. }
  690. },
  691. scrollToSection: function(section) {},
  692. // 登录成功:刷新登录态数据(镜像 onShow 已登录分支)
  693. onLoginSuccess: function() {
  694. this.isLoggedIn = true
  695. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  696. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '本人'
  697. this.loadSectionConfig()
  698. this.loadChildren()
  699. this.loadFamilyMembersVisible()
  700. this.loadCognitiveReport()
  701. this.loadDanReports()
  702. this.loadGutCognitionData()
  703. this._watchPageReady()
  704. },
  705. goCognitiveReport: function() {
  706. uni.navigateTo({ url: '/pages/wisdom-detail/cognitive-report' })
  707. },
  708. _watchPageReady() {
  709. var self = this
  710. var unwatch = this.$watch(function() {
  711. if (self.isLoggedIn) {
  712. return !!(self.cognitiveReport || self.sandboxData)
  713. } }, function(val) {
  714. if (val) {
  715. if (unwatch) unwatch()
  716. if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
  717. }
  718. })
  719. },
  720. // ===== DAN 报告 =====
  721. loadDanReports: function() {
  722. var self = this
  723. var memberId = self.activeChildId
  724. if (!memberId) return
  725. getDanReportByChild(memberId, 'wisdom').then(function(res) {
  726. if (res.code === 200 && res.data) {
  727. self.danReports = res.data
  728. }
  729. }).catch(function() {})
  730. },
  731. // ===== 肠胃与认知(肠脑轴认知指标) =====
  732. loadGutCognitionData: function() {
  733. var self = this
  734. var memberId = self.activeChildId
  735. if (!memberId) return
  736. getGutCognitionIndicators(memberId).then(function(res) {
  737. if (res.code === 200 && res.data) {
  738. var list = res.data
  739. self.cognitionGutIndicators = Array.isArray(list) ? list.slice(0, 6) : []
  740. } else {
  741. self.cognitionGutIndicators = []
  742. }
  743. }).catch(function() {
  744. self.cognitionGutIndicators = []
  745. })
  746. },
  747. // 认知影响映射:指标名 → 影响的认知功能
  748. cognitiveImpactLabel: function(name) {
  749. if (!name) return ''
  750. if (name.indexOf('多巴胺') !== -1 || name.indexOf('Dopamine') !== -1) return '专注力'
  751. if (name.indexOf('谷氨酸') !== -1 || name.indexOf('Glutamate') !== -1) return '学习记忆'
  752. if (name.indexOf('乙酰胆碱') !== -1) return '记忆力'
  753. if (name.indexOf('色氨酸') !== -1 || name.indexOf('Tryptophan') !== -1) return '睡眠·记忆'
  754. if (name.indexOf('丁酸') !== -1 || name.indexOf('Butyrate') !== -1) return '脑健康'
  755. if (name.indexOf('丙酸') !== -1 || name.indexOf('Propionate') !== -1) return '脑健康'
  756. if (name.indexOf('乙酸') !== -1 || name.indexOf('Acetate') !== -1) return '脑健康'
  757. if (name.indexOf('组胺') !== -1 || name.indexOf('Histamine') !== -1) return '注意力·觉醒'
  758. if (name.indexOf('短链脂肪酸') !== -1) return '脑健康'
  759. return ''
  760. },
  761. indicatorColor: function(status) {
  762. if (status === 'abnormal' || status === '偏高' || status === '偏低' || status === '过高' || status === '缺乏') return BrandColors.danger
  763. if (status === 'warning' || status === '注意' || status === '不足') return BrandColors.wealth
  764. return BrandColors.success
  765. },
  766. statusLabel: function(status) {
  767. if (status === 'normal') return '正常'
  768. if (status === 'abnormal') return '异常'
  769. if (status === 'warning') return '警讯'
  770. if (status === '过高' || status === '过多') return '偏高'
  771. if (status === '缺乏' || status === '不足') return '偏低'
  772. return status || '正常'
  773. },
  774. // 指标值展示:后端字段为 indicatorValue,兼容数值型(如 0.32)
  775. formatIndicatorValue: function(ind) {
  776. if (!ind) return ''
  777. var v = ind.value !== undefined && ind.value !== null ? ind.value : ind.indicatorValue
  778. if (v === undefined || v === null || v === '') return ''
  779. return String(v)
  780. },
  781. // 指标条宽度:将指标值归一化为 0-100 百分比(仅对纯数字有效,否则按状态给默认宽度)
  782. indicatorBarWidth: function(ind) {
  783. var raw = ind.value !== undefined && ind.value !== null ? ind.value : ind.indicatorValue
  784. var n = parseFloat(raw)
  785. if (!isNaN(n) && n >= 0 && n <= 100) return n + '%'
  786. if (!isNaN(n) && n > 100) return '100%'
  787. // 非数值(如 "偏低"/"未检出"),按状态给默认可视化宽度
  788. var st = ind.status || ''
  789. if (st === '偏低' || st === '缺乏' || st === '不足' || st === 'abnormal') return '30%'
  790. if (st === '过高' || st === '过多' || st === 'warning') return '75%'
  791. return '55%'
  792. },
  793. goReportUpload: function() {
  794. uni.navigateTo({ url: '/pages/health/report-upload' })
  795. },
  796. goDanUpload: function() {
  797. uni.navigateTo({ url: '/pages/health/report-upload?type=a2' })
  798. },
  799. viewDanReport: function(report) {
  800. var reportId = report.sourceReportId || report.id
  801. uni.navigateTo({ url: '/pages/dan-assessment/report-result?reportId=' + reportId })
  802. },
  803. formatDate: function(dateStr) {
  804. if (!dateStr) return ''
  805. var d = parseDate(dateStr)
  806. if (!d) return ''
  807. return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  808. }
  809. }
  810. }
  811. </script>
  812. <style scoped lang="scss">
  813. // 页面级局部调色板:仅本页专有色阶,跨页共性一律走 uni.scss 全局令牌
  814. // 浅蓝底 B(单页专有;vs $dim-wisdom-tint-3 $dim-wisdom-tint-3 全局邻档)
  815. $c-tint-b: #F8FAFF;
  816. // 浅蓝底 D(单页专有;vs $dim-wisdom-tint-2 $dim-wisdom-tint-2 全局邻档)
  817. $c-tint-d: #E8F1FE;
  818. // 强文字(深色块内;单页专有;vs $facade-text-strong $facade-text-strong 全局深档)
  819. $c-ink-strong: #1D1D1F;
  820. .wisdom-container {
  821. min-height: 100vh;
  822. background: $app-bg;
  823. padding-bottom: 120rpx;
  824. }
  825. .func-section {
  826. margin: 20rpx 20rpx 0;
  827. }
  828. .func-grid {
  829. background: $app-surface;
  830. border-radius: 24rpx;
  831. padding: $uni-space-lg 16rpx;
  832. display: flex;
  833. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  834. }
  835. .func-item {
  836. flex: 1;
  837. display: flex;
  838. flex-direction: column;
  839. align-items: center;
  840. }
  841. .func-item:active {
  842. opacity: 0.7;
  843. }
  844. .func-icon-wrap {
  845. width: 88rpx;
  846. height: 88rpx;
  847. border-radius: 50%;
  848. background: rgba(99,102,241,0.12);
  849. display: flex;
  850. align-items: center;
  851. justify-content: center;
  852. margin-bottom: 10rpx;
  853. }
  854. .func-icon {
  855. font-size: calc(40rpx * var(--font-scale, 1));
  856. }
  857. .func-label {
  858. font-size: calc(24rpx * var(--font-scale, 1));
  859. color: $app-text;
  860. font-weight: 500;
  861. }
  862. /* ===== Section ===== */
  863. .section {
  864. margin: 20rpx 20rpx;
  865. }
  866. .section-header {
  867. display: flex;
  868. flex-wrap: wrap;
  869. justify-content: space-between;
  870. align-items: center;
  871. margin-bottom: 20rpx;
  872. }
  873. .section-title {
  874. font-size: calc(30rpx * var(--font-scale, 1));
  875. font-weight: bold;
  876. color: $app-text;
  877. }
  878. /* 页面说明(独占一行,避免与标题挤在同一行) */
  879. .section-sub {
  880. flex: 1 1 100%;
  881. font-size: calc(22rpx * var(--font-scale, 1));
  882. color: $app-text-subtle;
  883. line-height: 1.4;
  884. margin-top: 6rpx;
  885. display: block;
  886. }
  887. .section-more {
  888. position: relative;
  889. flex-shrink: 0;
  890. font-size: calc(24rpx * var(--font-scale, 1));
  891. color: $dim-wisdom;
  892. }
  893. /* 触摸目标扩展至 88rpx(微信最小可点区域):文字链 ~34rpx -> 88rpx,视觉零变化 */
  894. .section-more::after {
  895. content: '';
  896. position: absolute;
  897. left: -8rpx;
  898. right: -16rpx;
  899. top: -27rpx;
  900. bottom: -27rpx;
  901. }
  902. /* 得分解读卡片 */
  903. .score-explain-card {
  904. background: $app-surface;
  905. border-radius: 24rpx;
  906. padding: 28rpx 24rpx;
  907. border-left: 8rpx solid $dim-wisdom;
  908. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  909. }
  910. .explain-header {
  911. display: flex;
  912. align-items: center;
  913. margin-bottom: 14rpx;
  914. }
  915. .explain-icon {
  916. font-size: calc(36rpx * var(--font-scale, 1));
  917. margin-right: 10rpx;
  918. }
  919. .explain-title {
  920. font-size: calc(30rpx * var(--font-scale, 1));
  921. font-weight: bold;
  922. color: $app-text;
  923. }
  924. .explain-text {
  925. font-size: calc(26rpx * var(--font-scale, 1));
  926. color: $app-text-secondary;
  927. line-height: 1.6;
  928. display: block;
  929. }
  930. /* 主按钮 */
  931. .primary-btn {
  932. background: linear-gradient(135deg, $dim-wisdom, $dim-wisdom-deep);
  933. color: $app-surface;
  934. font-size: calc(26rpx * var(--font-scale, 1));
  935. font-weight: bold;
  936. border: none;
  937. border-radius: 24rpx;
  938. padding: 18rpx 56rpx;
  939. line-height: 1.6;
  940. margin: 0;
  941. box-shadow: 0 4rpx 16rpx rgba(79,70,229,0.35);
  942. }
  943. .primary-btn:active {
  944. opacity: 0.88;
  945. }
  946. /* ===== 底部占位 ===== */
  947. .indicator-cards-section { margin: 20rpx $uni-space-lg; }
  948. .indicator-cards { display: flex; flex-direction: row; flex-wrap: wrap; gap: 16rpx; }
  949. .indicator-card { width: calc(50% - 8rpx); background: $app-surface; border-radius: 24rpx; padding: 24rpx 20rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  950. .indicator-card.no-data { opacity: 0.5; }
  951. .indicator-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12rpx; }
  952. .indicator-name { font-size: calc(26rpx * var(--font-scale, 1)); color: $app-text-secondary; font-weight: 500; }
  953. .indicator-unit { font-size: calc(22rpx * var(--font-scale, 1)); color: $app-text-muted; }
  954. .indicator-body { margin-bottom: 8rpx; }
  955. .indicator-value { font-size: calc(40rpx * var(--font-scale, 1)); font-weight: bold; color: $dim-wisdom; }
  956. .indicator-placeholder { font-size: calc(26rpx * var(--font-scale, 1)); color: $app-border; }
  957. .indicator-range { font-size: calc(20rpx * var(--font-scale, 1)); color: $app-border; }
  958. .bottom-spacer { height: 120rpx; }
  959. /* DAN 报告卡片 */
  960. .dan-card {
  961. background: $app-surface;
  962. border-radius: 16rpx;
  963. padding: 24rpx;
  964. margin-bottom: 16rpx;
  965. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  966. }
  967. .dan-card-header {
  968. display: flex;
  969. justify-content: space-between;
  970. align-items: center;
  971. margin-bottom: 12rpx;
  972. }
  973. .dan-report-date {
  974. font-size: calc(26rpx * var(--font-scale, 1));
  975. color: $app-text-secondary;
  976. }
  977. .dan-status {
  978. font-size: calc(22rpx * var(--font-scale, 1));
  979. padding: 4rpx 16rpx;
  980. border-radius: 8rpx;
  981. }
  982. .dan-status.confirmed {
  983. background: $status-success-soft;
  984. color: $status-success-strong;
  985. }
  986. .dan-status.pending {
  987. background: $status-warning-soft;
  988. color: $status-warning-strong;
  989. }
  990. .dan-report-desc {
  991. font-size: calc(28rpx * var(--font-scale, 1));
  992. color: $app-text;
  993. font-weight: 500;
  994. margin-bottom: 12rpx;
  995. display: block;
  996. }
  997. .dan-card-footer {
  998. text-align: right;
  999. }
  1000. .dan-view-link {
  1001. font-size: calc(26rpx * var(--font-scale, 1));
  1002. color: $dim-wisdom;
  1003. }
  1004. .dan-empty {
  1005. background: $app-surface;
  1006. border-radius: 16rpx;
  1007. padding: 40rpx 24rpx;
  1008. text-align: center;
  1009. }
  1010. .dan-empty-text {
  1011. font-size: calc(24rpx * var(--font-scale, 1));
  1012. color: $app-text-muted;
  1013. }
  1014. .avg-badge {
  1015. flex: 1 1 100%;
  1016. font-size: calc(20rpx * var(--font-scale, 1));
  1017. color: $app-text-subtle;
  1018. margin-top: 6rpx;
  1019. display: block;
  1020. }
  1021. /* 品牌定位语 */
  1022. .brand-strap {
  1023. margin: 16rpx $uni-space-lg 0;
  1024. padding: 24rpx 28rpx;
  1025. background: linear-gradient(135deg, $dim-wisdom-tint, rgba(99,102,241,0.16));
  1026. border-radius: 16rpx;
  1027. border-left: 8rpx solid $dim-wisdom;
  1028. box-shadow: 0 2rpx 12rpx rgba(99,102,241,0.12);
  1029. }
  1030. .brand-strap-text {
  1031. font-size: calc(26rpx * var(--font-scale, 1));
  1032. color: $dim-wisdom-ink;
  1033. font-weight: bold;
  1034. line-height: 1.5;
  1035. }
  1036. /* 每月引导语 */
  1037. .monthly-guidance {
  1038. margin: 16rpx $uni-space-lg 0;
  1039. padding: 20rpx 28rpx;
  1040. background: linear-gradient(135deg, $dim-wisdom-tint, rgba(99,102,241,0.08));
  1041. border-radius: 16rpx;
  1042. border-left: 8rpx solid $dim-wisdom;
  1043. display: flex;
  1044. align-items: center;
  1045. gap: 12rpx;
  1046. }
  1047. .guidance-icon { font-size: calc(32rpx * var(--font-scale, 1)); }
  1048. .guidance-text {
  1049. font-size: calc(26rpx * var(--font-scale, 1));
  1050. color: $dim-wisdom-ink;
  1051. font-weight: 500;
  1052. }
  1053. /* ===== 肠胃与认知卡片 ===== */
  1054. .gut-cog-subtitle {
  1055. font-size: calc(24rpx * var(--font-scale, 1));
  1056. color: $dim-wisdom;
  1057. margin-bottom: 16rpx;
  1058. display: block;
  1059. }
  1060. .gut-indicator-list {
  1061. display: flex;
  1062. flex-direction: column;
  1063. gap: 12rpx;
  1064. }
  1065. .gut-indicator-item {
  1066. display: flex;
  1067. align-items: center;
  1068. gap: 12rpx;
  1069. }
  1070. .gut-indicator-left {
  1071. width: 110rpx;
  1072. flex-shrink: 0;
  1073. }
  1074. .gut-indicator-name {
  1075. font-size: calc(22rpx * var(--font-scale, 1));
  1076. color: $app-text-secondary;
  1077. font-weight: 500;
  1078. display: block;
  1079. }
  1080. .gut-indicator-impact {
  1081. font-size: calc(18rpx * var(--font-scale, 1));
  1082. color: $dim-wisdom;
  1083. display: block;
  1084. margin-top: 2rpx;
  1085. }
  1086. .gut-indicator-bar-track {
  1087. flex: 1;
  1088. height: 16rpx;
  1089. background: $app-surface-subtle;
  1090. border-radius: 8rpx;
  1091. overflow: hidden;
  1092. }
  1093. .gut-indicator-bar-fill {
  1094. height: 100%;
  1095. border-radius: 8rpx;
  1096. transition: width 0.3s;
  1097. }
  1098. .gut-indicator-value {
  1099. font-size: calc(22rpx * var(--font-scale, 1));
  1100. color: $app-text-secondary;
  1101. width: 60rpx;
  1102. text-align: right;
  1103. }
  1104. .gut-indicator-status {
  1105. font-size: calc(20rpx * var(--font-scale, 1));
  1106. padding: 2rpx 12rpx;
  1107. border-radius: 8rpx;
  1108. width: 60rpx;
  1109. text-align: center;
  1110. }
  1111. .status-normal {
  1112. background: $status-success-soft;
  1113. color: $status-success-deep;
  1114. }
  1115. .status-abnormal {
  1116. background: $status-danger-soft;
  1117. color: $status-danger-deep;
  1118. }
  1119. .status-warning {
  1120. background: $status-warning-soft;
  1121. color: $status-warning-deep;
  1122. }
  1123. .gut-empty {
  1124. display: flex;
  1125. flex-direction: column;
  1126. align-items: center;
  1127. padding: 40rpx 0;
  1128. }
  1129. .gut-empty-icon {
  1130. font-size: calc($uni-font-size-display * var(--font-scale, 1));
  1131. margin-bottom: 16rpx;
  1132. }
  1133. .gut-empty-text {
  1134. font-size: calc(26rpx * var(--font-scale, 1));
  1135. color: $app-text-muted;
  1136. margin-bottom: 24rpx;
  1137. }
  1138. .gut-upload-btn {
  1139. background: linear-gradient(135deg, $dim-wisdom, $dim-wisdom-light);
  1140. color: $app-surface;
  1141. font-size: calc(26rpx * var(--font-scale, 1));
  1142. font-weight: 600;
  1143. border: none;
  1144. border-radius: 24rpx;
  1145. padding: 16rpx 64rpx;
  1146. line-height: 1.6;
  1147. margin: 0;
  1148. }
  1149. /* ===== 认知强项与提升卡片 ===== */
  1150. .insight-group {
  1151. margin-bottom: 16rpx;
  1152. }
  1153. .insight-group-title {
  1154. font-size: calc(26rpx * var(--font-scale, 1));
  1155. font-weight: 600;
  1156. color: $app-text;
  1157. margin-bottom: 10rpx;
  1158. display: block;
  1159. }
  1160. .insight-item {
  1161. display: flex;
  1162. align-items: center;
  1163. padding: 12rpx 16rpx;
  1164. background: $c-tint-b;
  1165. border-radius: 16rpx;
  1166. margin-bottom: 8rpx;
  1167. }
  1168. .insight-item-name {
  1169. flex: 1;
  1170. font-size: calc(26rpx * var(--font-scale, 1));
  1171. color: $app-text;
  1172. }
  1173. .insight-item-score {
  1174. font-size: calc(24rpx * var(--font-scale, 1));
  1175. color: $app-text-secondary;
  1176. margin-right: 12rpx;
  1177. }
  1178. .insight-item-tag {
  1179. font-size: calc(20rpx * var(--font-scale, 1));
  1180. padding: 4rpx 16rpx;
  1181. border-radius: 8rpx;
  1182. font-weight: 500;
  1183. }
  1184. .insight-item-tag.tag-strong {
  1185. background: $status-success-soft;
  1186. color: $status-success-deep;
  1187. }
  1188. .insight-item-tag.tag-improve {
  1189. background: $status-warning-soft;
  1190. color: $status-warning-deep;
  1191. }
  1192. .insight-tip {
  1193. padding: 12rpx 16rpx;
  1194. background: $dim-wisdom-tint-2;
  1195. border-radius: 16rpx;
  1196. }
  1197. .insight-tip-text {
  1198. font-size: calc(22rpx * var(--font-scale, 1));
  1199. color: $dim-wisdom;
  1200. }
  1201. .insight-empty {
  1202. display: flex;
  1203. flex-direction: column;
  1204. align-items: center;
  1205. padding: $uni-space-lg 0;
  1206. }
  1207. .insight-empty-text {
  1208. font-size: calc(24rpx * var(--font-scale, 1));
  1209. color: $app-text-muted;
  1210. margin-bottom: 20rpx;
  1211. }
  1212. .insight-btn {
  1213. background: linear-gradient(135deg, $dim-wisdom, $dim-wisdom-light);
  1214. color: $app-surface;
  1215. font-size: calc(26rpx * var(--font-scale, 1));
  1216. font-weight: 600;
  1217. border: none;
  1218. border-radius: 24rpx;
  1219. padding: 14rpx 60rpx;
  1220. line-height: 1.6;
  1221. margin: 0;
  1222. }
  1223. /* 维度画像样式 */
  1224. .dimension-portrait-section {
  1225. margin: 24rpx $uni-space-lg;
  1226. background: $app-surface;
  1227. border-radius: 24rpx;
  1228. padding: 32rpx 24rpx;
  1229. box-shadow: 0 4rpx 20rpx rgba(99, 102, 241, 0.12);
  1230. border: 2rpx solid rgba(99, 102, 241, 0.1);
  1231. }
  1232. .portrait-tier {
  1233. font-size: calc(26rpx * var(--font-scale, 1));
  1234. color: $dim-wisdom;
  1235. font-weight: bold;
  1236. margin-left: 16rpx;
  1237. }
  1238. .portrait-summary {
  1239. margin-bottom: 24rpx;
  1240. }
  1241. .portrait-desc {
  1242. font-size: calc(26rpx * var(--font-scale, 1));
  1243. color: $app-text-secondary;
  1244. line-height: 1.6;
  1245. display: block;
  1246. }
  1247. .portrait-dimensions {
  1248. margin-bottom: 20rpx;
  1249. }
  1250. .portrait-dim-item {
  1251. margin-bottom: 18rpx;
  1252. }
  1253. .portrait-dim-header {
  1254. display: flex;
  1255. align-items: center;
  1256. margin-bottom: 6rpx;
  1257. }
  1258. .portrait-dim-icon {
  1259. width: 36rpx;
  1260. height: 36rpx;
  1261. border-radius: 16rpx;
  1262. display: flex;
  1263. align-items: center;
  1264. justify-content: center;
  1265. margin-right: 10rpx;
  1266. font-size: calc(20rpx * var(--font-scale, 1));
  1267. }
  1268. .portrait-dim-name {
  1269. font-size: calc(24rpx * var(--font-scale, 1));
  1270. color: $app-text;
  1271. flex: 1;
  1272. }
  1273. .portrait-dim-score {
  1274. font-size: calc(26rpx * var(--font-scale, 1));
  1275. font-weight: bold;
  1276. color: $dim-wisdom;
  1277. margin-right: 12rpx;
  1278. }
  1279. .portrait-dim-bar-track {
  1280. height: 10rpx;
  1281. background: $dim-wisdom-tint-3;
  1282. border-radius: 8rpx;
  1283. overflow: hidden;
  1284. margin-bottom: 4rpx;
  1285. flex: 1;
  1286. }
  1287. .portrait-dim-bar-fill {
  1288. height: 100%;
  1289. border-radius: 8rpx;
  1290. transition: width 0.3s ease;
  1291. }
  1292. .portrait-dim-desc {
  1293. font-size: calc(20rpx * var(--font-scale, 1));
  1294. color: $app-text-muted;
  1295. display: block;
  1296. }
  1297. .portrait-tip {
  1298. padding: 16rpx 20rpx;
  1299. background: linear-gradient(135deg, $dim-wisdom-tint-3, $c-tint-d);
  1300. border-radius: 16rpx;
  1301. border-left: 8rpx solid $dim-wisdom;
  1302. margin-top: 16rpx;
  1303. }
  1304. .portrait-tip-text {
  1305. font-size: calc(22rpx * var(--font-scale, 1));
  1306. color: $c-ink-strong;
  1307. line-height: 1.5;
  1308. }
  1309. </style>