emotion-report.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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="section rec-section" v-if="recommendations.length > 0 && !recLoading">
  62. <view class="section-header">
  63. <text class="section-title">🎯 为你推荐</text>
  64. <text class="section-sub">基于你的心理画像匹配</text>
  65. </view>
  66. <view class="rec-list">
  67. <view class="rec-card" v-for="(item, idx) in recommendations" :key="idx" @click="goRecDetail(item)">
  68. <view class="rec-card-left">
  69. <text class="rec-card-icon">{{ item.type === 'article' ? '📖' : (item.type === 'activity' ? '🎯' : '🛒') }}</text>
  70. <view class="rec-card-info">
  71. <text class="rec-card-title">{{ item.title }}</text>
  72. <text class="rec-card-desc">{{ item.summary || item.reason }}</text>
  73. </view>
  74. </view>
  75. <text class="rec-card-score">⭐ {{ Math.round(item.recommendScore) }}</text>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 加载中 -->
  80. <view class="loading-state" v-if="loading">
  81. <text class="loading-text">加载中...</text>
  82. </view>
  83. <!-- 无数据 -->
  84. <view class="empty-state" v-if="!report && !loading">
  85. <text class="empty-icon">&#x1F9E0;</text>
  86. <text class="empty-title">暂无心理测评数据</text>
  87. <text class="empty-desc">完成 EMI 心理测评后,可在此查看详细的心理分析报告</text>
  88. <view class="empty-btn" @click="goAssessment">预约测评</view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import { getEmiReport } from '../../utils/api.js'
  94. export default {
  95. components: { },
  96. data: function() {
  97. return {
  98. memberId: null,
  99. report: null,
  100. loading: true,
  101. recommendations: [],
  102. recLoading: false,
  103. dimensions: [
  104. { key: 'emotionStability', label: '情绪稳定性', icon: '\u{1F9E0}', color: '#FF6B35', desc: '情绪调节的综合能力(含自卑-自信、抑郁-愉悦、焦虑-安详、无力感-掌控感四个隐性指标)' }
  105. ]
  106. }
  107. },
  108. onLoad: function(options) {
  109. if (options && options.memberId) {
  110. this.memberId = options.memberId
  111. } else {
  112. this.memberId = uni.getStorageSync('currentChildId') || null
  113. }
  114. this.loadReport()
  115. },
  116. methods: {
  117. loadReport: function() {
  118. var self = this
  119. var memberId = self.memberId
  120. if (!memberId) {
  121. self.loading = false
  122. return
  123. }
  124. self.loading = true
  125. getEmiReport(memberId).then(function(res) {
  126. if (res.code === 200 && res.data) {
  127. self.report = res.data
  128. }
  129. }).catch(function() {}).finally(function() {
  130. self.loading = false
  131. })
  132. },
  133. getScoreLevel: function(score) {
  134. if (score >= 85) return 'excellent'
  135. if (score >= 70) return 'good'
  136. if (score >= 55) return 'average'
  137. return 'low'
  138. },
  139. getScoreLevelText: function(score) {
  140. if (score >= 85) return '优秀'
  141. if (score >= 70) return '良好'
  142. if (score >= 55) return '一般'
  143. return '需提升'
  144. },
  145. goAssessment: function() {
  146. uni.navigateTo({ url: '/pages/assessment/apply' })
  147. },
  148. goBack: function() {
  149. uni.navigateBack({ delta: 1 })
  150. }
  151. }
  152. }
  153. </script>
  154. <style scoped>
  155. .container {
  156. min-height: 100vh;
  157. background: #f5f7fa;
  158. padding-bottom: 120rpx;
  159. }
  160. /* ===== 报告卡 ===== */
  161. .report-card {
  162. margin: 20rpx 30rpx;
  163. background: #fff;
  164. border-radius: 24rpx;
  165. padding: 40rpx;
  166. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  167. }
  168. .report-header {
  169. display: flex;
  170. flex-direction: row;
  171. justify-content: space-between;
  172. align-items: center;
  173. margin-bottom: 30rpx;
  174. }
  175. .report-title {
  176. font-size: 36rpx;
  177. font-weight: bold;
  178. color: #333;
  179. }
  180. .report-date {
  181. font-size: 24rpx;
  182. color: #999;
  183. }
  184. /* ===== 综合EQ ===== */
  185. .overall-wrap {
  186. display: flex;
  187. flex-direction: column;
  188. align-items: center;
  189. padding: 40rpx 0;
  190. background: linear-gradient(135deg, #FF6B35, #FFD700);
  191. border-radius: 20rpx;
  192. margin-bottom: 40rpx;
  193. color: #fff;
  194. }
  195. .overall-label {
  196. font-size: 28rpx;
  197. opacity: 0.9;
  198. margin-bottom: 8rpx;
  199. }
  200. .overall-value {
  201. font-size: 80rpx;
  202. font-weight: bold;
  203. margin-bottom: 8rpx;
  204. }
  205. .overall-level {
  206. font-size: 26rpx;
  207. padding: 4rpx 24rpx;
  208. border-radius: 20rpx;
  209. background: rgba(255,255,255,0.3);
  210. }
  211. /* ===== 四维条形图 ===== */
  212. .dimension-list {
  213. margin-bottom: 30rpx;
  214. }
  215. .dimension-item {
  216. margin-bottom: 28rpx;
  217. }
  218. .dimension-header {
  219. display: flex;
  220. flex-direction: row;
  221. justify-content: space-between;
  222. align-items: center;
  223. margin-bottom: 10rpx;
  224. }
  225. .dimension-label-row {
  226. display: flex;
  227. flex-direction: row;
  228. align-items: center;
  229. }
  230. .dimension-icon {
  231. font-size: 28rpx;
  232. margin-right: 10rpx;
  233. }
  234. .dimension-name {
  235. font-size: 28rpx;
  236. color: #333;
  237. font-weight: 500;
  238. }
  239. .dimension-score-row {
  240. display: flex;
  241. flex-direction: row;
  242. align-items: center;
  243. }
  244. .dimension-score {
  245. font-size: 32rpx;
  246. font-weight: bold;
  247. color: #FF6B35;
  248. margin-right: 12rpx;
  249. }
  250. .dimension-level {
  251. font-size: 22rpx;
  252. padding: 2rpx 14rpx;
  253. border-radius: 12rpx;
  254. }
  255. .level-excellent { color: #10B981; background: #ECFDF5; }
  256. .level-good { color: #3B82F6; background: #EFF6FF; }
  257. .level-average { color: #F97316; background: #FFF7ED; }
  258. .level-low { color: #EF4444; background: #FEF2F2; }
  259. .dimension-bar {
  260. height: 18rpx;
  261. background: #f0f0f0;
  262. border-radius: 9rpx;
  263. overflow: hidden;
  264. margin-bottom: 8rpx;
  265. }
  266. .dimension-bar-fill {
  267. height: 100%;
  268. border-radius: 9rpx;
  269. transition: width 0.5s;
  270. }
  271. .dimension-desc {
  272. font-size: 22rpx;
  273. color: #999;
  274. line-height: 1.4;
  275. }
  276. /* ===== 分析/建议卡 ===== */
  277. .section-card {
  278. margin-top: 30rpx;
  279. padding: 28rpx;
  280. background: #f9f9f9;
  281. border-radius: 16rpx;
  282. }
  283. .suggestion-card {
  284. background: #FFFBEB;
  285. }
  286. .section-header-row {
  287. display: flex;
  288. flex-direction: row;
  289. align-items: center;
  290. margin-bottom: 16rpx;
  291. }
  292. .section-icon {
  293. font-size: 30rpx;
  294. margin-right: 10rpx;
  295. }
  296. .section-title {
  297. font-size: 30rpx;
  298. font-weight: bold;
  299. color: #333;
  300. }
  301. .section-content {
  302. font-size: 26rpx;
  303. color: #666;
  304. line-height: 1.7;
  305. display: block;
  306. }
  307. /* ===== 底部操作 ===== */
  308. .action-row {
  309. display: flex;
  310. flex-direction: row;
  311. justify-content: space-between;
  312. margin-top: 40rpx;
  313. }
  314. .action-btn {
  315. flex: 1;
  316. display: flex;
  317. align-items: center;
  318. justify-content: center;
  319. padding: 20rpx 0;
  320. border-radius: 40rpx;
  321. }
  322. .action-btn.primary {
  323. background: linear-gradient(135deg, #FF6B35, #FFD700);
  324. margin-left: 16rpx;
  325. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  326. }
  327. .action-btn.secondary {
  328. background: #fff;
  329. border: 2rpx solid #ddd;
  330. margin-right: 16rpx;
  331. }
  332. .action-btn-text {
  333. font-size: 28rpx;
  334. font-weight: 500;
  335. color: #fff;
  336. }
  337. .action-btn.secondary .action-btn-text {
  338. color: #666;
  339. }
  340. /* ===== 推荐卡片 ===== */
  341. .rec-section { margin: 20rpx 30rpx; }
  342. .rec-list { display: flex; flex-direction: column; gap: 16rpx; }
  343. .rec-card {
  344. background: rgba(255,255,255,0.95);
  345. border-radius: 20rpx;
  346. padding: 24rpx 28rpx;
  347. display: flex;
  348. justify-content: space-between;
  349. align-items: center;
  350. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  351. }
  352. .rec-card-left { display: flex; align-items: center; flex: 1; min-width: 0; }
  353. .rec-card-icon { font-size: 44rpx; margin-right: 16rpx; flex-shrink: 0; }
  354. .rec-card-info { flex: 1; min-width: 0; }
  355. .rec-card-title { font-size: 28rpx; font-weight: 600; color: #1a1a2e; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  356. .rec-card-desc { font-size: 22rpx; color: #94a3b8; margin-top: 4rpx; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  357. .rec-card-score { font-size: 28rpx; font-weight: 700; color: #FF6B35; flex-shrink: 0; margin-left: 16rpx; }
  358. /* ===== 加载中 ===== */
  359. .loading-state {
  360. display: flex;
  361. align-items: center;
  362. justify-content: center;
  363. padding: 120rpx 0;
  364. }
  365. .loading-text {
  366. font-size: 28rpx;
  367. color: #999;
  368. }
  369. /* ===== 空状态 ===== */
  370. .empty-state {
  371. display: flex;
  372. flex-direction: column;
  373. align-items: center;
  374. padding: 120rpx 40rpx 80rpx;
  375. }
  376. .empty-icon {
  377. font-size: 100rpx;
  378. margin-bottom: 20rpx;
  379. }
  380. .empty-title {
  381. font-size: 32rpx;
  382. color: #333;
  383. font-weight: bold;
  384. margin-bottom: 16rpx;
  385. }
  386. .empty-desc {
  387. font-size: 26rpx;
  388. color: #999;
  389. text-align: center;
  390. line-height: 1.6;
  391. margin-bottom: 40rpx;
  392. }
  393. .empty-btn {
  394. background: linear-gradient(135deg, #FF6B35, #FFD700);
  395. color: #fff;
  396. font-size: 28rpx;
  397. font-weight: bold;
  398. padding: 16rpx 64rpx;
  399. border-radius: 40rpx;
  400. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  401. }
  402. </style>