|
|
@@ -119,6 +119,26 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
+ <!-- ===== DAN 报告(B4-智维度) ===== -->
|
|
|
+ <view class="section" v-if="isLoggedIn && danReports.length > 0">
|
|
|
+ <view class="section-header">
|
|
|
+ <text class="section-title">📊 DAN 报告</text>
|
|
|
+ <text class="section-more" @click="goDanUpload('wisdom')">上传 +</text>
|
|
|
+ </view>
|
|
|
+ <view class="dan-card" v-for="report in danReports" :key="report.id">
|
|
|
+ <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 class="dan-card-footer" @click="viewDanReport(report)">
|
|
|
+ <text class="dan-view-link">查看详情 →</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
<!-- 13. 快捷操作按钮 -->
|
|
|
<view class="section quick-actions" v-if="isLoggedIn">
|
|
|
<view class="action-btn" @click="goCognitiveReport">
|
|
|
@@ -158,7 +178,7 @@ import DimensionProducts from '../../components/DimensionProducts.vue'
|
|
|
import DimensionArticles from '../../components/DimensionArticles.vue'
|
|
|
import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
|
|
|
import AIFloatingAvatar from '../../components/AIFloatingAvatar.vue'
|
|
|
-import { getVisibleSections, getChildren, getTodayTasksByCategory, getActivityList, getProductsByDomain, getFamilyEnergySandbox, getAssessmentLatestResult, getFeaturedArticles, getContactList, getHealthAlerts, getMilestones } from '../../utils/api.js'
|
|
|
+import { getVisibleSections, getChildren, getTodayTasksByCategory, getActivityList, getProductsByDomain, getFamilyEnergySandbox, getAssessmentLatestResult, getFeaturedArticles, getContactList, getHealthAlerts, getMilestones, getDanReportByChild } from '../../utils/api.js'
|
|
|
|
|
|
export default {
|
|
|
components: { TabTransition, PageBanner, LoginGuideCard, RadarChart, FamilyEnergyBar, UserQuickEntry, DimensionTasks, DimensionActivities, DimensionProducts, DimensionArticles, FamilyRelationGraph, AIFloatingAvatar },
|
|
|
@@ -186,6 +206,7 @@ export default {
|
|
|
contactList: [],
|
|
|
healthAlerts: [],
|
|
|
milestones: [],
|
|
|
+ danReports: [],
|
|
|
funcList: [
|
|
|
{ icon: '\u{1F4CA}', label: '认知报告', needLogin: true, page: '/pages/wisdom-detail/cognitive-report' },
|
|
|
{ icon: '\u{270F}\uFE0F', label: '自己出题', needLogin: true, page: '/pages/wisdom-detail/self-quiz' },
|
|
|
@@ -261,6 +282,7 @@ export default {
|
|
|
this.loadFamilyMembersVisible()
|
|
|
this.loadCognitiveReport()
|
|
|
this.loadRelationshipHealth()
|
|
|
+ this.loadDanReports()
|
|
|
}
|
|
|
this.loadDimensionActivities()
|
|
|
this.loadDimensionProducts()
|
|
|
@@ -304,14 +326,12 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (!self.activeChildId) {
|
|
|
- self.activeChildId = self.children[0].id
|
|
|
- self.activeChildName = self.children[0].nickname || self.children[0].name || ''
|
|
|
- uni.setStorageSync('currentChildId', self.activeChildId)
|
|
|
- }
|
|
|
+ // FIX: 不再自动选择第一个孩子
|
|
|
+ }
|
|
|
+ // Load cognitive report only if activeChildId is set (user switched)
|
|
|
+ if (self.activeChildId) {
|
|
|
+ self.loadCognitiveReport()
|
|
|
}
|
|
|
- // Load cognitive report AFTER activeChildId is confirmed set
|
|
|
- self.loadCognitiveReport()
|
|
|
}
|
|
|
self.loadContacts()
|
|
|
}).catch(function(e) {})
|
|
|
@@ -340,7 +360,8 @@ export default {
|
|
|
},
|
|
|
onChildChanged: function(childId) {
|
|
|
this.activeChildId = childId
|
|
|
- uni.setStorageSync('currentChildId', childId)
|
|
|
+ // FIX: 同步提交到 Vuex store
|
|
|
+ this.$store.commit('switchToChild', childId)
|
|
|
for (var i = 0; i < this.children.length; i++) {
|
|
|
if (this.children[i].id == childId) {
|
|
|
this.activeChildName = this.children[i].nickname || this.children[i].name || ''
|
|
|
@@ -552,6 +573,29 @@ export default {
|
|
|
if (unwatch) unwatch()
|
|
|
self.showTabTransition = false
|
|
|
}, 5000)
|
|
|
+ },
|
|
|
+
|
|
|
+ // ===== 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() {})
|
|
|
+ },
|
|
|
+ goDanUpload: function() {
|
|
|
+ uni.navigateTo({ url: '/pages/dan-assessment/report-upload' })
|
|
|
+ },
|
|
|
+ viewDanReport: function(report) {
|
|
|
+ uni.navigateTo({ url: '/pages/dan-assessment/report-upload?draftId=' + report.id })
|
|
|
+ },
|
|
|
+ formatDate: function(dateStr) {
|
|
|
+ if (!dateStr) return ''
|
|
|
+ var d = new Date(dateStr)
|
|
|
+ return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -694,4 +738,50 @@ export default {
|
|
|
.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;
|
|
|
+}
|
|
|
</style>
|