testResult.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <template>
  2. <view v-if="role" :class="['bg', `bg${roleList[role].index}`]">
  3. <view class="scale_name">你是否正在逐渐老化?</view>
  4. <view class="test_time">测试时间:{{time}}</view>
  5. <view class="result_box" style="margin-top: 15rpx;">
  6. <view class="pad_box" :style="{'background': roleList[role].boxBg}"></view>
  7. <view class="result_box_r">
  8. <view style="overflow: hidden;"></view>
  9. <view class="score_num" style="margin-top: 34rpx;">得分:{{scoreNum}}</view>
  10. <view class="score_percentage">
  11. <view class="process_bar" v-if="scoreNum > 0" :style="{'width': percentage}">
  12. <view class="score_text">{{parseInt(scoreNum)}}/{{parseInt(maxScore)}}</view>
  13. </view>
  14. </view>
  15. <view class="score_explain">注: 得分越高,老化程度越高</view>
  16. <view class="score_num" style="margin-top: 22rpx;">结论:</view>
  17. <image class="temp_type" v-if="role" :src="roleList[role].name" mode="widthFix"></image>
  18. <image class="carton" v-if="role" :src="roleList[role].img" mode="widthFix">
  19. </image>
  20. <image class="result_text"
  21. src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Senile/result_text_bg.png"
  22. mode="widthFix">
  23. </image>
  24. </view>
  25. </view>
  26. <view class="result_box">
  27. <view class="pad_box" :style="{'background': roleList[role].boxBg}"></view>
  28. <view class="result_box_r">
  29. <image class="title_img" v-if="role" :src="roleList[role].titleImg" mode="widthFix"></image>
  30. <view style="overflow: hidden;"></view>
  31. <view class="r_content"
  32. :style="{'background': roleList[role].conentBg, 'border-color': roleList[role].contentBorder}">
  33. <view class="c_item" v-for="item in (segmentation(improvementSuggestions))">
  34. <text :style="{'color': roleList[role].boxBg, 'font-size': '100rpx'}">·</text>
  35. <text>{{item}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="report_desc">
  40. <view class="desc_title">报告阅读说明</view>
  41. <view class="stext">谢谢您的参与,阅读本报告时,请注意以下内容:</view>
  42. <view style="display: flex;">
  43. <view class="list_mark">·</view>
  44. <view class="desc_txt">本结果仅供参考,不可作为临床诊断的依据;</view>
  45. </view>
  46. <view style="display: flex;">
  47. <view class="list_mark">·</view>
  48. <view class="desc_txt">如对报告有不理解的地方,建议咨询专业人员;</view>
  49. </view>
  50. <view style="display: flex;">
  51. <view class="list_mark">·</view>
  52. <view class="desc_txt">如结果与你自己或他人的感受有出入,可回忆在测试时是否有事情影响到你,或自己回答时是否有所顾虑。</view>
  53. </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}/Senile/role/result_name1.png`,
  84. img: `${photoUrls}/Senile/role/people_img1.png`,
  85. bg: `${photoUrls}/Senile/role/bg1.png`,
  86. index: 1,
  87. boxBg: '#54D49E',
  88. titleImg: `${photoUrls}/Senile/role/title_bg1.png`,
  89. conentBg: '#DDFFF1',
  90. contentBorder: '#54D49E'
  91. },
  92. '轻微老化': {
  93. name: `${photoUrls}/Senile/role/result_name2.png`,
  94. img: `${photoUrls}/Senile/role/people_img2.png`,
  95. bg: `${photoUrls}/Senile/role/bg2.png`,
  96. index: 2,
  97. boxBg: '#368FFF',
  98. titleImg: `${photoUrls}/Senile/role/title_bg2.png`,
  99. conentBg: '#ECFFFF',
  100. contentBorder: '#94EFFF'
  101. },
  102. '中度老化': {
  103. name: `${photoUrls}/Senile/role/result_name3.png`,
  104. img: `${photoUrls}/Senile/role/people_img3.png`,
  105. bg: `${photoUrls}/Senile/role/bg3.png`,
  106. index: 3,
  107. boxBg: '#9B6AFF',
  108. titleImg: `${photoUrls}/Senile/role/title_bg3.png`,
  109. conentBg: '#F3EDFF',
  110. contentBorder: '#9B6AFF'
  111. },
  112. '高度老化': {
  113. name: `${photoUrls}/Senile/role/result_name4.png`,
  114. img: `${photoUrls}/Senile/role/people_img4.png`,
  115. bg: `${photoUrls}/Senile/role/bg4.png`,
  116. index: 4,
  117. boxBg: '#FF7800',
  118. titleImg: `${photoUrls}/Senile/role/title_bg4.png`,
  119. conentBg: '#FFF3E1',
  120. contentBorder: '#F8C983'
  121. },
  122. '严重老化': {
  123. name: `${photoUrls}/Senile/role/result_name5.png`,
  124. img: `${photoUrls}/Senile/role/people_img5.png`,
  125. bg: `${photoUrls}/Senile/role/bg5.png`,
  126. index: 5,
  127. boxBg: '#CE0000',
  128. titleImg: `${photoUrls}/Senile/role/title_bg5.png`,
  129. conentBg: '#FFE1E1',
  130. contentBorder: '#FF6666'
  131. }
  132. },
  133. resultId: '',
  134. role: '',
  135. improvementSuggestions: '',
  136. scoreNum: 0,
  137. maxScore: 0,
  138. minScore: 0,
  139. keywords: '',
  140. time: ''
  141. }
  142. },
  143. onLoad(options) {
  144. if (options && options.resultId) {
  145. this.resultId = options.resultId
  146. this.getScaleTestResults(this.resultId);
  147. }
  148. },
  149. computed: {
  150. percentage() {
  151. return ((this.scoreNum / this.maxScore) * 259) + 'rpx'
  152. }
  153. },
  154. methods: {
  155. getScaleTestResults(id) {
  156. let _this = this;
  157. _this.$request
  158. .get({
  159. url: `${getRecordById}?id=${id}`,
  160. loadingTip: "加载中...",
  161. data: {},
  162. })
  163. .then(
  164. (res) => {
  165. console.log('222:', new Date().getTime());
  166. console.log("----测试结果--->", res);
  167. if (res.code == 200) {
  168. this.testResult = JSON.parse(res.data?.userRecordEntity?.testResult)[0];
  169. this.role = _this.testResult.newTableContext.result[0].symptom;
  170. this.improvementSuggestions = this.testResult.newTableContext.result[0]
  171. .improvementSuggestions;
  172. this.keywords = this.trimStart(this.improvementSuggestions.slice(0, 5));
  173. this.scoreNum = this.testResult.newTableContext.result[0].score;
  174. this.maxScore = this.testResult.newTableContext.result[0].maxScore;
  175. let testDateTime = res.data.userRecordEntity.testDate;
  176. let yearMonthDay = testDateTime
  177. .replace("年", "/")
  178. .replace("月", "/")
  179. .replace("日", " ")
  180. .replace("时", ":")
  181. .replace("分", ":")
  182. .replace("秒", "");
  183. this.time = yearMonthDay;
  184. } else if (res.code == 401) {} else {
  185. (res) => {
  186. console.log("世界上绝对绝对绝对绝对绝对的", res);
  187. }
  188. }
  189. })
  190. },
  191. trimStart(str) {
  192. return str.replace(/^\s+/, '');
  193. },
  194. segmentation(str) {
  195. return str.split('\n');
  196. }
  197. }
  198. }
  199. </script>
  200. <style scoped>
  201. .bg {
  202. width: 100%;
  203. min-height: 1624rpx;
  204. background: linear-gradient(0deg, #FB4643 0%, #FF8B59 100%);
  205. overflow: hidden;
  206. position: relative;
  207. padding-bottom: 100rpx;
  208. }
  209. .bg1 {
  210. background: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Senile/role/bg1.png') no-repeat top;
  211. background-size: 100% 100%;
  212. }
  213. .bg2 {
  214. background: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Senile/role/bg2.png')no-repeat top;
  215. background-size: 100% 100%;
  216. }
  217. .bg3 {
  218. background: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Senile/role/bg3.png')no-repeat top;
  219. background-size: 100% 100%;
  220. }
  221. .bg4 {
  222. background: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Senile/role/bg4.png')no-repeat top;
  223. background-size: 100% 100%;
  224. }
  225. .bg5 {
  226. background: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Senile/role/bg5.png')no-repeat top;
  227. background-size: 100% 100%;
  228. }
  229. .scale_name {
  230. font-family: 'Alibaba PuHuiTi 2.0';
  231. font-weight: bold;
  232. font-size: 42rpx;
  233. color: #333333;
  234. margin: 28rpx 0 0 39rpx;
  235. }
  236. .test_time {
  237. font-family: 'Alibaba PuHuiTi 2.0';
  238. font-weight: normal;
  239. font-size: 28rpx;
  240. color: #999999;
  241. margin-left: 39rpx;
  242. }
  243. .score_num {
  244. font-family: 'Alibaba PuHuiTi 2.0';
  245. font-weight: bold;
  246. font-size: 32rpx;
  247. color: #CC4100;
  248. line-height: 31rpx;
  249. margin: 14rpx 0 0 22rpx;
  250. position: relative;
  251. z-index: 3;
  252. }
  253. .score_percentage {
  254. display: flex;
  255. align-items: center;
  256. justify-content: space-between;
  257. width: 271rpx;
  258. height: 28rpx;
  259. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Senile/score_percentage_bg.png) no-repeat center center;
  260. background-size: 100% 100%;
  261. border-radius: 14rpx;
  262. margin: 14rpx 0 8rpx 20rpx;
  263. position: relative;
  264. z-index: 3;
  265. overflow-x: hidden;
  266. }
  267. .process_bar {
  268. width: 0rpx;
  269. height: 18rpx;
  270. background: linear-gradient(89deg, #FFCC01 0%, #FE704C 100%);
  271. box-shadow: 0rpx 0rpx 4rpx 2rpx #FFC600;
  272. border-radius: 10rpx;
  273. border: 1px solid #D84500;
  274. border: 1rpx solid #D84500;
  275. position: absolute;
  276. top: 3rpx;
  277. left: 4rpx;
  278. }
  279. .score_text {
  280. font-family: 'Alibaba PuHuiTi 2.0';
  281. font-weight: normal;
  282. font-size: 20rpx;
  283. color: #FEFEFE;
  284. position: absolute;
  285. top: 0rpx;
  286. right: 5rpx;
  287. z-index: 99;
  288. line-height: 16rpx;
  289. }
  290. .min_max {
  291. width: 300rpx;
  292. display: flex;
  293. justify-content: space-between;
  294. font-family: 'Alibaba PuHuiTi 2.0';
  295. font-weight: normal;
  296. font-size: 20rpx;
  297. color: #999999;
  298. margin-left: 30rpx;
  299. }
  300. .role_name {
  301. text-align: center;
  302. margin: 202rpx 0 0 0;
  303. }
  304. .role_name image {
  305. width: 550rpx;
  306. }
  307. .temp_type {
  308. width: 504rpx;
  309. position: absolute;
  310. top: 186rpx;
  311. left: 16rpx;
  312. }
  313. .carton {
  314. width: 258rpx;
  315. position: absolute;
  316. top: 134rpx;
  317. right: 38rpx;
  318. z-index: 1;
  319. }
  320. .result_text {
  321. width: 260rpx;
  322. position: absolute;
  323. top: -57rpx;
  324. right: 10rpx;
  325. z-index: 3;
  326. }
  327. .result_box {
  328. width: 702rpx;
  329. min-height: 361rpx;
  330. background: #ffffff;
  331. box-shadow: 0rpx 3rpx 24rpx 0rpx rgba(126, 77, 0, 0.13);
  332. border-radius: 26rpx;
  333. margin: 20rpx auto 0;
  334. position: relative;
  335. }
  336. .pad_box {
  337. width: 100%;
  338. height: 200rpx;
  339. border-radius: 26rpx;
  340. overflow: hidden;
  341. }
  342. .title_img {
  343. width: 302rpx;
  344. position: relative;
  345. z-index: 3;
  346. margin: 31rpx 0 0 28rpx;
  347. }
  348. .result_box_r {
  349. box-sizing: border-box;
  350. width: 702rpx;
  351. min-height: 352rpx;
  352. margin: -188rpx auto 0;
  353. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Senile/result_bg_r.png) no-repeat top;
  354. background-size: 100% auto;
  355. border-radius: 33rpx;
  356. font-family: 'Alibaba PuHuiTi 2.0';
  357. font-weight: normal;
  358. font-size: 32rpx;
  359. color: #555555;
  360. line-height: 50rpx;
  361. position: relative;
  362. z-index: 2;
  363. }
  364. .r_content {
  365. width: 600rpx;
  366. min-height: 307rpx;
  367. background: #FFE1E1;
  368. border-radius: 20rpx;
  369. border: 1px solid #FF6666;
  370. margin: 20rpx auto 0;
  371. padding: 30rpx;
  372. font-family: 'Alibaba PuHuiTi 2.0';
  373. font-weight: normal;
  374. font-size: 32rpx;
  375. color: #333333;
  376. line-height: 50rpx;
  377. }
  378. .report_desc {
  379. padding: 30rpx 38rpx;
  380. letter-spacing: 1px;
  381. }
  382. .desc_title {
  383. font-family: 'Alibaba PuHuiTi 2.0';
  384. font-weight: normal;
  385. font-size: 28rpx;
  386. color: #333333;
  387. line-height: 46rpx;
  388. }
  389. .stext {
  390. font-family: 'Alibaba PuHuiTi 2.0';
  391. font-weight: normal;
  392. font-size: 20rpx;
  393. color: #999999;
  394. line-height: 30rpx;
  395. }
  396. .c_item {
  397. display: flex;
  398. align-items: flex-start;
  399. text-align: justify;
  400. letter-spacing: 2px;
  401. margin-bottom: 16rpx;
  402. }
  403. .desc_txt {
  404. font-family: 'Alibaba PuHuiTi 2.0';
  405. font-weight: normal;
  406. font-size: 20rpx;
  407. color: #333333;
  408. line-height: 30rpx;
  409. }
  410. .list_mark {
  411. line-height: 0.7;
  412. font-size: 36rpx;
  413. color: #333333;
  414. font-weight: 600;
  415. margin-right: 5rpx;
  416. }
  417. .analysis_title {
  418. width: 362rpx;
  419. position: absolute;
  420. top: -30rpx;
  421. left: 50%;
  422. transform: translateX(-50%);
  423. }
  424. .paperclip {
  425. width: 55rpx;
  426. position: absolute;
  427. top: -40rpx;
  428. left: 38rpx;
  429. }
  430. .score_explain {
  431. font-family: 'Alibaba PuHuiTi 2.0';
  432. font-weight: normal;
  433. font-size: 24rpx;
  434. color: #999999;
  435. line-height: 31rpx;
  436. margin-left: 32rpx;
  437. }
  438. </style>