index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. <template>
  2. <view class="wisdom-container">
  3. <!-- Tabbar 切换过渡页 -->
  4. <tab-transition v-if="showTabTransition" dimCode="wisdom" />
  5. <!-- 1. 品牌头部 -->
  6. <PageBanner theme="wisdom"
  7. tagline="学以启智 · 慧及未来"
  8. quote="知者不惑,仁者不忧" />
  9. <!-- 2. 游客专属区块 -->
  10. <template v-if="!isLoggedIn">
  11. <LoginGuideCard
  12. title="登录后查看全家智慧成长数据"
  13. :items="[
  14. '查看全家认知能量数据和测评报告',
  15. '记录每日成长,获取智慧能量',
  16. '参与认知训练,提升综合能力'
  17. ]" />
  18. </template>
  19. <!-- 3. 五维能量条(登录后) -->
  20. <FamilyEnergyBar
  21. v-if="isLoggedIn"
  22. dimensionCode="wisdom"
  23. :sandboxData="sandboxData"
  24. :dualDimension="dualDimension" />
  25. <!-- 4. 认知雷达图(登录后) -->
  26. <view class="section" v-if="isLoggedIn && cognitiveReport">
  27. <view class="section-header">
  28. <text class="section-title">认知雷达</text>
  29. <text class="section-more" @click="goCognitiveReport">查看详情 ›</text>
  30. </view>
  31. <RadarChart
  32. :dimensions="cognitiveDimensions"
  33. :scores="cognitiveScores"
  34. :avg-scores="cognitiveAvgScores"
  35. :childName="activeChildName"
  36. fillColor="#6366F1"
  37. gridColor="#E0E7FF"
  38. labelColor="#3730A3" />
  39. </view>
  40. <!-- 5. 家庭成员关系图谱(登录后) -->
  41. <FamilyRelationGraph
  42. v-if="isLoggedIn && familyMembersVisible.length > 0"
  43. dimensionCode="wisdom"
  44. :selfId="activeChildId"
  45. :members="familyMembersVisible"
  46. :energyMap="energyMapForGraph"
  47. :intimacyMap="intimacyMapForGraph"
  48. @memberTap="goMemberDetail" />
  49. <!-- 7. 功能入口 -->
  50. <view class="func-section" v-if="sectionVisible('func_entries')">
  51. <view class="func-grid">
  52. <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
  53. <view class="func-icon-wrap">
  54. <text class="func-icon">{{ item.icon }}</text>
  55. </view>
  56. <text class="func-label">{{ item.label }}</text>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 8. 维度任务 -->
  61. <DimensionTasks
  62. v-if="isLoggedIn"
  63. dimensionCode="wisdom"
  64. :tasks="dimensionTasks"
  65. @taskClick="onTaskClick"
  66. @moreTasks="goTasks" />
  67. <!-- 9. 维度活动 -->
  68. <DimensionActivities
  69. dimensionCode="wisdom"
  70. :activities="dimensionActivities"
  71. :isLoggedIn="isLoggedIn"
  72. @activityClick="goActivityDetail"
  73. @moreActivities="goMoreActivities" />
  74. <!-- 10. 维度商品 -->
  75. <DimensionProducts
  76. dimensionCode="wisdom"
  77. :products="dimensionProducts"
  78. @productClick="goProductDetail"
  79. @moreProducts="goMoreProducts" />
  80. <!-- 11. 推荐阅读 -->
  81. <DimensionArticles
  82. v-if="sectionVisible('recommended_reading')"
  83. dimensionCode="wisdom"
  84. :articles="wisdomArticles"
  85. :isLoggedIn="isLoggedIn"
  86. @articleClick="goArticleDetail"
  87. @moreArticles="goMoreArticles" />
  88. <!-- 12. 智慧小贴士 -->
  89. <view class="section" v-if="sectionVisible('wisdom_tips')">
  90. <view class="section-header">
  91. <text class="section-title">智慧小贴士</text>
  92. </view>
  93. <view class="tips-list">
  94. <view class="tip-card" v-for="item in wisdomTips" :key="item.id">
  95. <text class="tip-title">{{ item.title }}</text>
  96. <text class="tip-summary">{{ item.summary }}</text>
  97. </view>
  98. </view>
  99. </view>
  100. <!-- ===== DAN 报告(B4-智维度) ===== -->
  101. <view class="section" v-if="isLoggedIn && danReports.length > 0">
  102. <view class="section-header">
  103. <text class="section-title">&#x1F4CA; DAN 报告</text>
  104. <text class="section-more" @click="goDanUpload('wisdom')">上传 +</text>
  105. </view>
  106. <view class="dan-card" v-for="report in danReports" :key="report.id">
  107. <view class="dan-card-header">
  108. <text class="dan-report-date">{{ formatDate(report.assessmentDate) }}</text>
  109. <text :class="['dan-status', report.draftStatus === 'confirmed' ? 'confirmed' : 'pending']">
  110. {{ report.draftStatus === 'confirmed' ? '已确认' : '待确认' }}
  111. </text>
  112. </view>
  113. <text class="dan-report-desc">DAN B4 智维度测评报告</text>
  114. <view class="dan-card-footer" @click="viewDanReport(report)">
  115. <text class="dan-view-link">查看详情 &rarr;</text>
  116. </view>
  117. </view>
  118. </view>
  119. <!-- 13. 快捷操作按钮 -->
  120. <view class="section quick-actions" v-if="isLoggedIn">
  121. <view class="action-btn" @click="goCognitiveReport">
  122. <text class="action-icon">📊</text>
  123. <text class="action-text">认知报告</text>
  124. </view>
  125. <view class="action-btn" @click="goTrainingHub">
  126. <text class="action-icon">🧠</text>
  127. <text class="action-text">认知训练</text>
  128. </view>
  129. <view class="action-btn" @click="goAssessment">
  130. <text class="action-icon">📋</text>
  131. <text class="action-text">测评预约</text>
  132. </view>
  133. <view class="action-btn" @click="goHome">
  134. <text class="action-icon">🏠</text>
  135. <text class="action-text">返回首页</text>
  136. </view>
  137. </view>
  138. <!-- 底部占位 -->
  139. <view class="bottom-spacer"></view>
  140. <AIFloatingAvatar />
  141. </view>
  142. </template>
  143. <script>
  144. import TabTransition from '../../components/tab-transition.vue'
  145. import PageBanner from '../../components/PageBanner.vue'
  146. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  147. import RadarChart from '../../components/RadarChart.vue'
  148. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  149. import DimensionTasks from '../../components/DimensionTasks.vue'
  150. import DimensionActivities from '../../components/DimensionActivities.vue'
  151. import DimensionProducts from '../../components/DimensionProducts.vue'
  152. import DimensionArticles from '../../components/DimensionArticles.vue'
  153. import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
  154. import AIFloatingAvatar from '../../components/AIFloatingAvatar.vue'
  155. import { getVisibleSections, getChildren, getTodayTasksByCategory, getActivityList, getProductsByDomain, getFamilyEnergySandbox, getAssessmentLatestResult, getFeaturedArticles, getContactList, getHealthAlerts, getMilestones, getDanReportByChild } from '../../utils/api.js'
  156. export default {
  157. components: { TabTransition, PageBanner, LoginGuideCard, RadarChart, FamilyEnergyBar, DimensionTasks, DimensionActivities, DimensionProducts, DimensionArticles, FamilyRelationGraph, AIFloatingAvatar },
  158. data() {
  159. return {
  160. isLoggedIn: false,
  161. role: null,
  162. showTabTransition: true,
  163. activeChildId: null,
  164. activeChildName: '',
  165. userName: '',
  166. children: [],
  167. familyMembersVisible: [],
  168. sandboxData: null,
  169. dualDimension: null,
  170. visibleSections: [],
  171. cognitiveReport: null,
  172. dimensionTasks: [],
  173. dimensionActivities: [],
  174. dimensionProducts: [],
  175. articles: [],
  176. wisdomTips: [],
  177. /** Mock 平均值(6维认知):感知/专注/记忆/逻辑/空间/加工速度 */
  178. cognitiveAvgScores: [70, 65, 72, 68, 66, 71],
  179. contactList: [],
  180. healthAlerts: [],
  181. milestones: [],
  182. danReports: [],
  183. funcList: [
  184. { icon: '\u{1F4CA}', label: '认知报告', needLogin: true, page: '/pages/wisdom-detail/cognitive-report' },
  185. { icon: '\u{270F}\uFE0F', label: '自己出题', needLogin: true, page: '/pages/wisdom-detail/self-quiz' },
  186. { icon: '\u{1F9E0}', label: '训练中心', needLogin: true, page: '/pages/wisdom-detail/training-hub' },
  187. { icon: '\u{1F3AF}', label: '测评预约', needLogin: false, page: '/pages/assessment/apply' },
  188. { icon: '\u{1F4D6}', label: '阅读天地', needLogin: false, page: '/pages/mind/articles' }
  189. ]
  190. }
  191. },
  192. computed: {
  193. energyMapForGraph: function() {
  194. var map = {}
  195. if (this.sandboxData && this.sandboxData.members) {
  196. for (var i = 0; i < this.sandboxData.members.length; i++) {
  197. var m = this.sandboxData.members[i]
  198. map[m.memberId || m.id] = {
  199. bodyScore: m.bodyScore || 0,
  200. mindScore: m.mindScore || 0,
  201. actionScore: m.actionScore || 0,
  202. wisdomScore: m.wisdomScore || 0
  203. }
  204. }
  205. }
  206. return map
  207. },
  208. intimacyMapForGraph: function() {
  209. return {}
  210. },
  211. wisdomArticles: function() {
  212. if (!this.articles || this.articles.length === 0) return []
  213. var result = []
  214. for (var i = 0; i < this.articles.length; i++) {
  215. var a = this.articles[i]
  216. if (a.relatedDimensions && a.relatedDimensions.indexOf('wisdom') !== -1) {
  217. result.push(a)
  218. }
  219. }
  220. if (result.length === 0) return this.articles.slice(0, 5)
  221. return result.slice(0, 5)
  222. },
  223. cognitiveDimensions: function() {
  224. return [
  225. { label: '感知能力', key: 'perceptionScore' },
  226. { label: '专注力', key: 'focusScore' },
  227. { label: '记忆力', key: 'memoryScore' },
  228. { label: '逻辑思维', key: 'logicScore' },
  229. { label: '空间思维', key: 'spatialScore' },
  230. { label: '加工速度', key: 'processingSpeedScore' }
  231. ]
  232. },
  233. cognitiveScores: function() {
  234. if (!this.cognitiveReport) return []
  235. var dims = this.cognitiveDimensions
  236. var scores = []
  237. for (var i = 0; i < dims.length; i++) {
  238. scores.push(this.cognitiveReport[dims[i].key] || 0)
  239. }
  240. return scores
  241. }
  242. },
  243. onShow() {
  244. this.showTabTransition = true
  245. var token = uni.getStorageSync('token')
  246. this.isLoggedIn = !!token
  247. if (this.isLoggedIn) {
  248. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  249. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  250. }
  251. this.loadSectionConfig()
  252. if (this.isLoggedIn) {
  253. this.loadChildren()
  254. this.loadFamilyMembersVisible()
  255. this.loadCognitiveReport()
  256. this.loadRelationshipHealth()
  257. this.loadDanReports()
  258. }
  259. this.loadDimensionActivities()
  260. this.loadDimensionProducts()
  261. // 游客也能浏览文章
  262. this.loadFeaturedArticles()
  263. this._watchPageReady()
  264. },
  265. methods: {
  266. loadSectionConfig: function() {
  267. var baseSections = ['func_entries', 'wisdom_tips', 'recommended_reading']
  268. if (!uni.getStorageSync('token')) {
  269. this.visibleSections = baseSections
  270. return
  271. }
  272. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  273. var self = this
  274. getVisibleSections({ pageKey: 'wisdom', role: role }).then(function(res) {
  275. if (res.code === 200 && res.data) {
  276. var keys = res.data.map(function(s) { return s.sectionKey })
  277. var merged = baseSections.slice()
  278. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  279. self.visibleSections = merged
  280. }
  281. }).catch(function(e) {
  282. self.visibleSections = ['func_entries', 'wisdom_tips']
  283. })
  284. },
  285. loadChildren: function() {
  286. var self = this
  287. getChildren().then(function(res) {
  288. if (res.code === 200 && res.data) {
  289. self.children = res.data
  290. if (self.children.length > 0) {
  291. var activeId = uni.getStorageSync('currentChildId')
  292. if (activeId) {
  293. for (var i = 0; i < self.children.length; i++) {
  294. if (self.children[i].id == activeId) {
  295. self.activeChildId = activeId
  296. self.activeChildName = self.children[i].nickname || self.children[i].name || ''
  297. break
  298. }
  299. }
  300. }
  301. // Fallback: 首次进入或未选孩子时,默认选第一个孩子以加载认知数据(仅本地状态,不触发全局切换)
  302. if (!self.activeChildId && self.children.length > 0) {
  303. self.activeChildId = self.children[0].id
  304. self.activeChildName = self.children[0].nickname || self.children[0].name || ''
  305. }
  306. }
  307. // Load cognitive report if activeChildId is available
  308. if (self.activeChildId) {
  309. self.loadCognitiveReport()
  310. }
  311. }
  312. self.loadContacts()
  313. }).catch(function(e) {})
  314. },
  315. loadFamilyMembersVisible: function() {
  316. var self = this
  317. getFamilyEnergySandbox().then(function(res) {
  318. if (res && res.data) {
  319. self.sandboxData = res.data.sandboxData || null
  320. self.dualDimension = res.data.dualDimension || null
  321. if (res.data.members) {
  322. self.familyMembersVisible = res.data.members
  323. }
  324. }
  325. }).catch(function(e) {})
  326. },
  327. loadCognitiveReport: function() {
  328. var self = this
  329. var childId = this.activeChildId
  330. if (!childId) return
  331. getAssessmentLatestResult(childId).then(function(res) {
  332. if (res.code === 200 && res.data) {
  333. self.cognitiveReport = res.data
  334. }
  335. }).catch(function(e) {})
  336. },
  337. onChildChanged: function(childId) {
  338. this.activeChildId = childId
  339. // FIX: 同步提交到 Vuex store
  340. this.$store.commit('switchToChild', childId)
  341. for (var i = 0; i < this.children.length; i++) {
  342. if (this.children[i].id == childId) {
  343. this.activeChildName = this.children[i].nickname || this.children[i].name || ''
  344. break
  345. }
  346. }
  347. this.loadFamilyMembersVisible()
  348. this.loadCognitiveReport()
  349. },
  350. loadDimensionTasks: function() {
  351. var self = this
  352. var childId = this.activeChildId
  353. if (!childId) return
  354. getTodayTasksByCategory(childId, 'wisdom').then(function(res) {
  355. if (res && res.data) {
  356. self.dimensionTasks = res.data.slice(0, 5)
  357. }
  358. }).catch(function(e) {})
  359. },
  360. loadDimensionActivities: function() {
  361. var self = this
  362. getActivityList({ dimensionCode: 'wisdom', page: 1, size: 5 }).then(function(res) {
  363. if (res && res.data) {
  364. self.dimensionActivities = res.data.records || res.data
  365. }
  366. }).catch(function(e) {})
  367. },
  368. loadDimensionProducts: function() {
  369. var self = this
  370. getProductsByDomain('wisdom', 1, 4).then(function(res) {
  371. if (res && res.data) {
  372. self.dimensionProducts = res.data.records || res.data
  373. }
  374. }).catch(function(e) {})
  375. },
  376. sectionVisible: function(key) {
  377. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  378. },
  379. onFuncClick: function(item) {
  380. if (item.needLogin && !this.isLoggedIn) {
  381. uni.showModal({
  382. title: '提示',
  383. content: '请先登录后使用此功能',
  384. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  385. })
  386. return
  387. }
  388. if (item.page) {
  389. var nativeTabs = ['/pages/tasks/tasks', '/pages/index/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/wisdom/index', '/pages/profile/profile']
  390. if (nativeTabs.indexOf(item.page) !== -1) {
  391. uni.switchTab({ url: item.page })
  392. } else {
  393. uni.navigateTo({ url: item.page })
  394. }
  395. }
  396. },
  397. scrollToSection: function(section) {},
  398. goMemberDetail: function(memberId) {
  399. uni.navigateTo({ url: '/pages/member-detail/member-detail?memberId=' + memberId + '&entrySource=relation-graph&dimensionCode=wisdom' })
  400. },
  401. goFamilyMembers: function() {
  402. uni.navigateTo({ url: '/pages/profile/family-members' })
  403. },
  404. goCognitiveReport: function() {
  405. uni.navigateTo({ url: '/pages/wisdom-detail/cognitive-report' })
  406. },
  407. goSelfQuiz: function() {
  408. uni.navigateTo({ url: '/pages/wisdom-detail/self-quiz' })
  409. },
  410. goTrainingHub: function() {
  411. uni.navigateTo({ url: '/pages/wisdom-detail/training-hub' })
  412. },
  413. goAssessment: function() {
  414. uni.navigateTo({ url: '/pages/assessment/apply' })
  415. },
  416. goHome: function() {
  417. uni.switchTab({ url: '/pages/index/index' })
  418. },
  419. onTaskClick: function(task) {},
  420. goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  421. goActivityDetail: function(id) {},
  422. goMoreActivities: function() {
  423. uni.navigateTo({ url: '/pages/activity/index' })
  424. },
  425. goActivityDetail: function(act) {
  426. if (!act || !act.id) return
  427. uni.navigateTo({ url: '/pages/discover-detail/activity-detail/activity-detail?id=' + act.id })
  428. },
  429. goProductDetail: function(prod) {
  430. if (prod && prod.id) {
  431. var token = uni.getStorageSync('token')
  432. if (token) {
  433. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  434. } else {
  435. uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/wisdom/index') })
  436. }
  437. }
  438. },
  439. goMoreProducts: function() {
  440. uni.navigateTo({ url: '/pages/shop/index' })
  441. },
  442. parseRelatedDimensions: function(val) {
  443. if (!val) return []
  444. if (Array.isArray(val)) return val
  445. if (typeof val === 'string') {
  446. try {
  447. var parsed = JSON.parse(val)
  448. return Array.isArray(parsed) ? parsed : []
  449. } catch (e) {
  450. return val.split(',').map(function(s) { return s.trim() }).filter(function(s) { return s })
  451. }
  452. }
  453. return []
  454. },
  455. loadFeaturedArticles: function() {
  456. var self = this
  457. getFeaturedArticles({ size: 5, dimensionCode: 'wisdom' }).then(function(res) {
  458. if (res.code === 200 && res.data) {
  459. var gradientColors = [
  460. 'linear-gradient(135deg, #6366F1, #818CF8)',
  461. 'linear-gradient(135deg, #8B5CF6, #A78BFA)',
  462. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  463. 'linear-gradient(135deg, #10B981, #34D399)',
  464. 'linear-gradient(135deg, #F97316, #FB923C)'
  465. ]
  466. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  467. self.articles = list.map(function(item, index) {
  468. return {
  469. id: item.id,
  470. category: item.categoryName || '智慧文章',
  471. categoryColor: gradientColors[index % gradientColors.length],
  472. title: item.title || '',
  473. summary: item.summary || '',
  474. views: item.viewCount ? String(item.viewCount) : '0',
  475. likes: '0',
  476. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  477. relatedDimensions: self.parseRelatedDimensions(item.relatedDimensions)
  478. }
  479. })
  480. }
  481. }).catch(function() {})
  482. },
  483. goMoreArticles: function() {
  484. uni.navigateTo({ url: '/pages/article-center/index?dimension=wisdom' })
  485. },
  486. goArticleDetail: function(article) {
  487. uni.navigateTo({ url: '/pages/mind-detail/article-detail?id=' + (article.id || article) })
  488. },
  489. // ===== 重要关系 =====
  490. loadContacts: function() {
  491. var self = this
  492. getContactList({}).then(function(res) {
  493. if (res.code === 200 && res.data) {
  494. self.contactList = Array.isArray(res.data) ? res.data : []
  495. }
  496. }).catch(function(e) {
  497. console.log('获取联系人失败', e)
  498. })
  499. },
  500. loadRelationshipHealth: function() {
  501. var self = this
  502. getHealthAlerts({}).then(function(res) {
  503. if (res.code === 200 && res.data) {
  504. self.healthAlerts = Array.isArray(res.data) ? res.data : []
  505. }
  506. }).catch(function() {
  507. self.healthAlerts = []
  508. })
  509. getMilestones({}, 30).then(function(res) {
  510. if (res.code === 200 && res.data) {
  511. self.milestones = Array.isArray(res.data) ? res.data : []
  512. }
  513. }).catch(function() {
  514. self.milestones = []
  515. })
  516. },
  517. onContactClick: function(item) {
  518. uni.navigateTo({ url: '/pages/wisdom-detail/contact-detail?id=' + item.id })
  519. },
  520. onShowImport: function() {
  521. uni.showToast({ title: '导入通讯录', icon: 'none' })
  522. },
  523. goInteractionLog: function(memberId) {
  524. if (memberId) {
  525. uni.navigateTo({ url: '/pages/wisdom-detail/interaction-log?memberId=' + memberId })
  526. } else {
  527. uni.navigateTo({ url: '/pages/wisdom-detail/interaction-log' })
  528. }
  529. },
  530. goRelationshipQuestionnaire: function() {
  531. uni.navigateTo({ url: '/pages/wisdom-detail/relationship-questionnaire' })
  532. },
  533. _watchPageReady() {
  534. var self = this
  535. var unwatch = this.$watch(function() {
  536. if (self.isLoggedIn) {
  537. return !!(self.cognitiveReport || self.energyOverview)
  538. }
  539. return !!(self.dimensionActivities && self.dimensionActivities.length > 0) ||
  540. !!(self.dimensionProducts && self.dimensionProducts.length > 0)
  541. }, function(val) {
  542. if (val) {
  543. if (unwatch) unwatch()
  544. self.showTabTransition = false
  545. }
  546. })
  547. setTimeout(function() {
  548. if (unwatch) unwatch()
  549. self.showTabTransition = false
  550. }, 5000)
  551. },
  552. // ===== DAN 报告 =====
  553. loadDanReports: function() {
  554. var self = this
  555. var memberId = self.activeChildId
  556. if (!memberId) return
  557. getDanReportByChild(memberId, 'wisdom').then(function(res) {
  558. if (res.code === 200 && res.data) {
  559. self.danReports = res.data
  560. }
  561. }).catch(function() {})
  562. },
  563. goDanUpload: function() {
  564. uni.navigateTo({ url: '/pages/dan-assessment/report-upload' })
  565. },
  566. viewDanReport: function(report) {
  567. uni.navigateTo({ url: '/pages/dan-assessment/report-upload?draftId=' + report.id })
  568. },
  569. formatDate: function(dateStr) {
  570. if (!dateStr) return ''
  571. var d = new Date(dateStr)
  572. return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  573. }
  574. }
  575. }
  576. </script>
  577. <style scoped>
  578. .wisdom-container {
  579. min-height: 100vh;
  580. background: #f5f7fa;
  581. padding-bottom: 120rpx;
  582. }
  583. .func-section {
  584. margin: -40rpx 20rpx 0;
  585. position: relative;
  586. z-index: 2;
  587. }
  588. .func-grid {
  589. background: #fff;
  590. border-radius: 24rpx;
  591. padding: 30rpx 16rpx;
  592. display: flex;
  593. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  594. }
  595. .func-item {
  596. flex: 1;
  597. display: flex;
  598. flex-direction: column;
  599. align-items: center;
  600. }
  601. .func-item:active {
  602. opacity: 0.7;
  603. }
  604. .func-icon-wrap {
  605. width: 88rpx;
  606. height: 88rpx;
  607. border-radius: 50%;
  608. background: #FFF8E1;
  609. display: flex;
  610. align-items: center;
  611. justify-content: center;
  612. margin-bottom: 10rpx;
  613. }
  614. .func-icon {
  615. font-size: 40rpx;
  616. }
  617. .func-label {
  618. font-size: 24rpx;
  619. color: #333;
  620. font-weight: 500;
  621. }
  622. /* ===== Section ===== */
  623. .section {
  624. margin: 20rpx 20rpx;
  625. }
  626. .section-header {
  627. display: flex;
  628. justify-content: space-between;
  629. align-items: center;
  630. margin-bottom: 20rpx;
  631. }
  632. .section-title {
  633. font-size: 30rpx;
  634. font-weight: bold;
  635. color: #333;
  636. }
  637. .section-more {
  638. font-size: 24rpx;
  639. color: #999;
  640. }
  641. /* ===== 智慧小贴士 ===== */
  642. .tips-list {
  643. display: flex;
  644. flex-direction: column;
  645. }
  646. .tip-card {
  647. background: #fff;
  648. border-radius: 16rpx;
  649. padding: 24rpx 20rpx;
  650. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  651. margin-bottom: 16rpx;
  652. }
  653. .tip-title {
  654. font-size: 28rpx;
  655. font-weight: bold;
  656. color: #333;
  657. display: block;
  658. margin-bottom: 8rpx;
  659. }
  660. .tip-summary {
  661. font-size: 24rpx;
  662. color: #888;
  663. line-height: 1.5;
  664. display: block;
  665. }
  666. /* ===== 快捷操作按钮 ===== */
  667. .quick-actions {
  668. display: flex;
  669. flex-direction: row;
  670. flex-wrap: wrap;
  671. justify-content: space-between;
  672. }
  673. .action-btn {
  674. width: 48%;
  675. background: #fff;
  676. border-radius: 16rpx;
  677. padding: 24rpx 0;
  678. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  679. display: flex;
  680. flex-direction: column;
  681. align-items: center;
  682. margin-bottom: 20rpx;
  683. }
  684. .action-btn:active {
  685. opacity: 0.8;
  686. }
  687. .action-icon {
  688. font-size: 40rpx;
  689. margin-bottom: 10rpx;
  690. }
  691. .action-text {
  692. font-size: 26rpx;
  693. color: #333;
  694. font-weight: 500;
  695. }
  696. /* ===== 底部占位 ===== */
  697. .bottom-spacer {
  698. height: 120rpx;
  699. }
  700. /* DAN 报告卡片 */
  701. .dan-card {
  702. background: #fff;
  703. border-radius: 16rpx;
  704. padding: 24rpx;
  705. margin-bottom: 16rpx;
  706. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  707. }
  708. .dan-card-header {
  709. display: flex;
  710. justify-content: space-between;
  711. align-items: center;
  712. margin-bottom: 12rpx;
  713. }
  714. .dan-report-date {
  715. font-size: 26rpx;
  716. color: #666;
  717. }
  718. .dan-status {
  719. font-size: 22rpx;
  720. padding: 4rpx 16rpx;
  721. border-radius: 8rpx;
  722. }
  723. .dan-status.confirmed {
  724. background: #D1FAE5;
  725. color: #065F46;
  726. }
  727. .dan-status.pending {
  728. background: #FEF3C7;
  729. color: #92400E;
  730. }
  731. .dan-report-desc {
  732. font-size: 28rpx;
  733. color: #333;
  734. font-weight: 500;
  735. margin-bottom: 12rpx;
  736. display: block;
  737. }
  738. .dan-card-footer {
  739. text-align: right;
  740. }
  741. .dan-view-link {
  742. font-size: 26rpx;
  743. color: #6366F1;
  744. }
  745. </style>