testResult.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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. <image class="temp_type" v-if="role" :src="roleList[role].name" mode="widthFix">
  6. </image>
  7. <view class="result_box">
  8. <view style="overflow: hidden;"></view>
  9. <!-- <view class="sm_title">说明:</view> -->
  10. <view class="r_content">
  11. <view class="c_item" v-for="item in (segmentation(improvementSuggestions))">
  12. <view class="list_style_bg"></view>
  13. <text style="flex: 1;">{{item}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="report_desc">
  18. <view class="desc_title">报告阅读说明</view>
  19. <view class="stext">谢谢您的参与,阅读本报告时,请注意以下内容:</view>
  20. <view style="display: flex;">
  21. <view class="list_mark">·</view>
  22. <view class="desc_txt">本结果仅供参考,不可作为临床诊断的依据;</view>
  23. </view>
  24. <view style="display: flex;">
  25. <view class="list_mark">·</view>
  26. <view class="desc_txt">如对报告有不理解的地方,建议咨询专业人员;</view>
  27. </view>
  28. <view style="display: flex;">
  29. <view class="list_mark">·</view>
  30. <view class="desc_txt">如结果与你自己或他人的感受有出入,可回忆在测试时是否有事情影响到你,或自己回答时是否有所顾虑。</view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getRecordById
  38. } from "@/api/index.js";
  39. import {
  40. photoUrl
  41. } from "@/common/config.js"
  42. const photoUrls = `${photoUrl}api/show?filePath=./webo`
  43. console.log(photoUrl);
  44. export default {
  45. data() {
  46. return {
  47. isChecked: true,
  48. isShake: false,
  49. scaleDetail: {},
  50. questionList: [],
  51. currentQuestion: {},
  52. currentAnswerList: [],
  53. currentIndex: 0,
  54. userAnswerList: [],
  55. resultId: '',
  56. isLoading: false,
  57. isDisbale: false,
  58. roleList: {
  59. '安全感指数:10%': {
  60. name: `${photoUrls}/Marriage/score1.png`,
  61. index: 1
  62. },
  63. '安全感指数:40%': {
  64. name: `${photoUrls}/Marriage/score2.png`,
  65. index: 2
  66. },
  67. '安全感指数:60%': {
  68. name: `${photoUrls}/Marriage/score3.png`,
  69. index: 3
  70. },
  71. '安全感指数:95%': {
  72. name: `${photoUrls}/Marriage/score4.png`,
  73. index: 4
  74. }
  75. },
  76. resultId: '',
  77. role: '',
  78. improvementSuggestions: '',
  79. scoreNum: 0,
  80. maxScore: 0,
  81. minScore: 0,
  82. keywords: '',
  83. time: ''
  84. }
  85. },
  86. onLoad(options) {
  87. if (options && options.resultId) {
  88. this.resultId = options.resultId
  89. this.getScaleTestResults(this.resultId);
  90. }
  91. },
  92. computed: {
  93. percentage() {
  94. return (((this.scoreNum / this.maxScore) * 318) - 318) + 'rpx'
  95. }
  96. },
  97. methods: {
  98. getScaleTestResults(id) {
  99. let _this = this;
  100. _this.$request
  101. .get({
  102. url: `${getRecordById}?id=${id}`,
  103. loadingTip: "加载中...",
  104. data: {},
  105. })
  106. .then(
  107. (res) => {
  108. console.log('222:', new Date().getTime());
  109. console.log("----测试结果--->", res);
  110. if (res.code == 200) {
  111. _this.testResult = JSON.parse(res.data?.userRecordEntity?.testResult)[0];
  112. _this.role = _this.testResult.newTableContext.result[0].symptom;
  113. _this.improvementSuggestions = _this.testResult.newTableContext.result[0]
  114. .improvementSuggestions;
  115. _this.keywords = _this.trimStart(_this.improvementSuggestions.slice(0, 5));
  116. _this.scoreNum = _this.testResult.newTableContext.result[0].score;
  117. _this.maxScore = _this.testResult.newTableContext.result[0].maxScore;
  118. let testDateTime = res.data.userRecordEntity.testDate;
  119. let yearMonthDay = testDateTime
  120. .replace("年", "/")
  121. .replace("月", "/")
  122. .replace("日", " ")
  123. .replace("时", ":")
  124. .replace("分", ":")
  125. .replace("秒", "");
  126. _this.time = yearMonthDay;
  127. } else if (res.code == 401) {} else {
  128. (res) => {
  129. console.log("世界上绝对绝对绝对绝对绝对的", res);
  130. }
  131. }
  132. })
  133. },
  134. trimStart(str) {
  135. return str.replace(/^\s+/, '');
  136. },
  137. segmentation(str) {
  138. return str.split('\n');
  139. }
  140. }
  141. }
  142. </script>
  143. <style scoped>
  144. .bg {
  145. width: 100%;
  146. min-height: 1624rpx;
  147. background: linear-gradient(0deg, #FB4643 0%, #FF8B59 100%);
  148. overflow: hidden;
  149. position: relative;
  150. }
  151. .bg1 {
  152. background: #DEA2FD url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Marriage/bg1.png') no-repeat top;
  153. background-size: 100% auto;
  154. }
  155. .bg2 {
  156. background: #FFB0E6 url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Marriage/bg2.png')no-repeat top;
  157. background-size: 100% auto;
  158. }
  159. .bg3 {
  160. background: #FF709C url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Marriage/bg3.png')no-repeat top;
  161. background-size: 100% auto;
  162. }
  163. .bg4 {
  164. background: #EE4A51 url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Marriage/bg4.png')no-repeat top;
  165. background-size: 100% auto;
  166. }
  167. .bg5 {
  168. background: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Marriage/bg5.png')no-repeat top;
  169. background-size: 100% auto;
  170. }
  171. .scale_name {
  172. font-family: 'Alibaba PuHuiTi 2.0';
  173. font-weight: bold;
  174. font-size: 40rpx;
  175. color: #333333;
  176. margin: 32rpx 0 0 29rpx;
  177. }
  178. .test_time {
  179. font-family: 'Alibaba PuHuiTi 2.0';
  180. font-weight: normal;
  181. font-size: 28rpx;
  182. color: #333333;
  183. margin-left: 29rpx;
  184. }
  185. .role_name {
  186. text-align: center;
  187. margin: 202rpx 0 0 0;
  188. }
  189. .role_name image {
  190. width: 550rpx;
  191. }
  192. .temp_type {
  193. width: 444rpx;
  194. position: absolute;
  195. top: 140rpx;
  196. left: 25rpx;
  197. }
  198. .carton {
  199. width: 244rpx;
  200. position: absolute;
  201. top: 56rpx;
  202. right: 23rpx;
  203. z-index: 1;
  204. }
  205. .result_box {
  206. width: 702rpx;
  207. min-height: 804rpx;
  208. padding-bottom: 30rpx;
  209. background: #DFD8FF url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Marriage/result_box_bg.png) no-repeat top;
  210. background-size: 100% auto;
  211. box-shadow: 0rpx 3rpx 24rpx 0rpx rgba(126, 77, 0, 0.13);
  212. border-radius: 26rpx;
  213. margin: 323rpx auto 0;
  214. position: relative;
  215. }
  216. .title_img {
  217. width: 302rpx;
  218. position: relative;
  219. z-index: 3;
  220. margin: 31rpx 0 0 28rpx;
  221. }
  222. .sm_title {
  223. font-family: 'Alibaba PuHuiTi 2.0';
  224. font-weight: normal;
  225. font-size: 36rpx;
  226. color: #4A73F1;
  227. line-height: 31rpx;
  228. margin: 108rpx 0 0 26rpx;
  229. }
  230. .r_content {
  231. box-sizing: border-box;
  232. width: 674rpx;
  233. min-height: 620rpx;
  234. background: #FFF9FA;
  235. border-radius: 18rpx;
  236. margin: 121rpx auto 0;
  237. padding: 30rpx 16rpx;
  238. font-family: 'Alibaba PuHuiTi 2.0';
  239. font-weight: normal;
  240. font-size: 32rpx;
  241. color: #333333;
  242. line-height: 50rpx;
  243. letter-spacing: 2rpx;
  244. }
  245. .c_item {
  246. display: flex;
  247. align-items: flex-start;
  248. text-align: justify;
  249. letter-spacing: 2px;
  250. margin-bottom: 16rpx;
  251. }
  252. .list_style_bg {
  253. width: 29rpx;
  254. height: 28rpx;
  255. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Marriage/list_style_bg.png) no-repeat center;
  256. background-size: 100% 100%;
  257. margin: 5rpx 8rpx 0 0;
  258. }
  259. .report_desc {
  260. padding: 30rpx 38rpx;
  261. letter-spacing: 1px;
  262. }
  263. .desc_title {
  264. font-family: 'Alibaba PuHuiTi 2.0';
  265. font-weight: normal;
  266. font-size: 28rpx;
  267. color: #ffffff;
  268. line-height: 46rpx;
  269. }
  270. .stext {
  271. font-family: 'Alibaba PuHuiTi 2.0';
  272. font-weight: normal;
  273. font-size: 20rpx;
  274. color: #ffffff;
  275. line-height: 30rpx;
  276. }
  277. .desc_txt {
  278. font-family: 'Alibaba PuHuiTi 2.0';
  279. font-weight: normal;
  280. font-size: 20rpx;
  281. color: #ffffff;
  282. line-height: 30rpx;
  283. }
  284. .list_mark {
  285. line-height: 0.7;
  286. font-size: 36rpx;
  287. color: #ffffff;
  288. font-weight: 600;
  289. margin-right: 5rpx;
  290. }
  291. .analysis_title {
  292. width: 362rpx;
  293. position: absolute;
  294. top: -30rpx;
  295. left: 50%;
  296. transform: translateX(-50%);
  297. }
  298. .paperclip {
  299. width: 55rpx;
  300. position: absolute;
  301. top: -40rpx;
  302. left: 38rpx;
  303. }
  304. </style>