results.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  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. import fontScaleMixin from '@/mixins/font-scale.js'
  165. export default {
  166. mixins: [fontScaleMixin],
  167. data() {
  168. return {
  169. currentTab: 'my',
  170. myReports: [],
  171. childReports: [],
  172. currentReport: null,
  173. showReportModal: false
  174. }
  175. },
  176. onLoad() {
  177. this.loadData()
  178. },
  179. methods: {
  180. async loadData() {
  181. try {
  182. // 并行获取数据
  183. const [myRes, childRes] = await Promise.all([
  184. getMyAssessmentResults(),
  185. getChildAssessmentResults()
  186. ])
  187. if (myRes.code === 200) {
  188. this.myReports = myRes.data || []
  189. }
  190. if (childRes.code === 200) {
  191. this.childReports = childRes.data || []
  192. }
  193. } catch (e) {
  194. console.error('加载数据失败', e)
  195. }
  196. },
  197. switchTab(tab) {
  198. this.currentTab = tab
  199. },
  200. viewReportDetail(report) {
  201. this.currentReport = report
  202. this.showReportModal = true
  203. },
  204. formatDate(dateStr) {
  205. if (!dateStr) return ''
  206. const date = parseDate(dateStr)
  207. if (!date) return ''
  208. return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
  209. },
  210. goToAppointments() {
  211. uni.navigateTo({ url: '/pages/parent/appointments' })
  212. }
  213. }
  214. }
  215. </script>
  216. <style scoped lang="scss">
  217. .container {
  218. padding: $uni-space-page;
  219. background: $facade-fill-page;
  220. min-height: 100vh;
  221. }
  222. .header {
  223. text-align: center;
  224. padding: 60rpx 0 40rpx;
  225. }
  226. .title {
  227. font-size: calc(48rpx * var(--font-scale, 1));
  228. font-weight: bold;
  229. color: $facade-text-strong;
  230. display: block;
  231. margin-bottom: 20rpx;
  232. }
  233. .subtitle {
  234. font-size: calc(28rpx * var(--font-scale, 1));
  235. color: $facade-text-body;
  236. }
  237. .tabs {
  238. display: flex;
  239. background: $app-surface;
  240. border-radius: 24rpx;
  241. padding: 10rpx;
  242. margin-bottom: $uni-space-lg;
  243. }
  244. .tab-item {
  245. flex: 1;
  246. text-align: center;
  247. padding: 20rpx;
  248. border-radius: 8rpx;
  249. font-size: calc(28rpx * var(--font-scale, 1));
  250. color: $facade-text-body;
  251. }
  252. .tab-item.active {
  253. background: $accent-indigo;
  254. color: $app-surface;
  255. }
  256. .section {
  257. background: $app-surface;
  258. border-radius: 24rpx;
  259. padding: $uni-space-lg;
  260. margin-bottom: $uni-space-lg;
  261. }
  262. .section-title {
  263. font-size: calc(32rpx * var(--font-scale, 1));
  264. font-weight: bold;
  265. color: $facade-text-strong;
  266. margin-bottom: 20rpx;
  267. }
  268. .report-list {
  269. display: flex;
  270. flex-direction: column;
  271. gap: 20rpx;
  272. }
  273. .report-item {
  274. background: $facade-fill-page;
  275. border-radius: 8rpx;
  276. padding: 20rpx;
  277. }
  278. .report-header {
  279. display: flex;
  280. justify-content: space-between;
  281. align-items: center;
  282. margin-bottom: 15rpx;
  283. }
  284. .report-child {
  285. font-size: calc(30rpx * var(--font-scale, 1));
  286. font-weight: bold;
  287. color: $facade-text-strong;
  288. }
  289. .report-date {
  290. font-size: calc(24rpx * var(--font-scale, 1));
  291. color: $facade-text-muted;
  292. }
  293. .report-guide {
  294. font-size: calc(24rpx * var(--font-scale, 1));
  295. color: $accent-indigo;
  296. }
  297. .report-scores {
  298. display: flex;
  299. gap: 20rpx;
  300. margin-bottom: 15rpx;
  301. }
  302. .score-item {
  303. background: $mat-green-tint;
  304. padding: 10rpx 15rpx;
  305. border-radius: 8rpx;
  306. }
  307. .score-label {
  308. font-size: calc(24rpx * var(--font-scale, 1));
  309. color: $facade-text-body;
  310. display: block;
  311. margin-bottom: 5rpx;
  312. }
  313. .score-value {
  314. font-size: calc(28rpx * var(--font-scale, 1));
  315. font-weight: bold;
  316. color: $facade-text-strong;
  317. }
  318. .report-preview {
  319. font-size: calc(26rpx * var(--font-scale, 1));
  320. color: $facade-text-muted;
  321. line-height: 1.5;
  322. }
  323. .empty-state {
  324. text-align: center;
  325. padding: 60rpx 0;
  326. }
  327. .empty-icon {
  328. font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
  329. display: block;
  330. margin-bottom: 20rpx;
  331. }
  332. .empty-text {
  333. font-size: calc(28rpx * var(--font-scale, 1));
  334. color: $facade-text-muted;
  335. display: block;
  336. margin-bottom: 10rpx;
  337. }
  338. .empty-hint {
  339. font-size: calc(24rpx * var(--font-scale, 1));
  340. color: $facade-text-ghost;
  341. }
  342. .report-modal {
  343. position: fixed;
  344. top: 0;
  345. left: 0;
  346. right: 0;
  347. bottom: 0;
  348. background: rgba(0, 0, 0, 0.5);
  349. display: flex;
  350. align-items: center;
  351. justify-content: center;
  352. z-index: 999;
  353. }
  354. .modal-content {
  355. background: $app-surface;
  356. border-radius: 24rpx;
  357. padding: 40rpx;
  358. width: 90%;
  359. max-height: 80vh;
  360. overflow-y: auto;
  361. }
  362. .modal-header {
  363. display: flex;
  364. justify-content: space-between;
  365. align-items: center;
  366. margin-bottom: $uni-space-lg;
  367. }
  368. .modal-title {
  369. font-size: calc(32rpx * var(--font-scale, 1));
  370. font-weight: bold;
  371. color: $facade-text-strong;
  372. }
  373. .modal-close {
  374. font-size: calc(40rpx * var(--font-scale, 1));
  375. color: $facade-text-muted;
  376. padding: 10rpx;
  377. }
  378. .report-detail {
  379. margin-bottom: $uni-space-lg;
  380. }
  381. .detail-section {
  382. margin-bottom: $uni-space-lg;
  383. }
  384. .detail-title {
  385. font-size: calc(28rpx * var(--font-scale, 1));
  386. font-weight: bold;
  387. color: $facade-text-strong;
  388. margin-bottom: 15rpx;
  389. }
  390. .detail-row {
  391. display: flex;
  392. justify-content: space-between;
  393. margin-bottom: 10rpx;
  394. }
  395. .detail-label {
  396. font-size: calc(26rpx * var(--font-scale, 1));
  397. color: $facade-text-body;
  398. }
  399. .detail-value {
  400. font-size: calc(26rpx * var(--font-scale, 1));
  401. color: $facade-text-strong;
  402. font-weight: bold;
  403. }
  404. .detail-content {
  405. background: $facade-fill-page;
  406. padding: 20rpx;
  407. border-radius: 8rpx;
  408. }
  409. .content-text {
  410. font-size: calc(26rpx * var(--font-scale, 1));
  411. color: $facade-text-strong;
  412. line-height: 1.6;
  413. }
  414. .modal-actions {
  415. display: flex;
  416. gap: 20rpx;
  417. }
  418. .btn-close {
  419. flex: 1;
  420. height: 80rpx;
  421. background: $facade-fill;
  422. color: $facade-text-strong;
  423. border-radius: 24rpx;
  424. font-size: calc(28rpx * var(--font-scale, 1));
  425. font-weight: bold;
  426. }
  427. </style>