results.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <text class="title">测评报告</text>
  5. <text class="subtitle">查看下级成长规划师的测评报告</text>
  6. <text class="appointments-link" @click="goToAppointments">查看我的预约 ›</text>
  7. </view>
  8. <!-- 标签页 -->
  9. <view class="tabs">
  10. <view
  11. class="tab-item"
  12. :class="{ 'active': currentTab === 'my' }"
  13. @click="switchTab('my')"
  14. >
  15. <text class="tab-text">我的报告</text>
  16. </view>
  17. <view
  18. class="tab-item"
  19. :class="{ 'active': currentTab === 'child' }"
  20. @click="switchTab('child')"
  21. >
  22. <text class="tab-text">下级报告</text>
  23. </view>
  24. </view>
  25. <!-- 我的报告列表 -->
  26. <view class="section" v-if="currentTab === 'my'">
  27. <view class="section-title">我的测评报告</view>
  28. <view class="report-list" v-if="myReports.length > 0">
  29. <view
  30. class="report-item"
  31. v-for="report in myReports"
  32. :key="report.id"
  33. @click="viewReportDetail(report)"
  34. >
  35. <view class="report-header">
  36. <text class="report-child">{{ report.childName || '未命名' }}</text>
  37. <text class="report-date">{{ formatDate(report.assessmentDate) }}</text>
  38. </view>
  39. <view class="report-scores">
  40. <view class="score-item">
  41. <text class="score-label">综合得分</text>
  42. <text class="score-value">{{ report.overallScore }}</text>
  43. </view>
  44. </view>
  45. <view class="report-preview">
  46. <text class="preview-text">{{ report.analysisReport && report.analysisReport.substring(0, 50) || '' }}...</text>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="empty-state" v-else>
  51. <text class="empty-icon">📊</text>
  52. <text class="empty-text">还没有测评报告</text>
  53. <text class="empty-hint">完成测评后会生成报告</text>
  54. </view>
  55. </view>
  56. <!-- 下级报告列表 -->
  57. <view class="section" v-if="currentTab === 'child'">
  58. <view class="section-title">下级成长规划师的报告</view>
  59. <view class="report-list" v-if="childReports.length > 0">
  60. <view
  61. class="report-item"
  62. v-for="report in childReports"
  63. :key="report.id"
  64. @click="viewReportDetail(report)"
  65. >
  66. <view class="report-header">
  67. <text class="report-child">{{ report.childName || '未命名' }}</text>
  68. <text class="report-date">{{ formatDate(report.assessmentDate) }}</text>
  69. <text class="report-guide">成长规划师: {{ report.guideName || '未知' }}</text>
  70. </view>
  71. <view class="report-scores">
  72. <view class="score-item">
  73. <text class="score-label">综合得分</text>
  74. <text class="score-value">{{ report.overallScore }}</text>
  75. </view>
  76. </view>
  77. <view class="report-preview">
  78. <text class="preview-text">{{ report.analysisReport && report.analysisReport.substring(0, 50) }}...</text>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="empty-state" v-else>
  83. <text class="empty-icon">📊</text>
  84. <text class="empty-text">还没有下级成长规划师的报告</text>
  85. <text class="empty-hint">下级成长规划师完成测评后会显示</text>
  86. </view>
  87. </view>
  88. <!-- 报告详情弹窗 -->
  89. <view class="report-modal" v-if="showReportModal" @click="showReportModal = false">
  90. <view class="modal-content" @click.stop>
  91. <view class="modal-header">
  92. <text class="modal-title">测评报告详情</text>
  93. <text class="modal-close" @click="showReportModal = false">✕</text>
  94. </view>
  95. <view class="report-detail">
  96. <view class="detail-section">
  97. <text class="detail-title">基本信息</text>
  98. <view class="detail-row">
  99. <text class="detail-label">孩子姓名</text>
  100. <text class="detail-value">{{ currentReport.childName || '未命名' }}</text>
  101. </view>
  102. <view class="detail-row">
  103. <text class="detail-label">测评日期</text>
  104. <text class="detail-value">{{ formatDate(currentReport.assessmentDate) }}</text>
  105. </view>
  106. <view class="detail-row">
  107. <text class="detail-label">测评时长</text>
  108. <text class="detail-value">{{ currentReport.durationMinutes }}分钟</text>
  109. </view>
  110. </view>
  111. <view class="detail-section">
  112. <text class="detail-title">DAN测评结果</text>
  113. <view class="detail-row">
  114. <text class="detail-label">注意力得分</text>
  115. <text class="detail-value">{{ currentReport.attentionScore }}</text>
  116. </view>
  117. <view class="detail-row">
  118. <text class="detail-label">专注力得分</text>
  119. <text class="detail-value">{{ currentReport.focusScore }}</text>
  120. </view>
  121. <view class="detail-row">
  122. <text class="detail-label">记忆力得分</text>
  123. <text class="detail-value">{{ currentReport.memoryScore }}</text>
  124. </view>
  125. <view class="detail-row">
  126. <text class="detail-label">逻辑思维得分</text>
  127. <text class="detail-value">{{ currentReport.logicScore }}</text>
  128. </view>
  129. <view class="detail-row">
  130. <text class="detail-label">综合得分</text>
  131. <text class="detail-value">{{ currentReport.overallScore }}</text>
  132. </view>
  133. </view>
  134. <view class="detail-section">
  135. <text class="detail-title">分析报告</text>
  136. <view class="detail-content">
  137. <text class="content-text">{{ currentReport.analysisReport }}</text>
  138. </view>
  139. </view>
  140. <view class="detail-section">
  141. <text class="detail-title">成长建议</text>
  142. <view class="detail-content">
  143. <text class="content-text">{{ currentReport.growthSuggestions }}</text>
  144. </view>
  145. </view>
  146. <view class="detail-section" v-if="currentReport.nextReviewDate">
  147. <text class="detail-title">下次复测日期</text>
  148. <view class="detail-row">
  149. <text class="detail-label">建议复测时间</text>
  150. <text class="detail-value">{{ formatDate(currentReport.nextReviewDate) }}</text>
  151. </view>
  152. </view>
  153. </view>
  154. <view class="modal-actions">
  155. <button class="btn-close" @click="showReportModal = false">关闭</button>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. </template>
  161. <script>
  162. import { getMyAssessmentResults, getChildAssessmentResults } from '../../utils/api.js'
  163. import { parseDate } from '../../utils/format.js'
  164. export default {
  165. data() {
  166. return {
  167. currentTab: 'my',
  168. myReports: [],
  169. childReports: [],
  170. currentReport: null,
  171. showReportModal: false
  172. }
  173. },
  174. onLoad() {
  175. this.loadData()
  176. },
  177. methods: {
  178. async loadData() {
  179. try {
  180. // 并行获取数据
  181. const [myRes, childRes] = await Promise.all([
  182. getMyAssessmentResults(),
  183. getChildAssessmentResults()
  184. ])
  185. if (myRes.code === 200) {
  186. this.myReports = myRes.data || []
  187. }
  188. if (childRes.code === 200) {
  189. this.childReports = childRes.data || []
  190. }
  191. } catch (e) {
  192. console.error('加载数据失败', e)
  193. }
  194. },
  195. switchTab(tab) {
  196. this.currentTab = tab
  197. },
  198. viewReportDetail(report) {
  199. this.currentReport = report
  200. this.showReportModal = true
  201. },
  202. formatDate(dateStr) {
  203. if (!dateStr) return ''
  204. const date = parseDate(dateStr)
  205. if (!date) return ''
  206. return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
  207. },
  208. goToAppointments() {
  209. uni.navigateTo({ url: '/pages/parent/appointments' })
  210. }
  211. }
  212. }
  213. </script>
  214. <style scoped>
  215. .container {
  216. padding: 30rpx;
  217. background: #F8F8F8;
  218. min-height: 100vh;
  219. }
  220. .header {
  221. text-align: center;
  222. padding: 60rpx 0 40rpx;
  223. }
  224. .title {
  225. font-size: 48rpx;
  226. font-weight: bold;
  227. color: #333;
  228. display: block;
  229. margin-bottom: 20rpx;
  230. }
  231. .subtitle {
  232. font-size: 28rpx;
  233. color: #666;
  234. }
  235. .tabs {
  236. display: flex;
  237. background: #fff;
  238. border-radius: 20rpx;
  239. padding: 10rpx;
  240. margin-bottom: 30rpx;
  241. }
  242. .tab-item {
  243. flex: 1;
  244. text-align: center;
  245. padding: 20rpx;
  246. border-radius: 10rpx;
  247. font-size: 28rpx;
  248. color: #666;
  249. }
  250. .tab-item.active {
  251. background: #667eea;
  252. color: #fff;
  253. }
  254. .section {
  255. background: #fff;
  256. border-radius: 20rpx;
  257. padding: 30rpx;
  258. margin-bottom: 30rpx;
  259. }
  260. .section-title {
  261. font-size: 32rpx;
  262. font-weight: bold;
  263. color: #333;
  264. margin-bottom: 20rpx;
  265. }
  266. .report-list {
  267. display: flex;
  268. flex-direction: column;
  269. gap: 20rpx;
  270. }
  271. .report-item {
  272. background: #F8F8F8;
  273. border-radius: 10rpx;
  274. padding: 20rpx;
  275. }
  276. .report-header {
  277. display: flex;
  278. justify-content: space-between;
  279. align-items: center;
  280. margin-bottom: 15rpx;
  281. }
  282. .report-child {
  283. font-size: 30rpx;
  284. font-weight: bold;
  285. color: #333;
  286. }
  287. .report-date {
  288. font-size: 24rpx;
  289. color: #999;
  290. }
  291. .report-guide {
  292. font-size: 24rpx;
  293. color: #667eea;
  294. }
  295. .report-scores {
  296. display: flex;
  297. gap: 20rpx;
  298. margin-bottom: 15rpx;
  299. }
  300. .score-item {
  301. background: #E8F5E9;
  302. padding: 10rpx 15rpx;
  303. border-radius: 10rpx;
  304. }
  305. .score-label {
  306. font-size: 24rpx;
  307. color: #666;
  308. display: block;
  309. margin-bottom: 5rpx;
  310. }
  311. .score-value {
  312. font-size: 28rpx;
  313. font-weight: bold;
  314. color: #333;
  315. }
  316. .report-preview {
  317. font-size: 26rpx;
  318. color: #999;
  319. line-height: 1.5;
  320. }
  321. .empty-state {
  322. text-align: center;
  323. padding: 60rpx 0;
  324. }
  325. .empty-icon {
  326. font-size: 80rpx;
  327. display: block;
  328. margin-bottom: 20rpx;
  329. }
  330. .empty-text {
  331. font-size: 28rpx;
  332. color: #999;
  333. display: block;
  334. margin-bottom: 10rpx;
  335. }
  336. .empty-hint {
  337. font-size: 24rpx;
  338. color: #CCC;
  339. }
  340. .report-modal {
  341. position: fixed;
  342. top: 0;
  343. left: 0;
  344. right: 0;
  345. bottom: 0;
  346. background: rgba(0, 0, 0, 0.5);
  347. display: flex;
  348. align-items: center;
  349. justify-content: center;
  350. z-index: 999;
  351. }
  352. .modal-content {
  353. background: #fff;
  354. border-radius: 20rpx;
  355. padding: 40rpx;
  356. width: 90%;
  357. max-height: 80vh;
  358. overflow-y: auto;
  359. }
  360. .modal-header {
  361. display: flex;
  362. justify-content: space-between;
  363. align-items: center;
  364. margin-bottom: 30rpx;
  365. }
  366. .modal-title {
  367. font-size: 32rpx;
  368. font-weight: bold;
  369. color: #333;
  370. }
  371. .modal-close {
  372. font-size: 40rpx;
  373. color: #999;
  374. padding: 10rpx;
  375. }
  376. .report-detail {
  377. margin-bottom: 30rpx;
  378. }
  379. .detail-section {
  380. margin-bottom: 30rpx;
  381. }
  382. .detail-title {
  383. font-size: 28rpx;
  384. font-weight: bold;
  385. color: #333;
  386. margin-bottom: 15rpx;
  387. }
  388. .detail-row {
  389. display: flex;
  390. justify-content: space-between;
  391. margin-bottom: 10rpx;
  392. }
  393. .detail-label {
  394. font-size: 26rpx;
  395. color: #666;
  396. }
  397. .detail-value {
  398. font-size: 26rpx;
  399. color: #333;
  400. font-weight: bold;
  401. }
  402. .detail-content {
  403. background: #F8F8F8;
  404. padding: 20rpx;
  405. border-radius: 10rpx;
  406. }
  407. .content-text {
  408. font-size: 26rpx;
  409. color: #333;
  410. line-height: 1.6;
  411. }
  412. .modal-actions {
  413. display: flex;
  414. gap: 20rpx;
  415. }
  416. .btn-close {
  417. flex: 1;
  418. height: 80rpx;
  419. background: #F0F0F0;
  420. color: #333;
  421. border-radius: 40rpx;
  422. font-size: 28rpx;
  423. font-weight: bold;
  424. }
  425. </style>