index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  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-extra/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. // FIX: 不再自动选择第一个孩子
  302. }
  303. // Load cognitive report only if activeChildId is set (user switched)
  304. if (self.activeChildId) {
  305. self.loadCognitiveReport()
  306. }
  307. }
  308. self.loadContacts()
  309. }).catch(function(e) {})
  310. },
  311. loadFamilyMembersVisible: function() {
  312. var self = this
  313. getFamilyEnergySandbox().then(function(res) {
  314. if (res && res.data) {
  315. self.sandboxData = res.data.sandboxData || null
  316. self.dualDimension = res.data.dualDimension || null
  317. if (res.data.members) {
  318. self.familyMembersVisible = res.data.members
  319. }
  320. }
  321. }).catch(function(e) {})
  322. },
  323. loadCognitiveReport: function() {
  324. var self = this
  325. var childId = this.activeChildId
  326. if (!childId) return
  327. getAssessmentLatestResult(childId).then(function(res) {
  328. if (res.code === 200 && res.data) {
  329. self.cognitiveReport = res.data
  330. }
  331. }).catch(function(e) {})
  332. },
  333. onChildChanged: function(childId) {
  334. this.activeChildId = childId
  335. // FIX: 同步提交到 Vuex store
  336. this.$store.commit('switchToChild', childId)
  337. for (var i = 0; i < this.children.length; i++) {
  338. if (this.children[i].id == childId) {
  339. this.activeChildName = this.children[i].nickname || this.children[i].name || ''
  340. break
  341. }
  342. }
  343. this.loadFamilyMembersVisible()
  344. this.loadCognitiveReport()
  345. },
  346. loadDimensionTasks: function() {
  347. var self = this
  348. var childId = this.activeChildId
  349. if (!childId) return
  350. getTodayTasksByCategory(childId, 'wisdom').then(function(res) {
  351. if (res && res.data) {
  352. self.dimensionTasks = res.data.slice(0, 5)
  353. }
  354. }).catch(function(e) {})
  355. },
  356. loadDimensionActivities: function() {
  357. var self = this
  358. getActivityList({ dimensionCode: 'wisdom', page: 1, size: 5 }).then(function(res) {
  359. if (res && res.data) {
  360. self.dimensionActivities = res.data.records || res.data
  361. }
  362. }).catch(function(e) {})
  363. },
  364. loadDimensionProducts: function() {
  365. var self = this
  366. getProductsByDomain('wisdom', 1, 4).then(function(res) {
  367. if (res && res.data) {
  368. self.dimensionProducts = res.data.records || res.data
  369. }
  370. }).catch(function(e) {})
  371. },
  372. sectionVisible: function(key) {
  373. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  374. },
  375. onFuncClick: function(item) {
  376. if (item.needLogin && !this.isLoggedIn) {
  377. uni.showModal({
  378. title: '提示',
  379. content: '请先登录后使用此功能',
  380. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  381. })
  382. return
  383. }
  384. if (item.page) {
  385. var nativeTabs = ['/pages/tasks/tasks', '/pages/index/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/wisdom/index', '/pages/profile/profile']
  386. if (nativeTabs.indexOf(item.page) !== -1) {
  387. uni.switchTab({ url: item.page })
  388. } else {
  389. uni.navigateTo({ url: item.page })
  390. }
  391. }
  392. },
  393. scrollToSection: function(section) {},
  394. goMemberDetail: function(memberId) {
  395. uni.navigateTo({ url: '/pages/member-detail/member-detail?memberId=' + memberId + '&entrySource=relation-graph&dimensionCode=wisdom' })
  396. },
  397. goFamilyMembers: function() {
  398. uni.navigateTo({ url: '/pages/profile-extra/family-members' })
  399. },
  400. goCognitiveReport: function() {
  401. uni.navigateTo({ url: '/pages/wisdom-detail/cognitive-report' })
  402. },
  403. goSelfQuiz: function() {
  404. uni.navigateTo({ url: '/pages/wisdom-detail/self-quiz' })
  405. },
  406. goTrainingHub: function() {
  407. uni.navigateTo({ url: '/pages/wisdom-detail/training-hub' })
  408. },
  409. goAssessment: function() {
  410. uni.navigateTo({ url: '/pages/assessment/apply' })
  411. },
  412. goHome: function() {
  413. uni.switchTab({ url: '/pages/index/index' })
  414. },
  415. onTaskClick: function(task) {},
  416. goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  417. goActivityDetail: function(id) {},
  418. goMoreActivities: function() {
  419. uni.navigateTo({ url: '/pages/activity/index' })
  420. },
  421. goActivityDetail: function(act) {
  422. if (!act || !act.id) return
  423. uni.navigateTo({ url: '/pages/discover-detail/activity-detail/activity-detail?id=' + act.id })
  424. },
  425. goProductDetail: function(prod) {
  426. if (prod && prod.id) {
  427. var token = uni.getStorageSync('token')
  428. if (token) {
  429. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  430. } else {
  431. uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/wisdom/index') })
  432. }
  433. }
  434. },
  435. goMoreProducts: function() {
  436. uni.navigateTo({ url: '/pages/shop/index' })
  437. },
  438. parseRelatedDimensions: function(val) {
  439. if (!val) return []
  440. if (Array.isArray(val)) return val
  441. if (typeof val === 'string') {
  442. try {
  443. var parsed = JSON.parse(val)
  444. return Array.isArray(parsed) ? parsed : []
  445. } catch (e) {
  446. return val.split(',').map(function(s) { return s.trim() }).filter(function(s) { return s })
  447. }
  448. }
  449. return []
  450. },
  451. loadFeaturedArticles: function() {
  452. var self = this
  453. getFeaturedArticles({ size: 5, dimensionCode: 'wisdom' }).then(function(res) {
  454. if (res.code === 200 && res.data) {
  455. var gradientColors = [
  456. 'linear-gradient(135deg, #6366F1, #818CF8)',
  457. 'linear-gradient(135deg, #8B5CF6, #A78BFA)',
  458. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  459. 'linear-gradient(135deg, #10B981, #34D399)',
  460. 'linear-gradient(135deg, #F97316, #FB923C)'
  461. ]
  462. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  463. self.articles = list.map(function(item, index) {
  464. return {
  465. id: item.id,
  466. category: item.categoryName || '智慧养成',
  467. categoryColor: gradientColors[index % gradientColors.length],
  468. title: item.title || '',
  469. summary: item.summary || '',
  470. dimensionWeights: item.dimensionWeights || null,
  471. views: item.viewCount ? String(item.viewCount) : '0',
  472. likes: '0',
  473. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  474. relatedDimensions: self.parseRelatedDimensions(item.relatedDimensions)
  475. }
  476. })
  477. }
  478. }).catch(function() {})
  479. },
  480. goMoreArticles: function() {
  481. uni.navigateTo({ url: '/pages/article-center/index?dimension=wisdom' })
  482. },
  483. goArticleDetail: function(article) {
  484. uni.navigateTo({ url: '/pages/mind-detail/article-detail?id=' + (article.id || article) })
  485. },
  486. // ===== 重要关系 =====
  487. loadContacts: function() {
  488. var self = this
  489. getContactList({}).then(function(res) {
  490. if (res.code === 200 && res.data) {
  491. self.contactList = Array.isArray(res.data) ? res.data : []
  492. }
  493. }).catch(function(e) {
  494. console.log('获取联系人失败', e)
  495. })
  496. },
  497. loadRelationshipHealth: function() {
  498. var self = this
  499. getHealthAlerts({}).then(function(res) {
  500. if (res.code === 200 && res.data) {
  501. self.healthAlerts = Array.isArray(res.data) ? res.data : []
  502. }
  503. }).catch(function() {
  504. self.healthAlerts = []
  505. })
  506. getMilestones({}, 30).then(function(res) {
  507. if (res.code === 200 && res.data) {
  508. self.milestones = Array.isArray(res.data) ? res.data : []
  509. }
  510. }).catch(function() {
  511. self.milestones = []
  512. })
  513. },
  514. onContactClick: function(item) {
  515. uni.navigateTo({ url: '/pages/wisdom-detail/contact-detail?id=' + item.id })
  516. },
  517. onShowImport: function() {
  518. uni.showToast({ title: '导入通讯录', icon: 'none' })
  519. },
  520. goInteractionLog: function(memberId) {
  521. if (memberId) {
  522. uni.navigateTo({ url: '/pages/wisdom-detail/interaction-log?memberId=' + memberId })
  523. } else {
  524. uni.navigateTo({ url: '/pages/wisdom-detail/interaction-log' })
  525. }
  526. },
  527. goRelationshipQuestionnaire: function() {
  528. uni.navigateTo({ url: '/pages/wisdom-detail/relationship-questionnaire' })
  529. },
  530. _watchPageReady() {
  531. var self = this
  532. var unwatch = this.$watch(function() {
  533. if (self.isLoggedIn) {
  534. return !!(self.cognitiveReport || self.energyOverview)
  535. }
  536. return !!(self.dimensionActivities && self.dimensionActivities.length > 0) ||
  537. !!(self.dimensionProducts && self.dimensionProducts.length > 0)
  538. }, function(val) {
  539. if (val) {
  540. if (unwatch) unwatch()
  541. self.showTabTransition = false
  542. }
  543. })
  544. setTimeout(function() {
  545. if (unwatch) unwatch()
  546. self.showTabTransition = false
  547. }, 5000)
  548. },
  549. // ===== DAN 报告 =====
  550. loadDanReports: function() {
  551. var self = this
  552. var memberId = self.activeChildId
  553. if (!memberId) return
  554. getDanReportByChild(memberId, 'wisdom').then(function(res) {
  555. if (res.code === 200 && res.data) {
  556. self.danReports = res.data
  557. }
  558. }).catch(function() {})
  559. },
  560. goDanUpload: function() {
  561. uni.navigateTo({ url: '/pages/dan-assessment/report-upload' })
  562. },
  563. viewDanReport: function(report) {
  564. uni.navigateTo({ url: '/pages/dan-assessment/report-upload?draftId=' + report.id })
  565. },
  566. formatDate: function(dateStr) {
  567. if (!dateStr) return ''
  568. var d = new Date(dateStr)
  569. return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
  570. }
  571. }
  572. }
  573. </script>
  574. <style scoped>
  575. .wisdom-container {
  576. min-height: 100vh;
  577. background: #f5f7fa;
  578. padding-bottom: 120rpx;
  579. }
  580. .func-section {
  581. margin: -40rpx 20rpx 0;
  582. position: relative;
  583. z-index: 2;
  584. }
  585. .func-grid {
  586. background: #fff;
  587. border-radius: 24rpx;
  588. padding: 30rpx 16rpx;
  589. display: flex;
  590. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  591. }
  592. .func-item {
  593. flex: 1;
  594. display: flex;
  595. flex-direction: column;
  596. align-items: center;
  597. }
  598. .func-item:active {
  599. opacity: 0.7;
  600. }
  601. .func-icon-wrap {
  602. width: 88rpx;
  603. height: 88rpx;
  604. border-radius: 50%;
  605. background: #FFF8E1;
  606. display: flex;
  607. align-items: center;
  608. justify-content: center;
  609. margin-bottom: 10rpx;
  610. }
  611. .func-icon {
  612. font-size: 40rpx;
  613. }
  614. .func-label {
  615. font-size: 24rpx;
  616. color: #333;
  617. font-weight: 500;
  618. }
  619. /* ===== Section ===== */
  620. .section {
  621. margin: 20rpx 20rpx;
  622. }
  623. .section-header {
  624. display: flex;
  625. justify-content: space-between;
  626. align-items: center;
  627. margin-bottom: 20rpx;
  628. }
  629. .section-title {
  630. font-size: 30rpx;
  631. font-weight: bold;
  632. color: #333;
  633. }
  634. .section-more {
  635. font-size: 24rpx;
  636. color: #999;
  637. }
  638. /* ===== 智慧小贴士 ===== */
  639. .tips-list {
  640. display: flex;
  641. flex-direction: column;
  642. }
  643. .tip-card {
  644. background: #fff;
  645. border-radius: 16rpx;
  646. padding: 24rpx 20rpx;
  647. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  648. margin-bottom: 16rpx;
  649. }
  650. .tip-title {
  651. font-size: 28rpx;
  652. font-weight: bold;
  653. color: #333;
  654. display: block;
  655. margin-bottom: 8rpx;
  656. }
  657. .tip-summary {
  658. font-size: 24rpx;
  659. color: #888;
  660. line-height: 1.5;
  661. display: block;
  662. }
  663. /* ===== 快捷操作按钮 ===== */
  664. .quick-actions {
  665. display: flex;
  666. flex-direction: row;
  667. flex-wrap: wrap;
  668. justify-content: space-between;
  669. }
  670. .action-btn {
  671. width: 48%;
  672. background: #fff;
  673. border-radius: 16rpx;
  674. padding: 24rpx 0;
  675. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  676. display: flex;
  677. flex-direction: column;
  678. align-items: center;
  679. margin-bottom: 20rpx;
  680. }
  681. .action-btn:active {
  682. opacity: 0.8;
  683. }
  684. .action-icon {
  685. font-size: 40rpx;
  686. margin-bottom: 10rpx;
  687. }
  688. .action-text {
  689. font-size: 26rpx;
  690. color: #333;
  691. font-weight: 500;
  692. }
  693. /* ===== 底部占位 ===== */
  694. .bottom-spacer {
  695. height: 120rpx;
  696. }
  697. /* DAN 报告卡片 */
  698. .dan-card {
  699. background: #fff;
  700. border-radius: 16rpx;
  701. padding: 24rpx;
  702. margin-bottom: 16rpx;
  703. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  704. }
  705. .dan-card-header {
  706. display: flex;
  707. justify-content: space-between;
  708. align-items: center;
  709. margin-bottom: 12rpx;
  710. }
  711. .dan-report-date {
  712. font-size: 26rpx;
  713. color: #666;
  714. }
  715. .dan-status {
  716. font-size: 22rpx;
  717. padding: 4rpx 16rpx;
  718. border-radius: 8rpx;
  719. }
  720. .dan-status.confirmed {
  721. background: #D1FAE5;
  722. color: #065F46;
  723. }
  724. .dan-status.pending {
  725. background: #FEF3C7;
  726. color: #92400E;
  727. }
  728. .dan-report-desc {
  729. font-size: 28rpx;
  730. color: #333;
  731. font-weight: 500;
  732. margin-bottom: 12rpx;
  733. display: block;
  734. }
  735. .dan-card-footer {
  736. text-align: right;
  737. }
  738. .dan-view-link {
  739. font-size: 26rpx;
  740. color: #6366F1;
  741. }
  742. </style>