cognitive-report.vue 9.0 KB

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