| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073 |
- <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="cognitiveAvgScores"
- :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 } 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: [],
- /** Mock 平均值(7维认知):感知/专注/记忆/逻辑/空间/加工速度/成长型思维 */
- cognitiveAvgScores: [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)
- }
- }).catch(function(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/dan-assessment/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>
|