testResult.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <view class="bg">
  3. <view class="scale_name">职业心理年龄测试</view>
  4. <view class="test_time">测试时间:{{time}}</view>
  5. <image class="temp_type" src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/result_title.png"
  6. mode="widthFix">
  7. </image>
  8. <view class="score_box">
  9. <view style="overflow: hidden;"></view>
  10. <view class="score_num" style="margin-top: 90rpx;">得分:{{scoreNum}}</view>
  11. <view class="score_percentage">
  12. <view class="score_wrap">
  13. <view class="process_bar" :style="{'left': percentage}">
  14. <image src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/process_bar.png"
  15. mode="widthFix"></image>
  16. <view class="score_text">{{parseInt(scoreNum)}}/{{parseInt(maxScore)}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="score_explain">注:得分越高,职业心理年龄越成熟</view>
  21. <!-- <view class="min_max"><text>0</text><text>60</text></view> -->
  22. <view class="score_num">结论:</view>
  23. <image v-if="role" class="role_name" :src="roleList[role].name" mode="widthFix"></image>
  24. <image v-if="role" class="role_img" :src="roleList[role].img" mode="widthFix"></image>
  25. </view>
  26. <view class="result_box">
  27. <view style="overflow: hidden;"></view>
  28. <view class="result_box_top"></view>
  29. <view class="result_box_bottom">
  30. <view style="overflow: hidden;"></view>
  31. <!-- <view class="sm_title">说明:</view> -->
  32. <view class="r_content">
  33. <view class="c_item" v-for="item in (segmentation(improvementSuggestions))">
  34. <view class="list_style_bg"></view>
  35. <text style="flex: 1;">{{item}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="report_desc">
  41. <view class="desc_title">报告阅读说明</view>
  42. <view class="stext">谢谢您的参与,阅读本报告时,请注意以下内容:</view>
  43. <view style="display: flex;">
  44. <view class="list_mark">·</view>
  45. <view class="desc_txt">本结果仅供参考,不可作为临床诊断的依据;</view>
  46. </view>
  47. <view style="display: flex;">
  48. <view class="list_mark">·</view>
  49. <view class="desc_txt">如对报告有不理解的地方,建议咨询专业人员;</view>
  50. </view>
  51. <view style="display: flex;">
  52. <view class="list_mark">·</view>
  53. <view class="desc_txt">如结果与你自己或他人的感受有出入,可回忆在测试时是否有事情影响到你,或自己回答时是否有所顾虑。</view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. getRecordById
  61. } from "@/api/index.js";
  62. import {
  63. photoUrl
  64. } from "@/common/config.js"
  65. const photoUrls = `${photoUrl}api/show?filePath=./webo`
  66. console.log(photoUrl);
  67. export default {
  68. data() {
  69. return {
  70. isChecked: true,
  71. isShake: false,
  72. scaleDetail: {},
  73. questionList: [],
  74. currentQuestion: {},
  75. currentAnswerList: [],
  76. currentIndex: 0,
  77. userAnswerList: [],
  78. resultId: '',
  79. isLoading: false,
  80. isDisbale: false,
  81. roleList: {
  82. '纯真儿童': {
  83. name: `${photoUrls}/Career/role/role1.png`,
  84. img: `${photoUrls}/Career/role/role_img1.png`,
  85. index: 1,
  86. 'roleWidth': {
  87. 'width': '375rpx'
  88. }
  89. },
  90. '理想青年': {
  91. name: `${photoUrls}/Career/role/role2.png`,
  92. img: `${photoUrls}/Career/role/role_img2.png`,
  93. index: 2,
  94. 'roleWidth': {
  95. 'width': '375rpx'
  96. }
  97. },
  98. '成熟中年': {
  99. name: `${photoUrls}/Career/role/role3.png`,
  100. img: `${photoUrls}/Career/role/role_img3.png`,
  101. index: 3,
  102. 'roleWidth': {
  103. 'width': '375rpx'
  104. }
  105. }
  106. },
  107. resultId: '',
  108. role: '',
  109. improvementSuggestions: '',
  110. scoreNum: 0,
  111. maxScore: 0,
  112. minScore: 0,
  113. keywords: '',
  114. time: ''
  115. }
  116. },
  117. onLoad(options) {
  118. if (options && options.resultId) {
  119. this.resultId = options.resultId
  120. this.getScaleTestResults(this.resultId);
  121. }
  122. },
  123. computed: {
  124. percentage() {
  125. return (((this.scoreNum / this.maxScore) * 312) - 318) + 'rpx'
  126. }
  127. },
  128. methods: {
  129. getScaleTestResults(id) {
  130. let _this = this;
  131. _this.$request
  132. .get({
  133. url: `${getRecordById}?id=${id}`,
  134. loadingTip: "加载中...",
  135. data: {},
  136. })
  137. .then(
  138. (res) => {
  139. console.log('222:', new Date().getTime());
  140. console.log("----测试结果--->", res);
  141. if (res.code == 200) {
  142. _this.testResult = JSON.parse(res.data?.userRecordEntity?.testResult)[0];
  143. _this.role = _this.testResult.newTableContext.result[0].symptom;
  144. _this.improvementSuggestions = _this.testResult.newTableContext.result[0]
  145. .improvementSuggestions;
  146. _this.keywords = _this.trimStart(_this.improvementSuggestions.slice(0, 5));
  147. _this.scoreNum = _this.testResult.newTableContext.result[0].score;
  148. _this.maxScore = _this.testResult.newTableContext.result[0].maxScore;
  149. let testDateTime = res.data.userRecordEntity.testDate;
  150. let yearMonthDay = testDateTime
  151. .replace("年", "/")
  152. .replace("月", "/")
  153. .replace("日", " ")
  154. .replace("时", ":")
  155. .replace("分", ":")
  156. .replace("秒", "");
  157. _this.time = yearMonthDay;
  158. } else if (res.code == 401) {} else {
  159. (res) => {
  160. console.log("世界上绝对绝对绝对绝对绝对的", res);
  161. }
  162. }
  163. })
  164. },
  165. trimStart(str) {
  166. return str.replace(/^\s+/, '');
  167. },
  168. segmentation(str) {
  169. return str.split('\n');
  170. }
  171. }
  172. }
  173. </script>
  174. <style scoped>
  175. .bg {
  176. width: 100%;
  177. min-height: 1624rpx;
  178. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/test_result_bg.png) no-repeat top;
  179. background-size: 100% 100%;
  180. overflow: hidden;
  181. position: relative;
  182. }
  183. .scale_name {
  184. font-family: 'Alibaba PuHuiTi 2.0';
  185. font-weight: bold;
  186. font-size: 40rpx;
  187. color: #ffffff;
  188. margin: 32rpx 0 0 29rpx;
  189. }
  190. .test_time {
  191. font-family: 'Alibaba PuHuiTi 2.0';
  192. font-weight: normal;
  193. font-size: 28rpx;
  194. color: #ffffff;
  195. margin-left: 29rpx;
  196. }
  197. .temp_type {
  198. width: 205rpx;
  199. position: absolute;
  200. top: 29rpx;
  201. right: 38rpx;
  202. }
  203. .score_box {
  204. width: 712rpx;
  205. height: 425rpx;
  206. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/score_box_bg.png) no-repeat center;
  207. background-size: cover;
  208. border-radius: 28rpx;
  209. margin: 37rpx auto 0;
  210. position: relative;
  211. }
  212. .score_num {
  213. font-family: 'Alibaba PuHuiTi 2.0';
  214. font-weight: normal;
  215. font-size: 32rpx;
  216. color: #333333;
  217. line-height: 31rpx;
  218. margin: 14rpx 0 0 22rpx;
  219. }
  220. .score_percentage {
  221. display: flex;
  222. align-items: center;
  223. justify-content: space-between;
  224. width: 319rpx;
  225. height: 36rpx;
  226. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/score_percentage_bg.png) no-repeat center;
  227. background-size: cover;
  228. margin: 14rpx 0 8rpx 20rpx;
  229. }
  230. .score_wrap {
  231. width: 348rpx;
  232. height: 48rpx;
  233. margin: 0 0 0 12rpx;
  234. position: relative;
  235. overflow: hidden;
  236. border-radius: 25rpx;
  237. }
  238. .process {
  239. overflow: hidden;
  240. }
  241. .process_bar {
  242. width: 318rpx;
  243. position: absolute;
  244. left: -100rpx;
  245. top: 8rpx;
  246. }
  247. .process_bar image {
  248. width: 100%;
  249. }
  250. .score_text {
  251. width: 68rpx;
  252. height: 42rpx;
  253. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/socre_text_bg.png) no-repeat;
  254. background-size: cover;
  255. position: absolute;
  256. top: -6rpx;
  257. right: 6rpx;
  258. z-index: 2;
  259. font-family: 'Alibaba PuHuiTi 2.0';
  260. font-weight: bold;
  261. font-size: 20rpx;
  262. color: #EE5C00;
  263. line-height: 42rpx;
  264. text-align: center;
  265. }
  266. .min_max {
  267. width: 300rpx;
  268. display: flex;
  269. justify-content: space-between;
  270. font-family: 'Alibaba PuHuiTi 2.0';
  271. font-weight: normal;
  272. font-size: 20rpx;
  273. color: #999999;
  274. margin-left: 30rpx;
  275. }
  276. .role_name {
  277. width: 409rpx;
  278. margin: 10rpx 0 0 21rpx;
  279. position: relative;
  280. z-index: 2;
  281. }
  282. .role_img {
  283. width: 347rpx;
  284. position: absolute;
  285. top: -20rpx;
  286. right: -16rpx;
  287. }
  288. .result_box {
  289. width: 712rpx;
  290. min-height: 804rpx;
  291. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/result_box_bg.png) no-repeat;
  292. background-size: 100% 100%;
  293. box-shadow: 0rpx 3rpx 24rpx 0rpx rgba(126, 77, 0, 0.13);
  294. border-radius: 26rpx;
  295. margin: 13rpx auto 0;
  296. position: relative;
  297. z-index: 2;
  298. }
  299. .result_box_top {
  300. width: 712rpx;
  301. height: 109rpx;
  302. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/result_box_top.png);
  303. background-size: cover;
  304. margin: 0 auto;
  305. }
  306. .result_box_bottom {
  307. width: 700rpx;
  308. min-height: 109rpx;
  309. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/result_box_top.png);
  310. background-size: cover;
  311. background: linear-gradient(0deg, #99CDFF 0%, #ECF6FF 100%);
  312. border-radius: 0 0 28rpx 28rpx;
  313. margin: 0 auto;
  314. overflow: hidden;
  315. }
  316. .title_img {
  317. width: 302rpx;
  318. position: relative;
  319. z-index: 3;
  320. margin: 31rpx 0 0 28rpx;
  321. }
  322. .sm_title {
  323. font-family: 'Alibaba PuHuiTi 2.0';
  324. font-weight: normal;
  325. font-size: 36rpx;
  326. color: #333333;
  327. line-height: 31rpx;
  328. margin: 10rpx 0 0 26rpx;
  329. }
  330. .r_content {
  331. box-sizing: border-box;
  332. width: 94%;
  333. min-height: 307rpx;
  334. margin: 26rpx auto 40rpx;
  335. padding: 30rpx 26rpx;
  336. border-radius: 18rpx;
  337. background: #ffffff;
  338. font-family: 'Alibaba PuHuiTi 2.0';
  339. font-weight: normal;
  340. font-size: 32rpx;
  341. color: #333333;
  342. line-height: 50rpx;
  343. letter-spacing: 2rpx;
  344. }
  345. .c_item {
  346. display: flex;
  347. align-items: flex-start;
  348. text-align: justify;
  349. letter-spacing: 2px;
  350. margin-bottom: 16rpx;
  351. }
  352. .list_style_bg {
  353. width: 36rpx;
  354. height: 36rpx;
  355. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Career/list_style_bg.png) no-repeat center;
  356. background-size: 100% auto;
  357. margin: 10rpx 8rpx 0 0;
  358. }
  359. .report_desc {
  360. padding: 30rpx 38rpx;
  361. letter-spacing: 1px;
  362. }
  363. .desc_title {
  364. font-family: 'Alibaba PuHuiTi 2.0';
  365. font-weight: normal;
  366. font-size: 28rpx;
  367. color: #ffffff;
  368. line-height: 46rpx;
  369. }
  370. .stext {
  371. font-family: 'Alibaba PuHuiTi 2.0';
  372. font-weight: normal;
  373. font-size: 20rpx;
  374. color: #ffffff;
  375. line-height: 30rpx;
  376. }
  377. .desc_txt {
  378. font-family: 'Alibaba PuHuiTi 2.0';
  379. font-weight: normal;
  380. font-size: 20rpx;
  381. color: #ffffff;
  382. line-height: 30rpx;
  383. }
  384. .list_mark {
  385. line-height: 0.7;
  386. font-size: 36rpx;
  387. color: #ffffff;
  388. font-weight: 600;
  389. margin-right: 5rpx;
  390. }
  391. .analysis_title {
  392. width: 362rpx;
  393. position: absolute;
  394. top: -30rpx;
  395. left: 50%;
  396. transform: translateX(-50%);
  397. }
  398. .paperclip {
  399. width: 55rpx;
  400. position: absolute;
  401. top: -40rpx;
  402. left: 38rpx;
  403. }
  404. .score_explain {
  405. font-family: 'Alibaba PuHuiTi 2.0';
  406. font-weight: normal;
  407. font-size: 24rpx;
  408. color: #999999;
  409. line-height: 31rpx;
  410. margin-left: 36rpx;
  411. }
  412. </style>