cognitive-report.vue 9.0 KB

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