cognitive-report.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <view class="container">
  3. <PageBanner theme="wisdom"
  4. tagline="认知能力 · 全面评估"
  5. quote="知人者智,自知者明" />
  6. <view class="report-card" v-if="report">
  7. <view class="report-header">
  8. <text class="report-title">认知测评报告</text>
  9. <text class="report-date">测评日期: {{ report.assessmentDate || '-' }}</text>
  10. </view>
  11. <!-- 综合认知评分 -->
  12. <view class="overall-score-wrap">
  13. <text class="overall-label">综合认知评分</text>
  14. <view class="overall-row">
  15. <text class="overall-value">{{ report.overallScore || 0 }}</text>
  16. <view class="dan-badge">
  17. <text class="dan-level">{{ report.danLevel || '-' }}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 六维条形图 -->
  22. <view class="dimension-list">
  23. <view class="dimension-item" v-for="dim in dimensions" :key="dim.key">
  24. <view class="dimension-header">
  25. <view class="dimension-label-row">
  26. <text class="dimension-icon">{{ dim.icon }}</text>
  27. <text class="dimension-name">{{ dim.label }}</text>
  28. </view>
  29. <text class="dimension-score">{{ report[dim.key] || 0 }}</text>
  30. </view>
  31. <view class="dimension-bar">
  32. <view class="dimension-bar-fill" :style="{ width: (report[dim.key] || 0) + '%' }"></view>
  33. </view>
  34. <text class="dimension-desc">{{ dim.desc }}</text>
  35. </view>
  36. </view>
  37. <!-- 分析报告 -->
  38. <view class="report-analysis" v-if="report.analysisReport">
  39. <view class="analysis-header-row">
  40. <text class="analysis-icon">&#x1F4DD;</text>
  41. <text class="analysis-title">分析报告</text>
  42. </view>
  43. <text class="analysis-content">{{ report.analysisReport }}</text>
  44. </view>
  45. <!-- 成长建议 -->
  46. <view class="report-suggestions" v-if="report.growthSuggestions">
  47. <view class="analysis-header-row">
  48. <text class="analysis-icon">&#x1F331;</text>
  49. <text class="analysis-title">成长建议</text>
  50. </view>
  51. <text class="suggestion-content">{{ report.growthSuggestions }}</text>
  52. </view>
  53. <!-- 底部操作 -->
  54. <view class="action-row">
  55. <view class="action-btn secondary" @click="goAssessment">
  56. <text class="action-btn-text">预约测评</text>
  57. </view>
  58. <view class="action-btn primary" @click="goTraining">
  59. <text class="action-btn-text">认知训练</text>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 加载中 -->
  64. <view class="loading-state" v-if="loading">
  65. <text class="loading-text">加载中...</text>
  66. </view>
  67. <!-- 无数据 -->
  68. <view class="empty-state" v-if="!report && !loading">
  69. <text class="empty-icon">&#x1F9E0;</text>
  70. <text class="empty-title">暂无认知测评数据</text>
  71. <text class="empty-desc">完成 DAN 认知评估后,可在此查看详细的六维认知分析报告</text>
  72. <view class="empty-btn" @click="goAssessment">预约测评</view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import PageBanner from '../../components/PageBanner.vue'
  78. import { getAssessmentLatestResult } from '../../utils/api.js'
  79. export default {
  80. components: { PageBanner },
  81. data: function() {
  82. return {
  83. childId: null,
  84. report: null,
  85. loading: true,
  86. dimensions: [
  87. { key: 'perceptionScore', label: '感知能力', icon: '\u{1F441}', desc: '感官信息处理能力' },
  88. { key: 'focusScore', label: '专注力', icon: '\u{1F3AF}', desc: '持续集中和抗干扰能力' },
  89. { key: 'memoryScore', label: '记忆力', icon: '\u{1F9E0}', desc: '信息编码和回忆能力' },
  90. { key: 'logicScore', label: '逻辑思维', icon: '\u{1F9E9}', desc: '推理和问题解决能力' },
  91. { key: 'spatialScore', label: '空间思维', icon: '\u{1F9CA}', desc: '空间想象和方位判断' },
  92. { key: 'processingSpeedScore', label: '加工速度', icon: '\u26A1', desc: '信息处理和反应速度' }
  93. ]
  94. }
  95. },
  96. onLoad: function(options) {
  97. if (options && options.childId) {
  98. this.childId = options.childId
  99. } else {
  100. this.childId = uni.getStorageSync('currentChildId') || null
  101. }
  102. this.loadReport()
  103. },
  104. methods: {
  105. loadReport: function() {
  106. var self = this
  107. var childId = self.childId
  108. if (!childId) {
  109. self.loading = false
  110. return
  111. }
  112. self.loading = true
  113. getAssessmentLatestResult(childId).then(function(res) {
  114. if (res.code === 200 && res.data) {
  115. self.report = res.data
  116. }
  117. self.loading = false
  118. }).catch(function() {
  119. self.loading = false
  120. })
  121. },
  122. goAssessment: function() {
  123. uni.navigateTo({ url: '/pages/assessment/apply' })
  124. },
  125. goTraining: function() {
  126. uni.navigateTo({ url: '/pages/mind/training?childId=' + (this.childId || '') })
  127. }
  128. }
  129. }
  130. </script>
  131. <style scoped>
  132. .container {
  133. min-height: 100vh;
  134. background: #f5f7fa;
  135. padding-bottom: 120rpx;
  136. }
  137. /* ===== 报告卡 ===== */
  138. .report-card {
  139. margin: 20rpx 30rpx;
  140. background: #fff;
  141. border-radius: 24rpx;
  142. padding: 40rpx;
  143. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  144. }
  145. .report-header {
  146. display: flex;
  147. flex-direction: row;
  148. justify-content: space-between;
  149. align-items: center;
  150. margin-bottom: 30rpx;
  151. }
  152. .report-title {
  153. font-size: 36rpx;
  154. font-weight: bold;
  155. color: #333;
  156. }
  157. .report-date {
  158. font-size: 24rpx;
  159. color: #999;
  160. }
  161. /* ===== 综合评分 ===== */
  162. .overall-score-wrap {
  163. text-align: center;
  164. padding: 40rpx 0;
  165. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  166. border-radius: 20rpx;
  167. margin-bottom: 40rpx;
  168. color: #fff;
  169. }
  170. .overall-label {
  171. font-size: 28rpx;
  172. opacity: 0.9;
  173. display: block;
  174. margin-bottom: 16rpx;
  175. }
  176. .overall-row {
  177. display: flex;
  178. flex-direction: row;
  179. align-items: center;
  180. justify-content: center;
  181. }
  182. .overall-value {
  183. font-size: 80rpx;
  184. font-weight: bold;
  185. margin-right: 20rpx;
  186. }
  187. .dan-badge {
  188. background: rgba(255,255,255,0.25);
  189. border-radius: 12rpx;
  190. padding: 6rpx 20rpx;
  191. }
  192. .dan-level {
  193. font-size: 28rpx;
  194. font-weight: bold;
  195. color: #FFD700;
  196. }
  197. /* ===== 七维条形图 ===== */
  198. .dimension-list {
  199. margin-bottom: 30rpx;
  200. }
  201. .dimension-item {
  202. margin-bottom: 28rpx;
  203. }
  204. .dimension-header {
  205. display: flex;
  206. flex-direction: row;
  207. justify-content: space-between;
  208. align-items: center;
  209. margin-bottom: 10rpx;
  210. }
  211. .dimension-label-row {
  212. display: flex;
  213. flex-direction: row;
  214. align-items: center;
  215. }
  216. .dimension-icon {
  217. font-size: 28rpx;
  218. margin-right: 10rpx;
  219. }
  220. .dimension-name {
  221. font-size: 28rpx;
  222. color: #333;
  223. font-weight: 500;
  224. }
  225. .dimension-score {
  226. font-size: 32rpx;
  227. font-weight: bold;
  228. color: #667eea;
  229. }
  230. .dimension-bar {
  231. height: 16rpx;
  232. background: #f0f0f0;
  233. border-radius: 8rpx;
  234. overflow: hidden;
  235. margin-bottom: 8rpx;
  236. }
  237. .dimension-bar-fill {
  238. height: 100%;
  239. background: linear-gradient(90deg, #667eea, #764ba2);
  240. border-radius: 8rpx;
  241. transition: width 0.5s;
  242. }
  243. .dimension-desc {
  244. font-size: 22rpx;
  245. color: #999;
  246. line-height: 1.4;
  247. }
  248. /* ===== 分析/建议 ===== */
  249. .report-analysis, .report-suggestions {
  250. margin-top: 30rpx;
  251. padding: 28rpx;
  252. border-radius: 16rpx;
  253. }
  254. .report-analysis {
  255. background: #f9f9ff;
  256. }
  257. .report-suggestions {
  258. background: #f0fdf4;
  259. }
  260. .analysis-header-row {
  261. display: flex;
  262. flex-direction: row;
  263. align-items: center;
  264. margin-bottom: 16rpx;
  265. }
  266. .analysis-icon {
  267. font-size: 30rpx;
  268. margin-right: 10rpx;
  269. }
  270. .analysis-title {
  271. font-size: 30rpx;
  272. font-weight: bold;
  273. color: #333;
  274. }
  275. .analysis-content, .suggestion-content {
  276. font-size: 26rpx;
  277. color: #666;
  278. line-height: 1.7;
  279. display: block;
  280. }
  281. /* ===== 底部操作 ===== */
  282. .action-row {
  283. display: flex;
  284. flex-direction: row;
  285. justify-content: space-between;
  286. margin-top: 40rpx;
  287. }
  288. .action-btn {
  289. flex: 1;
  290. display: flex;
  291. align-items: center;
  292. justify-content: center;
  293. padding: 20rpx 0;
  294. border-radius: 40rpx;
  295. }
  296. .action-btn.primary {
  297. background: linear-gradient(135deg, #667eea, #764ba2);
  298. margin-left: 16rpx;
  299. box-shadow: 0 4rpx 16rpx rgba(102,126,234,0.3);
  300. }
  301. .action-btn.secondary {
  302. background: #fff;
  303. border: 2rpx solid #ddd;
  304. margin-right: 16rpx;
  305. }
  306. .action-btn-text {
  307. font-size: 28rpx;
  308. font-weight: 500;
  309. color: #fff;
  310. }
  311. .action-btn.secondary .action-btn-text {
  312. color: #666;
  313. }
  314. /* ===== 加载中 ===== */
  315. .loading-state {
  316. display: flex;
  317. align-items: center;
  318. justify-content: center;
  319. padding: 120rpx 0;
  320. }
  321. .loading-text {
  322. font-size: 28rpx;
  323. color: #999;
  324. }
  325. /* ===== 空状态 ===== */
  326. .empty-state {
  327. display: flex;
  328. flex-direction: column;
  329. align-items: center;
  330. padding: 120rpx 40rpx 80rpx;
  331. }
  332. .empty-icon {
  333. font-size: 100rpx;
  334. margin-bottom: 20rpx;
  335. }
  336. .empty-title {
  337. font-size: 32rpx;
  338. color: #333;
  339. font-weight: bold;
  340. margin-bottom: 16rpx;
  341. }
  342. .empty-desc {
  343. font-size: 26rpx;
  344. color: #999;
  345. text-align: center;
  346. line-height: 1.6;
  347. margin-bottom: 40rpx;
  348. }
  349. .empty-btn {
  350. background: linear-gradient(135deg, #667eea, #764ba2);
  351. color: #fff;
  352. font-size: 28rpx;
  353. font-weight: bold;
  354. padding: 16rpx 64rpx;
  355. border-radius: 40rpx;
  356. box-shadow: 0 4rpx 16rpx rgba(102,126,234,0.3);
  357. }
  358. </style>