emotion-report.vue 9.7 KB

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