| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089 |
- <template>
- <view class="wisdom-container">
- <!-- Tabbar 切换过渡页 -->
- <tab-transition v-if="showTabTransition" dimCode="wisdom" ref="tabTransition" @close="showTabTransition = false" />
- <!-- 品牌定位语(登录前显示) -->
- <view class="brand-strap" v-if="!isLoggedIn">
- <text class="brand-strap-text">提升全家认知能力与学习效率</text>
- </view>
- <!-- 2. 学习能力评估图(始终显示,无数据时仅显示人群平均值) -->
- <view class="section">
- <view class="section-header">
- <text class="section-title">学习能力评估</text>
- <text class="section-sub">通过测评了解全家认知能力,找出可以提升的方向</text>
- <text class="avg-badge" v-if="!cognitiveReport">同龄平均值 · 完成认知测评后显示个人数据</text>
- <text class="section-more" v-if="isLoggedIn" @click="goCognitiveReport">查看详情 ›</text>
- </view>
- <RadarChart
- :dimensions="cognitiveDimensions"
- :scores="cognitiveScores"
- :avg-scores="cognitiveFamilyScores"
- :population-scores="cognitivePopulationScores"
- :childName="activeChildName"
- fillColor="#6366F1"
- gridColor="#E0E7FF"
- labelColor="#3730A3" />
- </view>
- <!-- 家庭成员选择条 -->
- <FamilyMemberStrip
- v-if="currentView === 'self' && isLoggedIn"
- :members="familyMembersVisible"
- :selectedMemberId="selectedMemberId"
- @select="onFamilyMemberSelect"
- @removed="loadFamilyMembersVisible" />
- <!-- 游客引导语 -->
- <view class="monthly-guidance" v-if="!isLoggedIn">
- <text class="guidance-icon">⚡</text>
- <text class="guidance-text">{{ monthlyGuidance }}</text>
- </view>
- <!-- 4. 五维能量条(登录后) -->
- <FamilyEnergyBar
- v-if="isLoggedIn"
- dimensionCode="wisdom"
- :sandboxData="sandboxData"
- :dualDimension="dualDimension" />
- <!-- 认知指标卡片 -->
- <view class="indicator-cards-section" v-if="isLoggedIn && wisdomIndicators.length > 0">
- <view class="section-header">
- <text class="section-title">⚡ 认知指标</text>
- <text class="section-more" @click="goWisdomDetail">更多 ›</text>
- </view>
- <view class="indicator-cards">
- <view
- v-for="(ind, i) in wisdomIndicators"
- :key="ind.code"
- class="indicator-card"
- :class="{ 'no-data': !ind.value }"
- @click="goWisdomDetail()"
- >
- <view class="indicator-header">
- <text class="indicator-name">{{ ind.name }}</text>
- <text class="indicator-unit" v-if="ind.unit">{{ ind.unit }}</text>
- </view>
- <view class="indicator-body">
- <text class="indicator-value" v-if="ind.value || ind.numericValue !== null">{{ ind.value || formatNumeric(ind.numericValue) }}</text>
- <text class="indicator-placeholder" v-else>暂无数据</text>
- </view>
- <view class="indicator-footer">
- <text class="indicator-range" v-if="ind.refRange">参考: {{ ind.refRange }}</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 学习解读 -->
- <view class="section score-explain-card" v-if="isLoggedIn && currentView === 'self' && dualDimension">
- <view class="explain-header">
- <text class="explain-icon">{{ (dualDimension.primary && dualDimension.primary.score || 0) >= 80 ? '✅' : (dualDimension.primary && dualDimension.primary.score || 0) >= 60 ? '⚠️' : '❗' }}</text>
- <text class="explain-title">学习解读</text>
- </view>
- <text class="explain-text">{{ (dualDimension.primary && dualDimension.primary.score || 0) >= 80 ? '学习能力良好,继续保持学习节奏。' : (dualDimension.primary && dualDimension.primary.score || 0) >= 60 ? '学习能力一般,建议多做认知训练。' : '学习能力需要提升,建议进行专业评估。' }}</text>
- </view>
- <!-- ===== 认知强项与提升空间 ===== -->
- <view class="section cognitive-insight" v-if="isLoggedIn && cognitiveReport">
- <view class="section-header">
- <text class="section-title">📈 认知强项与提升</text>
- </view>
- <template v-if="cogStrengths.length > 0 || cogImproves.length > 0">
- <view class="insight-group" v-if="cogStrengths.length > 0">
- <text class="insight-group-title">💪 你的强项</text>
- <view class="insight-item" v-for="(item, idx) in cogStrengths" :key="getInsightKey('s', idx)">
- <text class="insight-item-name">{{ item.label }}</text>
- <text class="insight-item-score">{{ item.score }}分</text>
- <text class="insight-item-tag tag-strong">强项</text>
- </view>
- </view>
- <view class="insight-group" v-if="cogImproves.length > 0">
- <text class="insight-group-title">🌱 提升空间</text>
- <view class="insight-item" v-for="(item, idx) in cogImproves" :key="getInsightKey('i', idx)">
- <text class="insight-item-name">{{ item.label }}</text>
- <text class="insight-item-score">{{ item.score }}分</text>
- <text class="insight-item-tag tag-improve">待提升</text>
- </view>
- </view>
- <view class="insight-tip" v-if="cogStrengths.length > 0 && cogImproves.length > 0">
- <text class="insight-tip-text">强项保持,薄弱维建议通过训练中心针对性提升</text>
- </view>
- </template>
- <view class="insight-empty" v-else-if="!cognitiveReport || !hasCognitiveScore">
- <text class="insight-empty-text">完成认知测评,查看强项与提升建议</text>
- <button class="insight-btn" @click="goCognitiveReport">去测评</button>
- </view>
- </view>
- <!-- ===== DAN 报告(登录后) ===== -->
- <view class="section" v-if="isLoggedIn">
- <view class="section-header">
- <text class="section-title">📊 DAN 报告</text>
- <text class="section-more" @click="goDanUpload">上传 +</text>
- </view>
- <view class="dan-card" v-for="report in danReports" :key="report.id" @click="viewDanReport(report)">
- <view class="dan-card-header">
- <text class="dan-report-date">{{ formatDate(report.assessmentDate) }}</text>
- <text :class="['dan-status', report.draftStatus === 'confirmed' ? 'confirmed' : 'pending']">
- {{ report.draftStatus === 'confirmed' ? '已确认' : '待确认' }}
- </text>
- </view>
- <text class="dan-report-desc">DAN B4 智维度测评报告</text>
- </view>
- <view class="dan-empty" v-if="danReports.length === 0">
- <text class="dan-empty-text">暂无 DAN 报告,点击上方「上传 +」上传测评报告</text>
- </view>
- </view>
- <!-- 肠胃与认知卡片(有菌群报告显示认知指标,无报告引导上传) -->
- <view class="section gut-cognition-card" v-if="isLoggedIn">
- <view class="section-header">
- <text class="section-title">🦠 肠胃与认知</text>
- </view>
- <text class="gut-cog-subtitle">肠脑轴 · 肠道菌群,影响学习与思维</text>
- <template v-if="cognitionGutIndicators && cognitionGutIndicators.length > 0">
- <view class="gut-indicator-list">
- <view class="gut-indicator-item" v-for="ind in cognitionGutIndicators" :key="ind.id">
- <view class="gut-indicator-left">
- <text class="gut-indicator-name">{{ ind.indicatorName || ind.name }}</text>
- </view>
- <view class="gut-indicator-bar-track">
- <view class="gut-indicator-bar-fill" :style="{ width: (ind.value || 0) + '%', background: indicatorColor(ind.status) }"></view>
- </view>
- <text class="gut-indicator-value">{{ ind.value }}{{ ind.unit || '%' }}</text>
- <text :class="['gut-indicator-status', 'status-' + (ind.status || 'normal')]">{{ statusLabel(ind.status) }}</text>
- </view>
- </view>
- </template>
- <view class="gut-empty" v-else>
- <text class="gut-empty-icon">📄</text>
- <text class="gut-empty-text">上传菌群报告,查看认知相关指标</text>
- <button class="gut-upload-btn" @click="goReportUpload">去上传</button>
- </view>
- </view>
- <!-- 6. 功能入口 -->
- <view class="func-section" v-if="sectionVisible('func_entries')">
- <view class="func-grid">
- <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
- <view class="func-icon-wrap">
- <text class="func-icon">{{ item.icon }}</text>
- </view>
- <text class="func-label">{{ item.label }}</text>
- </view>
- </view>
- </view>
- <!-- 11. 快捷操作按钮 -->
- <view class="section quick-actions" v-if="isLoggedIn">
- <view class="action-btn" @click="goCognitiveReport">
- <text class="action-icon">📊</text>
- <text class="action-text">认知报告</text>
- </view>
- <view class="action-btn" @click="goTrainingHub">
- <text class="action-icon">🧠</text>
- <text class="action-text">认知训练</text>
- </view>
- <view class="action-btn" @click="goAssessment">
- <text class="action-icon">📋</text>
- <text class="action-text">测评预约</text>
- </view>
- <view class="action-btn" @click="goDanUpload">
- <text class="action-icon">📄</text>
- <text class="action-text">上传报告</text>
- </view>
- </view>
- <!-- 智维度介绍卡片(登录后显示) -->
- <DimensionIntroCard dimCode="wisdom" v-if="isLoggedIn" learn-more-url="/pages/wisdom-detail/dimension-intro" />
- <!-- 底部占位 -->
- <view class="bottom-spacer"></view>
- <FloatingAvatar />
- </view>
- </template>
- <script>
- import nav from '../../utils/nav'
- import TabTransition from '../../components/tab-transition.vue'
- import RadarChart from '../../components/RadarChart.vue'
- import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
- import FloatingAvatar from '../../components/AIFloatingAvatar.vue'
- import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
- import DimensionIntroCard from '../../components/DimensionIntroCard.vue'
- import { getVisibleSections, getChildren, getFamilyEnergySandbox, getEnergySandbox, getAssessmentLatestResult, getDanReportByChild, getGutCognitionIndicators, getLatestIndicators, getRadarData } from '../../utils/api.js'
- import { parseDate } from '../../utils/format.js'
- export default {
- components: { TabTransition, RadarChart, FamilyEnergyBar, FloatingAvatar, FamilyMemberStrip, DimensionIntroCard },
- data() {
- return {
- isLoggedIn: false,
- role: null,
- showTabTransition: true,
- activeChildId: null,
- activeChildName: '',
- userName: '',
- children: [],
- familyMembersVisible: [],
- selectedMemberId: null,
- wisdomSubDims: [],
- wisdomIndicators: [],
- sandboxData: null,
- currentView: 'self', // 'self' | 'family'
- dualDimension: null,
- visibleSections: [],
- cognitiveReport: null,
- articles: [],
- /** 认知雷达图:家庭平均分(默认取同龄同性 P50 常模) */
- cognitiveFamilyScores: [],
- /** 认知雷达图:人群位置(同龄同性 P50 常模) */
- cognitivePopulationScores: [70, 65, 72, 68, 66, 71, 70],
- danReports: [],
- cognitionGutIndicators: [],
- funcList: [
- { icon: '\u{1F4CA}', label: '认知报告', needLogin: true, page: '/pages/wisdom-detail/cognitive-report' },
- { icon: '\u{1F9E0}', label: '训练中心', needLogin: true, page: '/pages/wisdom-detail/training-hub' },
- { icon: '\u{1F3AF}', label: '测评预约', needLogin: false, page: '/pages/assessment/apply' },
- { icon: '\u{1F4D6}', label: '阅读天地', needLogin: false, page: '/pages/article-center/index?dimension=wisdom' }
- ]
- }
- },
- computed: {
- wisdomArticles: function() {
- if (!this.articles || this.articles.length === 0) return []
- var result = []
- for (var i = 0; i < this.articles.length; i++) {
- var a = this.articles[i]
- if (a.relatedDimensions && a.relatedDimensions.indexOf('wisdom') !== -1) {
- result.push(a)
- }
- }
- if (result.length === 0) return this.articles.slice(0, 5)
- return result.slice(0, 5)
- },
- cognitiveDimensions: function() {
- return [
- { label: '感知能力', key: 'perceptionScore' },
- { label: '专注力', key: 'focusScore' },
- { label: '记忆力', key: 'memoryScore' },
- { label: '逻辑思维', key: 'logicScore' },
- { label: '空间思维', key: 'spatialScore' },
- { label: '加工速度', key: 'processingSpeedScore' },
- { label: '成长型思维', key: 'wisdomGrowthMindset' }
- ]
- },
- cognitiveScores: function() {
- if (!this.cognitiveReport) return []
- var dims = this.cognitiveDimensions
- var scores = []
- // 解析 structuredAnalysis 中的成长型思维
- var growthMindset = 0
- if (this.cognitiveReport.structuredAnalysis) {
- try {
- var analysis = JSON.parse(this.cognitiveReport.structuredAnalysis)
- if (analysis && analysis.extra && analysis.extra.growthMindset) {
- var gm = analysis.extra.growthMindset
- var vals = Object.values(gm)
- if (vals.length > 0) growthMindset = parseInt(vals[0]) || 0
- }
- } catch (e) { /* ignore parse error */ }
- }
- for (var i = 0; i < dims.length; i++) {
- var key = dims[i].key
- if (key === 'wisdomGrowthMindset') {
- scores.push(growthMindset)
- } else {
- scores.push(this.cognitiveReport[key] || 0)
- }
- }
- return scores
- },
- /** 认知测评是否已有有效得分(任一维度 > 0) */
- hasCognitiveScore: function() {
- if (!this.cognitiveReport) return false
- var dims = this.cognitiveDimensions
- for (var i = 0; i < dims.length; i++) {
- var key = dims[i].key
- var v = 0
- if (key === 'wisdomGrowthMindset') {
- v = this.cognitiveScores[this.cognitiveDimensions.length - 1] || 0
- } else {
- v = this.cognitiveReport[key] || 0
- }
- if (v > 0) return true
- }
- return false
- },
- /** 认知强项:得分 ≥75 的维度 */
- cogStrengths: function() {
- var dims = this.cognitiveDimensions
- var result = []
- for (var i = 0; i < dims.length; i++) {
- var score = this.cognitiveScores[i] || 0
- if (score >= 75) {
- result.push({ label: dims[i].label, score: score })
- }
- }
- return result
- },
- /** 认知提升空间:得分 <60 的维度 */
- cogImproves: function() {
- var dims = this.cognitiveDimensions
- var result = []
- for (var i = 0; i < dims.length; i++) {
- var score = this.cognitiveScores[i] || 0
- if (score > 0 && score < 60) {
- result.push({ label: dims[i].label, score: score })
- }
- }
- return result
- },
- /** 每月引导语 */
- monthlyGuidance: function() {
- var month = new Date().getMonth()
- var messages = [
- '一月:新年新目标,制定学习计划',
- '二月:春节收获知识,拓展认知边界',
- '三月:植树节到,播种智慧种子',
- '四月:清明踏青,激发创造力',
- '五月:劳动节后,专注能力提升',
- '六月:考试季,科学备考策略',
- '七月:暑期黄金期,查漏补缺',
- '八月:开学准备,提前规划学习',
- '九月:新学期,设定学习目标',
- '十月:国庆假期,阅读充电',
- '十一月:年终冲刺,巩固知识',
- '十二月:年度总结,规划来年学习'
- ]
- return messages[month] || messages[0]
- }
- },
- onShow() {
- this.showTabTransition = true
- var token = uni.getStorageSync('token')
- this.isLoggedIn = !!token
- if (this.isLoggedIn) {
- this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
- this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
- }
- this.loadSectionConfig()
- if (this.isLoggedIn) {
- this.loadChildren()
- this.loadFamilyMembersVisible()
- this.loadCognitiveReport()
- this.loadDanReports()
- this.loadGutCognitionData()
- }
- // 游客也能浏览文章
- this._watchPageReady()
- },
- methods: {
- getInsightKey: function(prefix, idx) { return prefix + idx },
- onFamilyMemberSelect: function(member) {
- this.selectedMemberId = member.id
- },
- loadSectionConfig: function() {
- var baseSections = ['func_entries', 'recommended_reading']
- if (!uni.getStorageSync('token')) {
- this.visibleSections = baseSections
- return
- }
- var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
- var self = this
- getVisibleSections({ pageKey: 'wisdom', role: role }).then(function(res) {
- if (res.code === 200 && res.data) {
- var keys = res.data.map(function(s) { return s.sectionKey })
- var merged = baseSections.slice()
- keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
- self.visibleSections = merged
- }
- }).catch(function(e) {
- self.visibleSections = ['func_entries', 'recommended_reading']
- })
- },
- loadChildren: function() {
- var self = this
- getChildren().then(function(res) {
- if (res.code === 200 && res.data) {
- self.children = res.data
- if (self.children.length > 0) {
- var activeId = uni.getStorageSync('currentChildId')
- if (activeId) {
- for (var i = 0; i < self.children.length; i++) {
- if (self.children[i].id == activeId) {
- self.activeChildId = activeId
- self.activeChildName = self.children[i].nickname || self.children[i].name || ''
- break
- }
- }
- }
- // Fallback: 首次进入或未选孩子时,默认选第一个孩子以加载认知数据(仅本地状态,不触发全局切换)
- if (!self.activeChildId && self.children.length > 0) {
- self.activeChildId = self.children[0].id
- self.activeChildName = self.children[0].nickname || self.children[0].name || ''
- }
- }
- // Load cognitive report if activeChildId is available
- if (self.activeChildId) {
- self.loadCognitiveReport()
- }
- }
- }).catch(function(e) {})
- },
- loadWisdomIndicators: function(memberId) {
- var self = this
- getLatestIndicators({ memberId: memberId, domain: 'wisdom' }).then(function(res) {
- if (res.code === 200) self.wisdomIndicators = res.data || []
- }).catch(function(e) { console.log('[wisdom] loadWisdomIndicators failed', e) })
- },
- goWisdomDetail: function() {
- var id = this.activeChildId || uni.getStorageSync('currentChildId')
- if (!id) return
- uni.navigateTo({ url: '/pages/wisdom-detail/member-wisdom-detail?memberId=' + id })
- },
- formatNumeric: function(v) {
- if (v === null || v === undefined) return ''
- var n = parseFloat(v)
- if (isNaN(n)) return String(v)
- return n % 1 === 0 ? String(n) : n.toFixed(1)
- },
- loadFamilyMembersVisible: function() {
- var self = this
- getFamilyEnergySandbox().then(function(res) {
- if (res && res.data) {
- self.sandboxData = res.data.sandboxData || null
- self.dualDimension = res.data.dualDimension || null
- if (res.data.members) {
- self.familyMembersVisible = res.data.members
- }
- }
- }).catch(function(e) {})
- },
- loadCognitiveReport: function() {
- var self = this
- var memberId = this.activeChildId
- if (!memberId) return
- getAssessmentLatestResult(memberId).then(function(res) {
- if (res.code === 200 && res.data) {
- self.cognitiveReport = res.data
- 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:'相信能力可提升'}]; })();
- self.loadWisdomIndicators(memberId)
- self.loadCognitiveRadarData(memberId)
- }
- }).catch(function(e) {})
- },
- loadCognitiveRadarData: function(memberId) {
- var self = this
- if (!memberId) return
- getRadarData({ memberId: memberId, dimensions: ['perception','focus','memory','logic','spatial','processingSpeed','wisdomGrowthMindset'] }).then(function(res) {
- if (res && res.data) {
- self.cognitiveFamilyScores = res.data.familyScores || []
- self.cognitivePopulationScores = res.data.populationScores || []
- }
- }).catch(function(e) {
- console.warn('[wisdom] radar-data failed', e)
- })
- },
- onChildChanged: function(memberId) {
- this.activeChildId = memberId
- // FIX: 同步提交到 Vuex store
- this.$store.commit('switchToChild', memberId)
- for (var i = 0; i < this.children.length; i++) {
- if (this.children[i].id == memberId) {
- this.activeChildName = this.children[i].nickname || this.children[i].name || ''
- break
- }
- }
- this.loadFamilyMembersVisible()
- this.loadCognitiveReport()
- this.loadDanReports()
- },
- sectionVisible: function(key) {
- return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
- },
- onFuncClick: function(item) {
- if (item.needLogin && !this.isLoggedIn) {
- uni.showModal({
- title: '提示',
- content: '请先登录后使用此功能',
- success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
- })
- return
- }
- if (item.page) {
- nav.goPage(item.page)
- }
- },
- scrollToSection: function(section) {},
- goCognitiveReport: function() {
- uni.navigateTo({ url: '/pages/wisdom-detail/cognitive-report' })
- },
- goTrainingHub: function() {
- uni.navigateTo({ url: '/pages/wisdom-detail/training-hub' })
- },
- goAssessment: function() {
- uni.navigateTo({ url: '/pages/assessment/apply' })
- },
- _watchPageReady() {
- var self = this
- var unwatch = this.$watch(function() {
- if (self.isLoggedIn) {
- return !!(self.cognitiveReport || self.sandboxData)
- } }, function(val) {
- if (val) {
- if (unwatch) unwatch()
- if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
- }
- })
- },
- // ===== DAN 报告 =====
- loadDanReports: function() {
- var self = this
- var memberId = self.activeChildId
- if (!memberId) return
- getDanReportByChild(memberId, 'wisdom').then(function(res) {
- if (res.code === 200 && res.data) {
- self.danReports = res.data
- }
- }).catch(function() {})
- },
- // ===== 肠胃与认知(肠脑轴认知指标) =====
- loadGutCognitionData: function() {
- var self = this
- var memberId = self.activeChildId
- if (!memberId) return
- getGutCognitionIndicators(memberId).then(function(res) {
- if (res.code === 200 && res.data) {
- var list = res.data
- self.cognitionGutIndicators = Array.isArray(list) ? list.slice(0, 6) : []
- } else {
- self.cognitionGutIndicators = []
- }
- }).catch(function() {
- self.cognitionGutIndicators = []
- })
- },
- indicatorColor: function(status) {
- if (status === 'abnormal' || status === '偏高' || status === '偏低' || status === '过高' || status === '缺乏') return '#EF4444'
- if (status === 'warning' || status === '注意' || status === '不足') return '#F59E0B'
- return '#10B981'
- },
- statusLabel: function(status) {
- if (status === 'normal') return '正常'
- if (status === 'abnormal') return '异常'
- if (status === 'warning') return '警讯'
- if (status === '过高' || status === '过多') return '偏高'
- if (status === '缺乏' || status === '不足') return '偏低'
- return status || '正常'
- },
- goReportUpload: function() {
- uni.navigateTo({ url: '/pages/health/report-upload' })
- },
- goDanUpload: function() {
- uni.navigateTo({ url: '/pages/health/report-upload' })
- },
- viewDanReport: function(report) {
- var reportId = report.sourceReportId || report.id
- uni.navigateTo({ url: '/pages/dan-assessment/report-result?reportId=' + reportId })
- },
- formatDate: function(dateStr) {
- if (!dateStr) return ''
- var d = parseDate(dateStr)
- if (!d) return ''
- return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
- }
- }
- }
- </script>
- .view-toggle {
- display: flex;
- margin: 20rpx 30rpx;
- background: rgba(255,255,255,0.12);
- border-radius: 12rpx;
- padding: 6rpx;
- }
- .toggle-btn {
- flex: 1;
- text-align: center;
- padding: 12rpx 0;
- border-radius: 8rpx;
- font-size: 26rpx;
- color: rgba(255,255,255,0.65);
- }
- .toggle-btn.active {
- background: rgba(255,255,255,0.22);
- color: #fff;
- font-weight: 600;
- }
- /* 页面说明 */
- .section-sub {
- font-size: 22rpx;
- color: rgba(255,255,255,0.55);
- margin-top: 6rpx;
- display: block;
- }
- /* 得分解读卡片 */
- .score-explain-card {
- margin: 20rpx 30rpx;
- padding: 28rpx 24rpx;
- background: rgba(255,255,255,0.1);
- border-radius: 20rpx;
- border: 1rpx solid rgba(255,255,255,0.15);
- }
- .explain-header {
- display: flex;
- align-items: center;
- margin-bottom: 14rpx;
- }
- .explain-icon {
- font-size: 36rpx;
- margin-right: 10rpx;
- }
- .explain-title {
- font-size: 28rpx;
- font-weight: 600;
- color: #fff;
- }
- .explain-text {
- font-size: 26rpx;
- color: rgba(255,255,255,0.8);
- line-height: 1.6;
- }
- /* 子维度评分卡 */
- .subdim-section {
- margin: 20rpx 30rpx;
- }
- .subdim-cards {
- background: rgba(255,255,255,0.08);
- border-radius: 20rpx;
- overflow: hidden;
- border: 1rpx solid rgba(255,255,255,0.12);
- }
- .subdim-card {
- padding: 24rpx 28rpx;
- border-bottom: 1rpx solid rgba(255,255,255,0.08);
- }
- .subdim-card:last-child {
- border-bottom: none;
- }
- .subdim-card-left {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12rpx;
- }
- .subdim-card-label {
- font-size: 28rpx;
- font-weight: 600;
- color: #fff;
- }
- .subdim-card-desc {
- font-size: 22rpx;
- color: rgba(255,255,255,0.5);
- margin-top: 4rpx;
- }
- .subdim-card-right {
- text-align: right;
- }
- .subdim-card-score {
- font-size: 36rpx;
- font-weight: 700;
- }
- .subdim-bar-track {
- height: 8rpx;
- background: rgba(255,255,255,0.1);
- border-radius: 4rpx;
- overflow: hidden;
- margin-top: 8rpx;
- }
- .subdim-bar-fill {
- height: 100%;
- border-radius: 4rpx;
- transition: width 0.5s ease;
- }
- <style scoped>
- .wisdom-container {
- min-height: 100vh;
- background: #f5f7fa;
- padding-bottom: 120rpx;
- }
- .func-section {
- margin: 20rpx 20rpx 0;
- }
- .func-grid {
- background: #fff;
- border-radius: 24rpx;
- padding: 30rpx 16rpx;
- display: flex;
- box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
- }
- .func-item {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .func-item:active {
- opacity: 0.7;
- }
- .func-icon-wrap {
- width: 88rpx;
- height: 88rpx;
- border-radius: 50%;
- background: #FFF8E1;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-bottom: 10rpx;
- }
- .func-icon {
- font-size: 40rpx;
- }
- .func-label {
- font-size: 24rpx;
- color: #333;
- font-weight: 500;
- }
- /* ===== Section ===== */
- .section {
- margin: 20rpx 20rpx;
- }
- .section-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .section-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- }
- .section-more {
- font-size: 24rpx;
- color: #999;
- }
- /* ===== 快捷操作按钮 ===== */
- .quick-actions {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: space-between;
- }
- .action-btn {
- width: 48%;
- background: #fff;
- border-radius: 16rpx;
- padding: 24rpx 0;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .action-btn:active {
- opacity: 0.8;
- }
- .action-icon {
- font-size: 40rpx;
- margin-bottom: 10rpx;
- }
- .action-text {
- font-size: 26rpx;
- color: #333;
- font-weight: 500;
- }
- /* ===== 底部占位 ===== */
- .indicator-cards-section { margin: 20rpx 30rpx; }
- .indicator-cards { display: flex; flex-direction: row; flex-wrap: wrap; gap: 16rpx; }
- .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); }
- .indicator-card.no-data { opacity: 0.5; }
- .indicator-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12rpx; }
- .indicator-name { font-size: 26rpx; color: #666; font-weight: 500; }
- .indicator-unit { font-size: 22rpx; color: #999; }
- .indicator-body { margin-bottom: 8rpx; }
- .indicator-value { font-size: 40rpx; font-weight: bold; color: #6366F1; }
- .indicator-placeholder { font-size: 26rpx; color: #ccc; }
- .indicator-range { font-size: 20rpx; color: #bbb; }
- .bottom-spacer { height: 120rpx; }
- /* DAN 报告卡片
- .dan-card {
- background: #fff;
- border-radius: 16rpx;
- padding: 24rpx;
- margin-bottom: 16rpx;
- box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
- }
- .dan-card-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12rpx;
- }
- .dan-report-date {
- font-size: 26rpx;
- color: #666;
- }
- .dan-status {
- font-size: 22rpx;
- padding: 4rpx 16rpx;
- border-radius: 8rpx;
- }
- .dan-status.confirmed {
- background: #D1FAE5;
- color: #065F46;
- }
- .dan-status.pending {
- background: #FEF3C7;
- color: #92400E;
- }
- .dan-report-desc {
- font-size: 28rpx;
- color: #333;
- font-weight: 500;
- margin-bottom: 12rpx;
- display: block;
- }
- .dan-card-footer {
- text-align: right;
- }
- .dan-view-link {
- font-size: 26rpx;
- color: #6366F1;
- }
- .dan-empty {
- background: #fff;
- border-radius: 16rpx;
- padding: 40rpx 24rpx;
- text-align: center;
- }
- .dan-empty-text {
- font-size: 24rpx;
- color: #999;
- }
- .avg-badge {
- font-size: 20rpx;
- color: #94A3B8;
- margin-left: 12rpx;
- }
- /* 品牌定位语 */
- .brand-strap {
- margin: 16rpx 30rpx 0;
- padding: 20rpx 28rpx;
- background: linear-gradient(135deg, #F0F0FF, rgba(99,102,241,0.12));
- border-radius: 16rpx;
- border-left: 4rpx solid #6366F1;
- }
- .brand-strap-text {
- font-size: 26rpx;
- color: #3730A3;
- font-weight: 500;
- }
- /* 每月引导语 */
- .monthly-guidance {
- margin: 16rpx 30rpx 0;
- padding: 20rpx 28rpx;
- background: linear-gradient(135deg, #F0F0FF, rgba(99,102,241,0.08));
- border-radius: 16rpx;
- border-left: 4rpx solid #6366F1;
- display: flex;
- align-items: center;
- gap: 12rpx;
- }
- .guidance-icon { font-size: 32rpx; }
- .guidance-text {
- font-size: 26rpx;
- color: #3730A3;
- font-weight: 500;
- }
- /* ===== 肠胃与认知卡片 ===== */
- .gut-cog-subtitle {
- font-size: 24rpx;
- color: #6366F1;
- margin-bottom: 16rpx;
- display: block;
- }
- .gut-indicator-list {
- display: flex;
- flex-direction: column;
- gap: 12rpx;
- }
- .gut-indicator-item {
- display: flex;
- align-items: center;
- gap: 12rpx;
- }
- .gut-indicator-left {
- width: 80rpx;
- flex-shrink: 0;
- }
- .gut-indicator-name {
- font-size: 22rpx;
- color: #666;
- }
- .gut-indicator-bar-track {
- flex: 1;
- height: 16rpx;
- background: #F0F0F0;
- border-radius: 8rpx;
- overflow: hidden;
- }
- .gut-indicator-bar-fill {
- height: 100%;
- border-radius: 8rpx;
- transition: width 0.3s;
- }
- .gut-indicator-value {
- font-size: 22rpx;
- color: #666;
- width: 60rpx;
- text-align: right;
- }
- .gut-indicator-status {
- font-size: 20rpx;
- padding: 2rpx 12rpx;
- border-radius: 10rpx;
- width: 60rpx;
- text-align: center;
- }
- .status-normal {
- background: #D1FAE5;
- color: #059669;
- }
- .status-abnormal {
- background: #FEE2E2;
- color: #DC2626;
- }
- .status-warning {
- background: #FEF3C7;
- color: #D97706;
- }
- .gut-empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 40rpx 0;
- }
- .gut-empty-icon {
- font-size: 56rpx;
- margin-bottom: 16rpx;
- }
- .gut-empty-text {
- font-size: 26rpx;
- color: #999;
- margin-bottom: 24rpx;
- }
- .gut-upload-btn {
- background: linear-gradient(135deg, #6366F1, #818CF8);
- color: #fff;
- font-size: 26rpx;
- font-weight: 600;
- border: none;
- border-radius: 40rpx;
- padding: 16rpx 64rpx;
- line-height: 1.6;
- margin: 0;
- }
- /* ===== 认知强项与提升卡片 ===== */
- .insight-group {
- margin-bottom: 16rpx;
- }
- .insight-group-title {
- font-size: 26rpx;
- font-weight: 600;
- color: #333;
- margin-bottom: 10rpx;
- display: block;
- }
- .insight-item {
- display: flex;
- align-items: center;
- padding: 12rpx 16rpx;
- background: #F8FAFF;
- border-radius: 12rpx;
- margin-bottom: 8rpx;
- }
- .insight-item-name {
- flex: 1;
- font-size: 26rpx;
- color: #333;
- }
- .insight-item-score {
- font-size: 24rpx;
- color: #666;
- margin-right: 12rpx;
- }
- .insight-item-tag {
- font-size: 20rpx;
- padding: 4rpx 16rpx;
- border-radius: 8rpx;
- font-weight: 500;
- }
- .insight-item-tag.tag-strong {
- background: #D1FAE5;
- color: #059669;
- }
- .insight-item-tag.tag-improve {
- background: #FEF3C7;
- color: #D97706;
- }
- .insight-tip {
- padding: 12rpx 16rpx;
- background: #EEF2FF;
- border-radius: 12rpx;
- }
- .insight-tip-text {
- font-size: 22rpx;
- color: #6366F1;
- }
- .insight-empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 30rpx 0;
- }
- .insight-empty-text {
- font-size: 24rpx;
- color: #999;
- margin-bottom: 20rpx;
- }
- .insight-btn {
- background: linear-gradient(135deg, #6366F1, #818CF8);
- color: #fff;
- font-size: 26rpx;
- font-weight: 600;
- border: none;
- border-radius: 40rpx;
- padding: 14rpx 60rpx;
- line-height: 1.6;
- margin: 0;
- }
- </style>
|