emotion-report.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <view class="container">
  3. <!-- 报告数据 -->
  4. <view class="report-card" v-if="report">
  5. <view class="report-header">
  6. <text class="report-title">EMI 心理测评报告</text>
  7. <text class="report-date">测评日期: {{ report.assessmentDate || '-' }}</text>
  8. </view>
  9. <!-- 综合EQ分 -->
  10. <view class="overall-wrap">
  11. <text class="overall-label">综合EQ分</text>
  12. <text class="overall-value">{{ report.overallScore || 0 }}</text>
  13. <text :class="['overall-level', 'level-' + getScoreLevel(report.overallScore || 0)]">{{ getScoreLevelText(report.overallScore || 0) }}</text>
  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. <view class="dimension-score-row">
  24. <text class="dimension-score">{{ report[dim.key] || 0 }}</text>
  25. <text :class="['dimension-level', 'level-' + getScoreLevel(report[dim.key] || 0)]">{{ getScoreLevelText(report[dim.key] || 0) }}</text>
  26. </view>
  27. </view>
  28. <view class="dimension-bar">
  29. <view class="dimension-bar-fill" :style="{ width: (report[dim.key] || 0) + '%', background: dim.color }"></view>
  30. </view>
  31. <text class="dimension-desc">{{ dim.desc }}</text>
  32. </view>
  33. </view>
  34. <!-- 分析报告 -->
  35. <view class="section-card" v-if="report.analysisReport">
  36. <view class="section-header-row">
  37. <text class="section-icon">&#x1F4DD;</text>
  38. <text class="section-title">分析报告</text>
  39. </view>
  40. <text class="section-content">{{ report.analysisReport }}</text>
  41. </view>
  42. <!-- 成长建议 -->
  43. <view class="section-card suggestion-card" v-if="report.growthSuggestions">
  44. <view class="section-header-row">
  45. <text class="section-icon">&#x1F331;</text>
  46. <text class="section-title">成长建议</text>
  47. </view>
  48. <text class="section-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="goBack">
  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">完成 EMI 心理测评后,可在此查看详细的心理分析报告</text>
  69. <view class="empty-btn" @click="goAssessment">预约测评</view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import { getEmiReport } from '../../utils/api.js'
  75. export default {
  76. components: { },
  77. data: function() {
  78. return {
  79. memberId: null,
  80. report: null,
  81. loading: true,
  82. dimensions: [
  83. { key: 'emotionScore', label: '情绪商数', icon: '\u2764\uFE0F', color: '#FF6B35', desc: '识别、理解和管理自身及他人情绪的能力' },
  84. { key: 'resilienceScore', label: '心理韧性', icon: '\u{1F4AA}', color: '#F97316', desc: '面对压力和挫折时的适应与恢复能力' },
  85. { key: 'stressCopingScore', label: '压力应对', icon: '\u{1F64F}', color: '#FB923C', desc: '有效应对生活压力和心理负担的能力' },
  86. { key: 'selfAwarenessScore', label: '自我认知', icon: '\u{1F9EC}', color: '#FBBF24', 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. getEmiReport(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. getScoreLevel: function(score) {
  117. if (score >= 85) return 'excellent'
  118. if (score >= 70) return 'good'
  119. if (score >= 55) return 'average'
  120. return 'low'
  121. },
  122. getScoreLevelText: function(score) {
  123. if (score >= 85) return '优秀'
  124. if (score >= 70) return '良好'
  125. if (score >= 55) return '一般'
  126. return '需提升'
  127. },
  128. goAssessment: function() {
  129. uni.navigateTo({ url: '/pages/assessment/apply' })
  130. },
  131. goBack: function() {
  132. uni.navigateBack({ delta: 1 })
  133. }
  134. }
  135. }
  136. </script>
  137. <style scoped>
  138. .container {
  139. min-height: 100vh;
  140. background: #f5f7fa;
  141. padding-bottom: 120rpx;
  142. }
  143. /* ===== 报告卡 ===== */
  144. .report-card {
  145. margin: 20rpx 30rpx;
  146. background: #fff;
  147. border-radius: 24rpx;
  148. padding: 40rpx;
  149. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  150. }
  151. .report-header {
  152. display: flex;
  153. flex-direction: row;
  154. justify-content: space-between;
  155. align-items: center;
  156. margin-bottom: 30rpx;
  157. }
  158. .report-title {
  159. font-size: 36rpx;
  160. font-weight: bold;
  161. color: #333;
  162. }
  163. .report-date {
  164. font-size: 24rpx;
  165. color: #999;
  166. }
  167. /* ===== 综合EQ ===== */
  168. .overall-wrap {
  169. display: flex;
  170. flex-direction: column;
  171. align-items: center;
  172. padding: 40rpx 0;
  173. background: linear-gradient(135deg, #FF6B35, #FFD700);
  174. border-radius: 20rpx;
  175. margin-bottom: 40rpx;
  176. color: #fff;
  177. }
  178. .overall-label {
  179. font-size: 28rpx;
  180. opacity: 0.9;
  181. margin-bottom: 8rpx;
  182. }
  183. .overall-value {
  184. font-size: 80rpx;
  185. font-weight: bold;
  186. margin-bottom: 8rpx;
  187. }
  188. .overall-level {
  189. font-size: 26rpx;
  190. padding: 4rpx 24rpx;
  191. border-radius: 20rpx;
  192. background: rgba(255,255,255,0.3);
  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-row {
  223. display: flex;
  224. flex-direction: row;
  225. align-items: center;
  226. }
  227. .dimension-score {
  228. font-size: 32rpx;
  229. font-weight: bold;
  230. color: #FF6B35;
  231. margin-right: 12rpx;
  232. }
  233. .dimension-level {
  234. font-size: 22rpx;
  235. padding: 2rpx 14rpx;
  236. border-radius: 12rpx;
  237. }
  238. .level-excellent { color: #10B981; background: #ECFDF5; }
  239. .level-good { color: #3B82F6; background: #EFF6FF; }
  240. .level-average { color: #F97316; background: #FFF7ED; }
  241. .level-low { color: #EF4444; background: #FEF2F2; }
  242. .dimension-bar {
  243. height: 18rpx;
  244. background: #f0f0f0;
  245. border-radius: 9rpx;
  246. overflow: hidden;
  247. margin-bottom: 8rpx;
  248. }
  249. .dimension-bar-fill {
  250. height: 100%;
  251. border-radius: 9rpx;
  252. transition: width 0.5s;
  253. }
  254. .dimension-desc {
  255. font-size: 22rpx;
  256. color: #999;
  257. line-height: 1.4;
  258. }
  259. /* ===== 分析/建议卡 ===== */
  260. .section-card {
  261. margin-top: 30rpx;
  262. padding: 28rpx;
  263. background: #f9f9f9;
  264. border-radius: 16rpx;
  265. }
  266. .suggestion-card {
  267. background: #FFFBEB;
  268. }
  269. .section-header-row {
  270. display: flex;
  271. flex-direction: row;
  272. align-items: center;
  273. margin-bottom: 16rpx;
  274. }
  275. .section-icon {
  276. font-size: 30rpx;
  277. margin-right: 10rpx;
  278. }
  279. .section-title {
  280. font-size: 30rpx;
  281. font-weight: bold;
  282. color: #333;
  283. }
  284. .section-content {
  285. font-size: 26rpx;
  286. color: #666;
  287. line-height: 1.7;
  288. display: block;
  289. }
  290. /* ===== 底部操作 ===== */
  291. .action-row {
  292. display: flex;
  293. flex-direction: row;
  294. justify-content: space-between;
  295. margin-top: 40rpx;
  296. }
  297. .action-btn {
  298. flex: 1;
  299. display: flex;
  300. align-items: center;
  301. justify-content: center;
  302. padding: 20rpx 0;
  303. border-radius: 40rpx;
  304. }
  305. .action-btn.primary {
  306. background: linear-gradient(135deg, #FF6B35, #FFD700);
  307. margin-left: 16rpx;
  308. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  309. }
  310. .action-btn.secondary {
  311. background: #fff;
  312. border: 2rpx solid #ddd;
  313. margin-right: 16rpx;
  314. }
  315. .action-btn-text {
  316. font-size: 28rpx;
  317. font-weight: 500;
  318. color: #fff;
  319. }
  320. .action-btn.secondary .action-btn-text {
  321. color: #666;
  322. }
  323. /* ===== 加载中 ===== */
  324. .loading-state {
  325. display: flex;
  326. align-items: center;
  327. justify-content: center;
  328. padding: 120rpx 0;
  329. }
  330. .loading-text {
  331. font-size: 28rpx;
  332. color: #999;
  333. }
  334. /* ===== 空状态 ===== */
  335. .empty-state {
  336. display: flex;
  337. flex-direction: column;
  338. align-items: center;
  339. padding: 120rpx 40rpx 80rpx;
  340. }
  341. .empty-icon {
  342. font-size: 100rpx;
  343. margin-bottom: 20rpx;
  344. }
  345. .empty-title {
  346. font-size: 32rpx;
  347. color: #333;
  348. font-weight: bold;
  349. margin-bottom: 16rpx;
  350. }
  351. .empty-desc {
  352. font-size: 26rpx;
  353. color: #999;
  354. text-align: center;
  355. line-height: 1.6;
  356. margin-bottom: 40rpx;
  357. }
  358. .empty-btn {
  359. background: linear-gradient(135deg, #FF6B35, #FFD700);
  360. color: #fff;
  361. font-size: 28rpx;
  362. font-weight: bold;
  363. padding: 16rpx 64rpx;
  364. border-radius: 40rpx;
  365. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  366. }
  367. </style>