cognitive-report.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. ]
  87. }
  88. },
  89. onLoad: function(options) {
  90. if (options && options.memberId) {
  91. this.memberId = options.memberId
  92. } else {
  93. this.memberId = uni.getStorageSync('currentChildId') || null
  94. }
  95. this.loadReport()
  96. },
  97. methods: {
  98. loadReport: function() {
  99. var self = this
  100. var memberId = self.memberId
  101. if (!memberId) {
  102. self.loading = false
  103. return
  104. }
  105. self.loading = true
  106. getAssessmentLatestResult(memberId).then(function(res) {
  107. if (res.code === 200 && res.data) {
  108. self.report = res.data
  109. }
  110. self.loading = false
  111. }).catch(function() {
  112. self.loading = false
  113. })
  114. },
  115. goAssessment: function() {
  116. uni.navigateTo({ url: '/pages/assessment/apply' })
  117. },
  118. goTraining: function() {
  119. uni.navigateTo({ url: '/pages/mind/training?memberId=' + (this.memberId || '') })
  120. }
  121. }
  122. }
  123. </script>
  124. <style scoped>
  125. .container {
  126. min-height: 100vh;
  127. background: #f5f7fa;
  128. padding-bottom: 120rpx;
  129. }
  130. /* ===== 报告卡 ===== */
  131. .report-card {
  132. margin: 20rpx 30rpx;
  133. background: #fff;
  134. border-radius: 24rpx;
  135. padding: 40rpx;
  136. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  137. }
  138. .report-header {
  139. display: flex;
  140. flex-direction: row;
  141. justify-content: space-between;
  142. align-items: center;
  143. margin-bottom: 30rpx;
  144. }
  145. .report-title {
  146. font-size: 36rpx;
  147. font-weight: bold;
  148. color: #333;
  149. }
  150. .report-date {
  151. font-size: 24rpx;
  152. color: #999;
  153. }
  154. /* ===== 综合评分 ===== */
  155. .overall-score-wrap {
  156. text-align: center;
  157. padding: 40rpx 0;
  158. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  159. border-radius: 20rpx;
  160. margin-bottom: 40rpx;
  161. color: #fff;
  162. }
  163. .overall-label {
  164. font-size: 28rpx;
  165. opacity: 0.9;
  166. display: block;
  167. margin-bottom: 16rpx;
  168. }
  169. .overall-row {
  170. display: flex;
  171. flex-direction: row;
  172. align-items: center;
  173. justify-content: center;
  174. }
  175. .overall-value {
  176. font-size: 80rpx;
  177. font-weight: bold;
  178. margin-right: 20rpx;
  179. }
  180. .dan-badge {
  181. background: rgba(255,255,255,0.25);
  182. border-radius: 12rpx;
  183. padding: 6rpx 20rpx;
  184. }
  185. .dan-level {
  186. font-size: 28rpx;
  187. font-weight: bold;
  188. color: #FFD700;
  189. }
  190. /* ===== 七维条形图 ===== */
  191. .dimension-list {
  192. margin-bottom: 30rpx;
  193. }
  194. .dimension-item {
  195. margin-bottom: 28rpx;
  196. }
  197. .dimension-header {
  198. display: flex;
  199. flex-direction: row;
  200. justify-content: space-between;
  201. align-items: center;
  202. margin-bottom: 10rpx;
  203. }
  204. .dimension-label-row {
  205. display: flex;
  206. flex-direction: row;
  207. align-items: center;
  208. }
  209. .dimension-icon {
  210. font-size: 28rpx;
  211. margin-right: 10rpx;
  212. }
  213. .dimension-name {
  214. font-size: 28rpx;
  215. color: #333;
  216. font-weight: 500;
  217. }
  218. .dimension-score {
  219. font-size: 32rpx;
  220. font-weight: bold;
  221. color: #667eea;
  222. }
  223. .dimension-bar {
  224. height: 16rpx;
  225. background: #f0f0f0;
  226. border-radius: 8rpx;
  227. overflow: hidden;
  228. margin-bottom: 8rpx;
  229. }
  230. .dimension-bar-fill {
  231. height: 100%;
  232. background: linear-gradient(90deg, #667eea, #764ba2);
  233. border-radius: 8rpx;
  234. transition: width 0.5s;
  235. }
  236. .dimension-desc {
  237. font-size: 22rpx;
  238. color: #999;
  239. line-height: 1.4;
  240. }
  241. /* ===== 分析/建议 ===== */
  242. .report-analysis, .report-suggestions {
  243. margin-top: 30rpx;
  244. padding: 28rpx;
  245. border-radius: 16rpx;
  246. }
  247. .report-analysis {
  248. background: #f9f9ff;
  249. }
  250. .report-suggestions {
  251. background: #f0fdf4;
  252. }
  253. .analysis-header-row {
  254. display: flex;
  255. flex-direction: row;
  256. align-items: center;
  257. margin-bottom: 16rpx;
  258. }
  259. .analysis-icon {
  260. font-size: 30rpx;
  261. margin-right: 10rpx;
  262. }
  263. .analysis-title {
  264. font-size: 30rpx;
  265. font-weight: bold;
  266. color: #333;
  267. }
  268. .analysis-content, .suggestion-content {
  269. font-size: 26rpx;
  270. color: #666;
  271. line-height: 1.7;
  272. display: block;
  273. }
  274. /* ===== 底部操作 ===== */
  275. .action-row {
  276. display: flex;
  277. flex-direction: row;
  278. justify-content: space-between;
  279. margin-top: 40rpx;
  280. }
  281. .action-btn {
  282. flex: 1;
  283. display: flex;
  284. align-items: center;
  285. justify-content: center;
  286. padding: 20rpx 0;
  287. border-radius: 40rpx;
  288. }
  289. .action-btn.primary {
  290. background: linear-gradient(135deg, #667eea, #764ba2);
  291. margin-left: 16rpx;
  292. box-shadow: 0 4rpx 16rpx rgba(102,126,234,0.3);
  293. }
  294. .action-btn.secondary {
  295. background: #fff;
  296. border: 2rpx solid #ddd;
  297. margin-right: 16rpx;
  298. }
  299. .action-btn-text {
  300. font-size: 28rpx;
  301. font-weight: 500;
  302. color: #fff;
  303. }
  304. .action-btn.secondary .action-btn-text {
  305. color: #666;
  306. }
  307. /* ===== 加载中 ===== */
  308. .loading-state {
  309. display: flex;
  310. align-items: center;
  311. justify-content: center;
  312. padding: 120rpx 0;
  313. }
  314. .loading-text {
  315. font-size: 28rpx;
  316. color: #999;
  317. }
  318. /* ===== 空状态 ===== */
  319. .empty-state {
  320. display: flex;
  321. flex-direction: column;
  322. align-items: center;
  323. padding: 120rpx 40rpx 80rpx;
  324. }
  325. .empty-icon {
  326. font-size: 100rpx;
  327. margin-bottom: 20rpx;
  328. }
  329. .empty-title {
  330. font-size: 32rpx;
  331. color: #333;
  332. font-weight: bold;
  333. margin-bottom: 16rpx;
  334. }
  335. .empty-desc {
  336. font-size: 26rpx;
  337. color: #999;
  338. text-align: center;
  339. line-height: 1.6;
  340. margin-bottom: 40rpx;
  341. }
  342. .empty-btn {
  343. background: linear-gradient(135deg, #667eea, #764ba2);
  344. color: #fff;
  345. font-size: 28rpx;
  346. font-weight: bold;
  347. padding: 16rpx 64rpx;
  348. border-radius: 40rpx;
  349. box-shadow: 0 4rpx 16rpx rgba(102,126,234,0.3);
  350. }
  351. </style>