Report.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. <script setup lang="ts">
  2. //引入echarts
  3. import * as echarts from 'echarts'
  4. import CpmdHeader from '@/components/CpmdHeader.vue';
  5. import CpmdFooter from '@/components/CpmdFooter.vue'
  6. import { onMounted, onUnmounted, reactive, ref } from 'vue'
  7. import { userInfoStore } from '@/stores'
  8. const userInfo = userInfoStore()
  9. import { useRoute, useRouter } from 'vue-router'
  10. import { queryReportApi } from '@/api/plan';
  11. import { ElMessage } from 'element-plus';
  12. import { getUnread } from '@/utils/test';
  13. //雷达图
  14. const echarts_ld = ref<any>()
  15. //设置
  16. const route = useRoute()
  17. //此处应该是唯一的报告ID
  18. const planId = ref<string>('')
  19. const planName = ref<string>('')
  20. //定义一个参数判断测试报告需要跳转到哪
  21. const goFlag = ref('0')
  22. //获取到报告的总数据
  23. const reportData = ref<any>([])
  24. const echarts_des_list = ref<string[]>(['', '', '', '', '', ''])
  25. const echarts_data_list = ref<number[]>([10, 20, 30, 40, 0, 0])
  26. const echarts_name_list = ref<any>([
  27. // { name: '阳光指数', max: 100, color: '#000000' },
  28. // { name: '情绪稳定指数', max: 100, color: '#000000' },
  29. // { name: '社交能力', max: 100, color: '#000000' },
  30. // { name: '自律能力', max: 100, color: '#000000' },
  31. // { name: '爱情观', max: 100, color: '#000000' },
  32. // { name: '人生观', max: 100, color: '#000000' }
  33. ])
  34. const option = reactive({
  35. title: {
  36. // text: 'Basic Radar Chart'
  37. },
  38. legend: {
  39. // data: ['Allocated Budget', 'Actual Spending']
  40. },
  41. radar: {
  42. center: ['50%', "60%"],
  43. shape: 'square', //设置雷达图形状,值有circle、square,默认为方形
  44. splitNumber: 3, // 雷达图圈数设置
  45. radius: 90,
  46. // shape: 'circle',
  47. indicator: echarts_name_list.value,
  48. name: { //修改indicator文字的颜色
  49. textStyle: {
  50. color: "#999999"
  51. }
  52. },
  53. // 设置雷达图中间射线的颜色
  54. // axisLine: {
  55. // lineStyle: {
  56. // color: '#FFBA92',
  57. // },
  58. // },
  59. // splitArea: { //设置图表颜色,show的值为true
  60. // show: true,
  61. // areaStyle: {
  62. // // color:"#c1ddf8", //一般设置方式
  63. // //设置渐变背景色 new echarts.graphic.LinearGradient(a,b,c,d,arr)
  64. // //a ,b,c,d值可为0,1 a:1表示arr中的颜色右到左;c:1 arr中的颜色左到右
  65. // //b:1表示arr中的颜色下到上;d:1表示arr中的颜色上到下
  66. // color: new echarts.graphic.LinearGradient(0, 0, 0, 0, [
  67. // { offset: 1, color: '#F7E1DE' }, // 0% 处的颜色
  68. // { offset: 0, color: '#FF1E00' }// 100% 处的颜色
  69. // ], false)
  70. // }
  71. // },
  72. // splitArea: {
  73. // areaStyle: {
  74. // color: {
  75. // type: 'radial', // linear 线性渐变 radial径向渐变
  76. // x: 0.4, // 0.5为正中心,如果小于渐变中心靠左
  77. // y: 0.5, // 0.5为正中心,如果小于渐变中心靠上
  78. // r: 1,
  79. // colorStops: [{
  80. // offset: 0, color: '#f16e6e' // 0% 处的颜色rgba(247, 215, 211, 1)
  81. // }, {
  82. // offset: 1, color: 'rgba(247, 225, 222, 1)' // 100% 处的颜色rgba(247, 225, 222, 1)
  83. // }],
  84. // }
  85. // }
  86. // },
  87. //网格颜色设置
  88. // splitLine: {
  89. // show: true,
  90. // lineStyle: {
  91. // width: 1,
  92. // color: '#FFBA92',
  93. // },
  94. // },
  95. },
  96. // name: {
  97. // //修改indicator文字的颜色
  98. // textStyle: {
  99. // color: "#000000",
  100. // },
  101. // },
  102. series: [
  103. {
  104. name: 'Budget vs spending',
  105. type: 'radar',
  106. symbolSize: 6,
  107. data: [
  108. {
  109. value: echarts_data_list.value,
  110. itemStyle: { //该数值区域样式设置
  111. normal: {
  112. color: 'rgba(77, 106, 213, 1)', //背景颜色,还需设置areaStyle //修改线条颜色
  113. lineStyle: {
  114. color: 'rgba(77, 106, 213, 1)', //边框颜色rgba(77, 106, 213, 1)rgba(77, 106, 213, 1)
  115. },
  116. },
  117. },
  118. // name: 'Actual Spending'
  119. areaStyle: {
  120. //阴影区域背景
  121. // color: 'rgba(255, 228, 52, 0.6)'
  122. color: 'rgba(77, 106, 213, 0.6)'
  123. }
  124. }
  125. ]
  126. }
  127. ]
  128. })
  129. //持久化设置 菜单状态
  130. //刚进入页面就将高度设置为页面需要的
  131. onMounted(async () => {
  132. const params = route.params
  133. //当等于0时则跳转到测试计划页面
  134. //当等于1时则跳转到上一页
  135. goFlag.value = params.flag as string
  136. //获取用户编号
  137. planId.value = params.planId as string
  138. //获取用户编号
  139. planName.value = params.name as string
  140. let pa = {
  141. planId: planId.value,
  142. flag: goFlag.value
  143. }
  144. await queryReport(pa)
  145. //调用方法
  146. //进行量表信息查询
  147. //进到界面开始轮询
  148. await getUnread()
  149. })
  150. const queryReport = async (pa: any) => {
  151. let res: any = await queryReportApi(pa)
  152. //得到返回的数据
  153. if (res.code == 200) {
  154. reportData.value = res.data
  155. // let a =[res.data[0].]
  156. let a = []
  157. let des = []
  158. let name = []
  159. for (let i = 0; i < res.data.length; i++) {
  160. if (res.data[i].dimensionName != '总分') {
  161. a.push(parseInt(res.data[i].dimensionScore))
  162. des.push(res.data[i].dimensionAnalysis)
  163. let obj = { name: res.data[i].dimensionName, max: 100, color: '#000000' }
  164. name.push(obj)
  165. }
  166. }
  167. // const echarts_name_list = ref<any>([
  168. // { name: '阳光指数', max: 100, color: '#000000' },
  169. // { name: '情绪稳定指数', max: 100, color: '#000000' },
  170. // { name: '社交能力', max: 100, color: '#000000' },
  171. // { name: '自律能力', max: 100, color: '#000000' },
  172. // { name: '爱情观', max: 100, color: '#000000' },
  173. // { name: '人生观', max: 100, color: '#000000' }
  174. // ])
  175. echarts_name_list.value = name
  176. echarts_des_list.value = des
  177. echarts_data_list.value = a
  178. const myChart = echarts.init(echarts_ld.value)
  179. option.series[0].data[0].value = a
  180. option.radar.indicator = echarts_name_list.value
  181. myChart.setOption(option);
  182. } else {
  183. ElMessage({
  184. message: res.msg,
  185. type: 'error'
  186. })
  187. }
  188. }
  189. //界面销毁函数
  190. const router = useRouter()
  191. const backFun = () => {
  192. router.go(-1)
  193. // if (goFlag.value == '1') {
  194. // router.go(-1)
  195. // }
  196. // if (goFlag.value == '0') {
  197. // router.push({ name: 'plan' })
  198. // }
  199. }
  200. //轮旋切换页面的方法
  201. //退出页面销毁 方法
  202. onUnmounted(() => {
  203. })
  204. </script>
  205. <template>
  206. <div class="home_header_out">
  207. <div class=" home_header_inner">
  208. <CpmdHeader />
  209. <!-- <div class="report_top">
  210. <div class="report_jt">
  211. <span>你真棒!测评已完成</span>
  212. <span>下面是结果解析:</span>
  213. </div>
  214. <img class="xlts_img" src="../assets/report/report_top.png" />
  215. </div> -->
  216. </div>
  217. <div class="leave_message">
  218. <!-- <img class="img" src="../assets/zs/community.png" alt=""> -->
  219. <div class="font_blue"> 测试结果 </div>
  220. <img width="80px" style="position: absolute;left: 100px;bottom: 0;z-index: 11;"
  221. src="../assets/scale/guo.png" alt="">
  222. </div>
  223. <div class="kply">
  224. <div class="kply_inner">
  225. <div>
  226. <div>
  227. <div class="report_result_top">
  228. <div style="font-size: 20px;font-weight: 700;margin-bottom: 4px;"> {{ planName }}-测评结果</div>
  229. <div class="report_totol_score">
  230. <div class="totol_result_des" v-if="reportData.length > 0">
  231. 结论:{{ reportData[0].dimensionAnalysis }}
  232. </div>
  233. </div>
  234. <div class="report_echarts_out">
  235. <div style="display: flex;flex-direction: column;justify-content: center;"
  236. :style="{ height: (!(goFlag == 'SHAPE_RANDOM' || goFlag == 'ETB01' || goFlag == 'FDOT' || goFlag == 'EMOTION_STROOP')) ? '300px' : '100px' }">
  237. <div ref="echarts_ld"
  238. style="width:300px;display: flex; height: 300px; background:#F6F6F6;margin-right: 10px;"
  239. v-show="!(goFlag == 'SHAPE_RANDOM' || goFlag == 'ETB01' || goFlag == 'FDOT' || goFlag == 'EMOTION_STROOP')">
  240. </div>
  241. </div>
  242. <div
  243. style="display: flex;flex-direction: column;align-items: center;flex: 1; box-sizing: border-box;padding: 10px; justify-content: center;background:#F6F6F6;">
  244. <div class="progress_out" v-for="item, index in echarts_name_list">
  245. <span class="progress_out_name" style="width:150px">
  246. {{ item.name }}
  247. </span>
  248. <el-progress :percentage="echarts_data_list[index]" style="width:100%"
  249. :stroke-width="18" :show-text='false'
  250. color="linear-gradient(to right,#798EDE ,#1F2761)" />
  251. <span class="progress_out_score">{{ echarts_data_list[index] }}<span
  252. style="color:#000000;font-size: 12px;opacity: 0.4;">/100</span></span>
  253. </div>
  254. </div>
  255. </div>
  256. </div>
  257. <div v-show="!(goFlag == 'SHAPE_RANDOM' || goFlag == 'ETB01' || goFlag == 'FDOT' || goFlag == 'EMOTION_STROOP')"
  258. v-for="item, index in echarts_name_list" style="padding-top:20px">
  259. <div class="report_des_out">
  260. <div class="des_zhishu">{{ item.name }}</div>
  261. <div class="score" style="display: flex;align-items: center;margin-bottom: 10px;">
  262. <!-- <img style="width: 20px;margin-right:20px" src="../assets/report/score.png" /> -->
  263. <span style="font-weight: 700;color: #222222;margin-left: 10px;">分数:</span>
  264. <span style="color: #222222;"> {{ echarts_data_list[index] }}</span>
  265. <span style="color:#999999;letter-spacing: 0px;">(满分100.00)
  266. </span>
  267. </div>
  268. <div
  269. style=" background-color: #F6F6F6;box-sizing: border-box;padding:10px;border-radius: 5px;">
  270. <div class="score"
  271. style="font-weight: 700;color: #222222;display: flex; align-items: center;">
  272. <!-- <img style="width:20px;margin-right:20px" src="../assets/report/fenxi.png" /> -->
  273. <div style="color: #818996;font-weight: 400;text-align: left;">分析报告</div>
  274. </div>
  275. <div class="des">{{ echarts_des_list[index] }}</div>
  276. </div>
  277. </div>
  278. </div>
  279. <div class="start_button_out">
  280. <div @click="backFun" class="start_button_self">返回</div>
  281. </div>
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. </div>
  287. <div class="home_footer_out">
  288. <CpmdFooter />
  289. </div>
  290. </template>
  291. <style lang="scss" scoped>
  292. .home_footer_out {
  293. width: 100%;
  294. background-color: rgba(31, 39, 97, 1);
  295. }
  296. .home_header_out {
  297. // position: relative;
  298. // scroll-snap-align: center;
  299. padding-bottom: 60px;
  300. width: 100%;
  301. min-width: 1200px;
  302. // background-image: url('../assets/home/bg_ty.png');
  303. background-repeat: no-repeat;
  304. background-size: contain;
  305. // background-color: #B3F1DA; //估计是需要动态
  306. display: flex;
  307. flex-direction: column;
  308. flex: 1;
  309. //获取屏幕宽度home_header_out 这个div的宽度--然后宽度*1000再除1920即为当前div的宽度
  310. .home_header_inner {
  311. min-height: 1;
  312. left: 0;
  313. right: 0;
  314. margin: auto;
  315. // height: 100px;
  316. width: 100%;
  317. .report_top {
  318. margin-left: 170px;
  319. width: 860px;
  320. margin-top: 20px;
  321. display: flex;
  322. flex-direction: row;
  323. justify-content: space-between;
  324. align-items: center;
  325. .xlts_img {
  326. width: 50px;
  327. }
  328. .report_jt {
  329. display: flex;
  330. flex-direction: column;
  331. font-size: 20px;
  332. font-weight: 700;
  333. letter-spacing: 3px;
  334. }
  335. }
  336. }
  337. .leave_message {
  338. position: relative;
  339. left: 0;
  340. right: 0;
  341. margin: auto;
  342. width: 860px;
  343. margin-bottom: 20px;
  344. margin-top: 20px;
  345. .font_blue {
  346. position: relative;
  347. color: #D31E1B;
  348. font-weight: 700;
  349. font-size: 22px;
  350. font-family: 'Rammetto One-Regular';
  351. padding-top: 30px;
  352. z-index: 10;
  353. background: url(../assets/zs/result1.png) no-repeat;
  354. background-size: auto 50px;
  355. }
  356. }
  357. .kply {
  358. width: 100%;
  359. // background-color: #FAFAFA;
  360. flex: 1;
  361. .kply_inner {
  362. // padding: 20px 20px;
  363. left: 0;
  364. right: 0;
  365. margin: auto;
  366. width: 860px;
  367. // min-height: 500px;
  368. background-color: #ffffff;
  369. border-radius: 40px;
  370. .report_result_top {
  371. box-sizing: border-box;
  372. padding: 36px 30px;
  373. box-shadow: 0px 4px 32px 0px rgba(0, 0, 0, 0.17);
  374. .report_totol_score {
  375. // margin-top: 20px;
  376. display: flex;
  377. flex-direction: row;
  378. justify-content: space-between;
  379. align-items: center;
  380. .report_bei {
  381. position: relative;
  382. // background-color: #111111;
  383. .score {
  384. width: 100%;
  385. height: 40px;
  386. text-align: center;
  387. // height: 120px;
  388. // background-color: #ffffff;
  389. // width: 10px;
  390. position: absolute;
  391. left: 0;
  392. right: 0;
  393. top: -15px;
  394. bottom: 0;
  395. margin: auto;
  396. color: #ffffff;
  397. font-size: 30px;
  398. }
  399. }
  400. .totol_result_des {
  401. color: #818996;
  402. font-size: 18px;
  403. // margin-left: 50px;
  404. letter-spacing: 1px;
  405. line-height: 30px;
  406. }
  407. }
  408. }
  409. .report_echarts_out {
  410. margin-top: 20px;
  411. border-radius: 40px;
  412. display: flex;
  413. flex-direction: row;
  414. justify-content: space-between;
  415. // background-color: #000000;
  416. // align-items: center;
  417. // height: 200px;
  418. .progress_out {
  419. margin-top: 10px;
  420. margin-bottom: 10px;
  421. width: 100%;
  422. display: flex;
  423. justify-content: start;
  424. flex-direction: row;
  425. align-items: center;
  426. // margin-right: 40px;
  427. // padding-right: 40px;
  428. .progress_out_name {
  429. color: #000000;
  430. font-size: 14px;
  431. margin-left: 10px;
  432. }
  433. .progress_out_score {
  434. color: #333333;
  435. font-weight: 600;
  436. margin-right: 25px;
  437. margin-left: 15px;
  438. }
  439. }
  440. }
  441. .des_zhishu {
  442. // background-color: #00BF78;
  443. // padding: 4px 16px;
  444. padding-left: 10px;
  445. border-radius: 20px;
  446. display: inline-flex;
  447. color: #333333;
  448. font-size: 18px;
  449. letter-spacing: 3px;
  450. font-weight: 700;
  451. margin-bottom: 10px;
  452. }
  453. .report_des_out {
  454. margin-top: 5px;
  455. // background-color: #F7F7F7;
  456. // border: 4px solid #F7F7F7;
  457. padding: 20px 40px;
  458. border-radius: 5px;
  459. box-shadow: 0px 4px 32px 0px rgba(0, 0, 0, 0.17);
  460. .score {
  461. color: #48D68E;
  462. font-size: 16px;
  463. line-height: 24px;
  464. letter-spacing: 3px;
  465. }
  466. .des {
  467. color: #818996;
  468. font-size: 16px;
  469. line-height: 24px;
  470. letter-spacing: 3px;
  471. }
  472. }
  473. .start_button_out {
  474. margin-top: 40px;
  475. margin-bottom: 40px;
  476. display: flex;
  477. flex-direction: row;
  478. justify-content: center;
  479. .start_button_self {
  480. cursor: pointer;
  481. // width: 100px;
  482. border-radius: 12px;
  483. color: #ffffff;
  484. background-color: #1F2761;
  485. margin-right: 20px;
  486. padding: 8px 60px;
  487. cursor: pointer;
  488. display: flex;
  489. align-items: center;
  490. }
  491. }
  492. }
  493. }
  494. }
  495. .home_mid {
  496. // background-color: blanchedalmond;
  497. width: 1200px;
  498. left: 0;
  499. right: 0;
  500. margin: auto;
  501. margin-top: 40px;
  502. // position: relative;
  503. .kepu_title {
  504. text-align: center;
  505. font-size: 50px;
  506. color: #111111;
  507. line-height: 95px;
  508. // width: 100%;
  509. // left: 0;
  510. // right: 0;
  511. // margin: auto
  512. }
  513. .kepu_title_sub {
  514. margin-top: 30px;
  515. text-align: center;
  516. font-size: 28px;
  517. color: #48D68E;
  518. line-height: 26px;
  519. }
  520. .man1_group {
  521. margin-top: 60px;
  522. height: 100%;
  523. display: flex;
  524. .man1 {
  525. position: relative;
  526. width: 327px;
  527. // height: 100%;
  528. // height: 100%
  529. .man1_img {
  530. position: absolute;
  531. bottom: 0;
  532. /* bottom: 0px; */
  533. /* height: auto; */
  534. width: 100%;
  535. left: 100px
  536. }
  537. }
  538. .des {
  539. border: #48D68E solid 5px;
  540. border-radius: 40px;
  541. padding: 20px;
  542. letter-spacing: 6px;
  543. flex: 1;
  544. .des_inner {
  545. border: 1px dashed #48D68E;
  546. border-radius: 40px;
  547. padding-bottom: 40px;
  548. padding-top: 30px;
  549. padding-left: 100px;
  550. padding-right: 20px;
  551. letter-spacing: 6px;
  552. font-weight: normal;
  553. font-size: 24px;
  554. color: #333333;
  555. line-height: 40px;
  556. }
  557. }
  558. }
  559. .man2_group {
  560. margin-top: 60px;
  561. height: 100%;
  562. display: flex;
  563. .man2 {
  564. position: relative;
  565. width: 327px;
  566. // height: 100%;
  567. // height: 100%
  568. .man2_img {
  569. position: absolute;
  570. bottom: 0;
  571. /* bottom: 0px; */
  572. /* height: auto; */
  573. width: 100%;
  574. left: -100px
  575. }
  576. }
  577. .des2 {
  578. border: #48D68E solid 5px;
  579. border-radius: 40px;
  580. padding: 20px;
  581. letter-spacing: 6px;
  582. flex: 1;
  583. .des2_inner {
  584. border: 1px dashed #48D68E;
  585. border-radius: 40px;
  586. padding-bottom: 40px;
  587. padding-top: 30px;
  588. padding-left: 20px;
  589. padding-right: 100px;
  590. letter-spacing: 6px;
  591. font-weight: normal;
  592. font-size: 24px;
  593. color: #333333;
  594. line-height: 40px;
  595. }
  596. }
  597. }
  598. .get_more {
  599. text-align: center;
  600. img {
  601. width: 300px;
  602. margin-top: 60px;
  603. margin-bottom: 60px;
  604. }
  605. }
  606. }
  607. // .home_footer_out {
  608. // width: 100%;
  609. // background-color: #000000;
  610. // }</style>