testResult.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <view class="bg">
  3. <view style="overflow: hidden;"></view>
  4. <view class="role_img">
  5. <view class="xdzs">
  6. <view class="xdzs_title">
  7. <image src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/xdzs.png" mode="widthFix">
  8. </image>
  9. </view>
  10. <view class="cardiac_index">
  11. <text> {{ parseInt(scoreNum) }}%</text>
  12. </view>
  13. </view>
  14. <image class="carton" v-if="roleList[role]" :src="roleList[role].img" mode="widthFix"></image>
  15. </view>
  16. <view class="result_box">
  17. <view style="overflow: hidden;"></view>
  18. <image class="paperclip" src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/paperclip.png"
  19. mode="widthFix"></image>
  20. <image class="analysis_title"
  21. src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/analysis_title.png" mode="widthFix">
  22. </image>
  23. <view class="role_medal">
  24. <image v-if="roleList[role]" :src="roleList[role].name" mode="widthFix"></image>
  25. </view>
  26. <!-- <view class="score_bar">
  27. <view class="score_title">得分:</view>
  28. <view class="score_num">{{scoreNum}}</view>
  29. <view class="score_percentage">
  30. <view class="score_wrap">
  31. <image class="process_bar" :style="{'left': percentage}"
  32. src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/process_bar.png"
  33. mode="widthFix"></image>
  34. </view>
  35. <view class="score_text">{{parseInt(scoreNum)}}/{{parseInt(maxScore)}}</view>
  36. </view>
  37. </view> -->
  38. <view class="result_box_r">
  39. <view class="cardiac">
  40. <!-- <view style="text-align: left;">
  41. <image class="cardiac_title"
  42. src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/cardiac_title_img.png"
  43. mode="widthFix"></image>
  44. </view> -->
  45. <!-- <image v-if="role" class="cardiac_index" :src="roleList[role].score" mode="widthFix"></image> -->
  46. </view>
  47. <!-- <view class="sm_title">
  48. <image src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/sm_title.png"
  49. mode="widthFix"></image>
  50. </view> -->
  51. <view class="c_item" v-for="item in (segmentation(improvementSuggestions))">
  52. <view class="list_style_bg"></view>
  53. <text style="flex: 1;">{{item}}</text>
  54. </view>
  55. </view>
  56. <view class="report_desc">
  57. <view class="desc_title">报告阅读说明</view>
  58. <view class="desc_txt" style="color: #FFAEBF;">谢谢您的参与,阅读本报告时,请注意以下内容:</view>
  59. <view style="display: flex;">
  60. <view class="list_mark">·</view>
  61. <view class="desc_txt">本结果仅供参考,不可作为临床诊断的依据;</view>
  62. </view>
  63. <view style="display: flex;">
  64. <view class="list_mark">·</view>
  65. <view class="desc_txt">如对报告有不理解的地方,建议咨询专业人员;</view>
  66. </view>
  67. <view style="display: flex;">
  68. <view class="list_mark">·</view>
  69. <view class="desc_txt">如结果与你自己或他人的感受有出入,可回忆在测试时是否有事情影响到你,或自己回答时是否有所顾虑。</view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import {
  77. getRecordById
  78. } from "@/api/index.js";
  79. import {
  80. photoUrl
  81. } from "@/common/config.js"
  82. const photoUrls = `${photoUrl}api/show?filePath=./webo`
  83. console.log(photoUrl);
  84. export default {
  85. data() {
  86. return {
  87. isChecked: true,
  88. isShake: false,
  89. scaleDetail: {},
  90. questionList: [],
  91. currentQuestion: {},
  92. currentAnswerList: [],
  93. currentIndex: 0,
  94. userAnswerList: [],
  95. resultId: '',
  96. isLoading: false,
  97. isDisbale: false,
  98. roleList: {
  99. '30%': {
  100. name: `${photoUrls}/Charm/result_type/comment30.png`,
  101. img: `${photoUrls}/Charm/result_type/people_img30.png`,
  102. score: `${photoUrls}/Charm/result_type/score30.png`,
  103. '魅不可挡': `${photoUrls}/Charm/result_type/mbkd88.png`,
  104. '魅力撩人': `${photoUrls}/Charm/result_type/mllr88.png`,
  105. '魅力迷人': `${photoUrls}/Charm/result_type/mlmr88.png`,
  106. '魅力无穷': `${photoUrls}/Charm/result_type/mlwq88.png`,
  107. '气质成谜': `${photoUrls}/Charm/result_type/qzcm88.png`,
  108. },
  109. '60%': {
  110. name: `${photoUrls}/Charm/result_type/comment60.png`,
  111. img: `${photoUrls}/Charm/result_type/people_img60.png`,
  112. score: `${photoUrls}/Charm/result_type/score60.png`,
  113. '热情奔放': `${photoUrls}/Charm/result_type/rqbf99.png`,
  114. '热情豪爽': `${photoUrls}/Charm/result_type/rqhs99.png`,
  115. '热情澎湃': `${photoUrls}/Charm/result_type/rqpp99.png`,
  116. '热情如火': `${photoUrls}/Charm/result_type/rqrh99.png`,
  117. '热情洋溢': `${photoUrls}/Charm/result_type/rqyy99.png`,
  118. },
  119. '80%': {
  120. name: `${photoUrls}/Charm/result_type/comment80.png`,
  121. img: `${photoUrls}/Charm/result_type/people_img80.png`,
  122. score: `${photoUrls}/Charm/result_type/score80.png`,
  123. '怦然心动': `${photoUrls}/Charm/result_type/prxd160.png`,
  124. '神魂颠倒': `${photoUrls}/Charm/result_type/shdd160.png`,
  125. '神韵动人': `${photoUrls}/Charm/result_type/sydr160.png`,
  126. '心动不已': `${photoUrls}/Charm/result_type/xdby160.png`,
  127. '心花怒放': `${photoUrls}/Charm/result_type/xhnf160.png`,
  128. },
  129. '100%': {
  130. name: `${photoUrls}/Charm/result_type/comment100.png`,
  131. img: `${photoUrls}/Charm/result_type/people_img100.png`,
  132. score: `${photoUrls}/Charm/result_type/score100.png`,
  133. '瞬间倾心': `${photoUrls}/Charm/result_type/sjqx300.png`,
  134. '一见倾心': `${photoUrls}/Charm/result_type/yjqx300.png`,
  135. '爱情闪现': `${photoUrls}/Charm/result_type/aqsx300.png`,
  136. '一见心动': `${photoUrls}/Charm/result_type/yjxd300.png`,
  137. '一见钟情': `${photoUrls}/Charm/result_type/yjzq300.png`,
  138. }
  139. },
  140. resultId: '',
  141. role: '',
  142. improvementSuggestions: '',
  143. scoreNum: 0,
  144. maxScore: 0,
  145. minScore: 0,
  146. keywords: ''
  147. }
  148. },
  149. onLoad(options) {
  150. if (options && options.resultId) {
  151. this.resultId = options.resultId
  152. this.getScaleTestResults(this.resultId);
  153. }
  154. },
  155. computed: {
  156. percentage() {
  157. return (((this.scoreNum / this.maxScore) * 318) - 318) + 'rpx'
  158. }
  159. },
  160. methods: {
  161. getScaleTestResults(id) {
  162. let _this = this;
  163. _this.$request
  164. .get({
  165. url: `${getRecordById}?id=${id}`,
  166. loadingTip: "加载中...",
  167. data: {},
  168. })
  169. .then(
  170. (res) => {
  171. uni.hideLoading();
  172. console.log('222:', new Date().getTime());
  173. console.log("----测试结果--->", res);
  174. if (res.code == 200) {
  175. _this.testResult = JSON.parse(res.data?.userRecordEntity?.testResult)[0];
  176. _this.role = _this.testResult.newTableContext.result[0].symptom;
  177. _this.improvementSuggestions = _this.testResult.newTableContext.result[0]
  178. .improvementSuggestions;
  179. _this.keywords = _this.trimStart(_this.improvementSuggestions.slice(0, 5));
  180. _this.scoreNum = _this.testResult.tableContext[5].value[0];
  181. _this.maxScore = _this.testResult.newTableContext.result[0].maxScore;
  182. } else if (res.code == 401) {} else {
  183. (res) => {
  184. console.log("世界上绝对绝对绝对绝对绝对的", res);
  185. }
  186. }
  187. })
  188. },
  189. getNameUrl() {
  190. console.log(`${photoUrls}/Charm/result_type/role_name1.png`)
  191. return `${photoUrls}/Charm/result_type/role_name1.png`
  192. },
  193. trimStart(str) {
  194. return str.replace(/^\s+/, '');
  195. },
  196. segmentation(str) {
  197. return str.split('\n');
  198. }
  199. }
  200. }
  201. </script>
  202. <style scoped>
  203. .bg {
  204. width: 100%;
  205. min-height: 1900rpx;
  206. padding-bottom: 100rpx;
  207. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/test_result_bg.png) no-repeat top;
  208. background-size: 100% auto;
  209. }
  210. .role_name {
  211. text-align: center;
  212. margin: 202rpx 0 0 0;
  213. }
  214. .role_name image {
  215. width: 550rpx;
  216. }
  217. .role_img {
  218. display: flex;
  219. justify-content: space-between;
  220. margin-top: 223rpx;
  221. }
  222. .role_img .temp_type {
  223. width: 224rpx;
  224. margin-left: 88rpx;
  225. }
  226. .role_img .carton {
  227. width: 437rpx;
  228. margin-left: -60rpx;
  229. }
  230. .xdzs {
  231. text-align: center;
  232. }
  233. .xdzs_title image {
  234. width: 234rpx;
  235. margin: 150rpx 0 20rpx 30rpx;
  236. }
  237. .result_box {
  238. width: 702rpx;
  239. min-height: 875rpx;
  240. background: linear-gradient(0deg, #EA1750 0%, #FF8189 100%);
  241. border-radius: 26rpx;
  242. margin: 10rpx auto 0;
  243. position: relative;
  244. padding-bottom: 30rpx;
  245. }
  246. .role_medal {
  247. margin-top: 55rpx;
  248. text-align: center;
  249. }
  250. .role_medal image {
  251. width: 550rpx;
  252. }
  253. .result_box_r {
  254. box-sizing: border-box;
  255. width: 674rpx;
  256. min-height: 553rpx;
  257. padding: 26rpx;
  258. margin: 0 auto 0;
  259. background: #FFFFFF url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/result_bg_r.png) no-repeat top;
  260. background-size: 100% auto;
  261. border-radius: 33rpx;
  262. font-family: 'Alibaba PuHuiTi 2.0';
  263. font-weight: normal;
  264. font-size: 32rpx;
  265. color: #555555;
  266. line-height: 60rpx;
  267. letter-spacing: 2rpx;
  268. text-align: justify;
  269. }
  270. .sm_title image {
  271. width: 67rpx;
  272. }
  273. .cardiac {
  274. text-align: center;
  275. }
  276. .cardiac_title {
  277. width: 213rpx;
  278. }
  279. .cardiac_index {
  280. width: 349rpx;
  281. background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Charm/result_type/score.png) no-repeat center;
  282. background-size: cover;
  283. margin-left: 30rpx;
  284. text-align: center;
  285. }
  286. .cardiac_index text {
  287. line-height: 198rpx;
  288. font-family: 'Alibaba PuHuiTi 2.0';
  289. font-weight: bold;
  290. font-size: 48rpx;
  291. color: #F23D64;
  292. text-shadow: 1rpx 1rpx 6rpx rgba(142, 0, 19, 0.5);
  293. -webkit-text-stroke: 8rpx transparent;
  294. text-stroke: 8rpx transparent;
  295. -webkit-background-clip: text;
  296. background-clip: text;
  297. background-color: #ffffff;
  298. margin-right: 40rpx;
  299. }
  300. .c_item {
  301. display: flex;
  302. align-items: flex-start;
  303. text-align: justify;
  304. letter-spacing: 2px;
  305. margin-bottom: 16rpx;
  306. }
  307. .list_style_bg {
  308. width: 16rpx;
  309. height: 16rpx;
  310. background: #fd7884;
  311. background-size: 100% auto;
  312. border-radius: 50%;
  313. margin: 17rpx 10rpx 0 0;
  314. }
  315. .report_desc {
  316. margin: 30rpx 38rpx;
  317. letter-spacing: 1px;
  318. }
  319. .desc_title {
  320. font-family: 'Alibaba PuHuiTi 2.0';
  321. font-weight: normal;
  322. font-size: 28rpx;
  323. color: #FFFFFF;
  324. line-height: 46rpx;
  325. }
  326. .desc_txt {
  327. font-family: 'Alibaba PuHuiTi 2.0';
  328. font-weight: normal;
  329. font-size: 20rpx;
  330. color: #FFFFFF;
  331. line-height: 30rpx;
  332. }
  333. .list_mark {
  334. line-height: 0.7;
  335. font-size: 36rpx;
  336. color: #ffffff;
  337. font-weight: 600;
  338. margin-right: 5rpx;
  339. }
  340. .analysis_title {
  341. width: 362rpx;
  342. position: absolute;
  343. top: -30rpx;
  344. left: 50%;
  345. transform: translateX(-50%);
  346. }
  347. .paperclip {
  348. width: 55rpx;
  349. position: absolute;
  350. top: -40rpx;
  351. left: 38rpx;
  352. }
  353. </style>