testResult.vue 9.7 KB

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