report.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <view class="report-content">
  3. <view class="topinfo">
  4. <image style="margin: 40upx;" src="/static/img/ai_top.png"></image>
  5. <view class="mark">得分:{{serverData.examMark}}</view>
  6. </view>
  7. <view class="topinfos">
  8. <view class="title">评 测 报 告</view>
  9. <view>EVALUATION REPORT</view>
  10. <view>机构名称:{{serverData.schoolName}}</view>
  11. <view>姓名:{{serverData.studentName}}</view>
  12. <view>科目:{{serverData.subjectName}}</view>
  13. <view>时间:{{serverData.createDate}}</view>
  14. </view>
  15. <view class="ehcarts-title">测评结果等级</view>
  16. <view>
  17. <image style="margin: 40upx;" :src="'/static/img/' + serverData.level + '.png'"></image>
  18. <!-- <view>得分DSDSD</view> -->
  19. </view>
  20. <view class="ehcarts-title">评测分析</view>
  21. <view class="qiun-columns">
  22. <view >
  23. <view class="item">学科: {{serverData.subjectName}}</view>
  24. <view class="item">试题数量: {{serverData.questionNumber}}</view>
  25. </view>
  26. <view >
  27. <view class="item">总分: 100</view>
  28. <view class="item">知识点: {{serverData.languagePointsNumber}}</view>
  29. </view>
  30. <view class="qiun-charts">
  31. <canvas canvas-id="analyse"
  32. id="analyse"
  33. class="charts"
  34. :width="cWidth * pixelRatio"
  35. :height="cHeight * pixelRatio"
  36. :style="{'width': cWidth + 'px', 'height' : cHeight+'px'}"
  37. @touchstart="touchPie($event, 'analyse')">
  38. </canvas>
  39. </view>
  40. </view>
  41. <view class="ehcarts-title">知识点掌握情况</view>
  42. <view class="qiun-columns">
  43. <view class="qiun-charts3">
  44. <!--#ifdef MP-ALIPAY -->
  45. <canvas
  46. canvas-id="languagePintsRate"
  47. id="languagePintsRate"
  48. class="charts3"
  49. :style="{'width':cWidth3*pixelRatio+'px',
  50. 'height':cHeight3*pixelRatio+'px',
  51. 'transform': 'scale('+(1/pixelRatio)+')',
  52. 'position': relative, 'left': 20%,
  53. 'margin-top':-cHeight3*(pixelRatio-1)/2+'px'}">
  54. </canvas>
  55. <canvas
  56. canvas-id="questionRate"
  57. id="questionRate"
  58. class="charts3"
  59. :style="{'width':cWidth3*pixelRatio+'px',
  60. 'height':cHeight3*pixelRatio+'px',
  61. 'position': relative, 'left': 20%,
  62. 'transform': 'scale('+(1/pixelRatio)+')',
  63. 'margin-top':-cHeight3*(pixelRatio-1)/2+'px'}">
  64. </canvas>
  65. <!--#endif-->
  66. <!--#ifndef MP-ALIPAY -->
  67. <canvas
  68. canvas-id="languagePintsRate"
  69. style="position': relative; left: 6%"
  70. id="languagePintsRate" class="charts3"></canvas>
  71. <canvas
  72. canvas-id="questionRate"
  73. id="questionRate"
  74. class="charts3" style="position': relative; left: 50%">
  75. </canvas>
  76. <!--#endif-->
  77. </view>
  78. <view>
  79. <view class="count_item">
  80. <view style="color: #39B54A;">已掌握 {{serverData.graspLanguagePointsNumber}}</view>
  81. <view style="color: red">未掌握 {{serverData.noGraspLanguagePointsNumber}}</view>
  82. </view>
  83. <view class="count_item">
  84. <view style="color: #409eff;">答对题数 {{serverData.rightQuestionNumber}}</view>
  85. <view style="color: red">答错题数 {{serverData.errorQuestionNumber}}</view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="ehcarts-title">{{serverData.studentName}}测评结果</view>
  90. <view
  91. v-for="(item, index) in serverData.ctLanguagePointsResponseList"
  92. style="margin:10px;"
  93. class="qiun-columns">
  94. <ai-progress
  95. :content="item.languagePointsName"
  96. :lineData="true"
  97. strokeWidth="20"
  98. :textInside="true" :percentage="item.rightRate">
  99. </ai-progress>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import uCharts from '@/components/u-charts/u-charts.js'
  105. import aiProgress from '@/components/ai-progress/ai-progress.vue'
  106. import { mapGetters } from 'vuex'
  107. var _self;
  108. var canvasObj = {};
  109. export default {
  110. components: {aiProgress},
  111. data() {
  112. return {
  113. serverData: {},
  114. cWidth: '',
  115. cHeight: '',
  116. cWidth2: '', //横屏图表
  117. cHeight2: '', //横屏图表
  118. cWidth3: '', //圆弧进度图
  119. cHeight3: '', //圆弧进度图
  120. arcbarWidth: '', //圆弧进度图,进度条宽度,此设置可使各端宽度一致
  121. gaugeWidth: '', //仪表盘宽度,此设置可使各端宽度一致
  122. tips: '',
  123. pixelRatio: 1,
  124. serverData: '',
  125. itemCount: 30, //x轴单屏数据密度
  126. sliderMax: 50
  127. }
  128. },
  129. computed: {
  130. ...mapGetters({
  131. studentId: 'paper/getStudentId'
  132. })
  133. },
  134. onLoad() {
  135. _self = this;
  136. //#ifdef MP-ALIPAY
  137. uni.getSystemInfo({
  138. success: function(res) {
  139. if (res.pixelRatio > 1) {
  140. //正常这里给2就行,如果pixelRatio=3性能会降低一点
  141. //_self.pixelRatio =res.pixelRatio;
  142. _self.pixelRatio = 2;
  143. }
  144. }
  145. });
  146. //#endif
  147. this.cWidth = uni.upx2px(750);
  148. this.cHeight = uni.upx2px(500);
  149. this.cWidth2 = uni.upx2px(700);
  150. this.cHeight2 = uni.upx2px(1100);
  151. this.cWidth3 = uni.upx2px(250);
  152. this.cHeight3 = uni.upx2px(250);
  153. this.arcbarWidth = uni.upx2px(24);
  154. this.gaugeWidth = uni.upx2px(30);
  155. this.getCtTestReport()
  156. //this.fillData(Data);
  157. },
  158. /* onReady() {
  159. this.getServerData();
  160. }, */
  161. methods: {
  162. getCtTestReport () {
  163. let params = {
  164. studentId: this.studentId
  165. }
  166. this.$httpApi.get('/front/aiCt/getCtTestReport', params)
  167. .then(response => {
  168. this.serverData = response.data
  169. // 记载测评分析图表
  170. let ctLanguagePointsResponseList = this.serverData.ctLanguagePointsResponseList
  171. this.loadAnalyseReport(ctLanguagePointsResponseList)
  172. let graspLanguagePointsNumber = this.serverData.graspLanguagePointsNumber
  173. let noGraspLanguagePointsNumber = this.serverData.noGraspLanguagePointsNumber
  174. let languagePintsSeries = [
  175. {
  176. "name": "知识点掌握",
  177. "data": graspLanguagePointsNumber / (graspLanguagePointsNumber + noGraspLanguagePointsNumber),
  178. "color": "#f04864"
  179. }
  180. ]
  181. this.loadLanguagePintsReport(languagePintsSeries)
  182. let rightQuestionNumber = this.serverData.rightQuestionNumber
  183. let errorQuestionNumber = this.serverData.errorQuestionNumber
  184. let questionSeries = [
  185. {
  186. "name": "准确率",
  187. "data": rightQuestionNumber / (rightQuestionNumber + errorQuestionNumber),
  188. "color": "#f04864"
  189. }
  190. ]
  191. this.loadQuestionRateReport(questionSeries)
  192. })
  193. },
  194. loadAnalyseReport (ctLanguagePointsResponseList) {
  195. let languagePointsList = []
  196. ctLanguagePointsResponseList.forEach(item => {
  197. // languagePointsNameArray.push(item.languagePointsName)
  198. languagePointsList.push({
  199. data: item.languagePointsQuestionNumber,
  200. name: item.languagePointsName
  201. })
  202. })
  203. let options = {
  204. series: []
  205. }
  206. options.series = languagePointsList;
  207. this.showPie("analyse", options);
  208. },
  209. loadLanguagePintsReport (data) {
  210. let options = {
  211. series: data
  212. }
  213. this.showArcbar('languagePintsRate', options);
  214. },
  215. loadQuestionRateReport (data) {
  216. let options = {
  217. series: data
  218. }
  219. this.showArcbar('questionRate', options);
  220. },
  221. showPie(canvasId, chartData) {
  222. canvasObj[canvasId] = new uCharts({
  223. $this: _self,
  224. canvasId: canvasId,
  225. type: 'pie',
  226. fontSize: 11,
  227. padding:[15,15,0,15],
  228. legend:{
  229. show:true,
  230. padding:5,
  231. lineHeight:11,
  232. margin:0,
  233. },
  234. background: '#FFFFFF',
  235. pixelRatio: _self.pixelRatio,
  236. series: chartData.series,
  237. animation: false,
  238. width: _self.cWidth * _self.pixelRatio,
  239. height: _self.cHeight * _self.pixelRatio,
  240. dataLabel: true,
  241. extra: {
  242. pie: {
  243. lableWidth: 15
  244. }
  245. },
  246. })
  247. },
  248. showRadar(canvasId, chartData) {
  249. canvasObj[canvasId] = new uCharts({
  250. $this: _self,
  251. canvasId: canvasId,
  252. type: 'radar',
  253. fontSize: 11,
  254. padding:[15,15,0,15],
  255. legend:{
  256. show:true,
  257. padding:5,
  258. lineHeight:11,
  259. margin:0,
  260. },
  261. background: '#FFFFFF',
  262. pixelRatio: _self.pixelRatio,
  263. animation: false,
  264. dataLabel: true,
  265. categories: chartData.categories,
  266. series: chartData.series,
  267. width: _self.cWidth * _self.pixelRatio,
  268. height: _self.cHeight * _self.pixelRatio,
  269. extra: {
  270. radar: {
  271. max: 200 //雷达数值的最大值
  272. }
  273. }
  274. })
  275. },
  276. showArcbar(canvasId, chartData) {
  277. new uCharts({
  278. $this: _self,
  279. canvasId: canvasId,
  280. type: 'arcbar',
  281. fontSize: 11,
  282. title: {
  283. name: Math.round(chartData.series[0].data * 100) + '%',
  284. color: chartData.series[0].color,
  285. fontSize: 25 * _self.pixelRatio
  286. },
  287. subtitle: {
  288. name: chartData.series[0].name,
  289. color: '#666666',
  290. fontSize: 15 * _self.pixelRatio
  291. },
  292. extra: {
  293. arcbar: {
  294. type: 'default',
  295. width: _self.arcbarWidth * _self.pixelRatio, //圆弧的宽度
  296. }
  297. },
  298. background: '#FFFFFF',
  299. pixelRatio: _self.pixelRatio,
  300. series: chartData.series,
  301. animation: false,
  302. width: _self.cWidth3 * _self.pixelRatio,
  303. height: _self.cHeight3 * _self.pixelRatio,
  304. dataLabel: true,
  305. })
  306. },
  307. showArcbar2(canvasId, chartData) {
  308. new uCharts({
  309. $this: _self,
  310. canvasId: canvasId,
  311. type: 'arcbar',
  312. fontSize: 11,
  313. title: {
  314. name: Math.round(chartData.series[0].data * 100) + '%',
  315. color: chartData.series[0].color,
  316. fontSize: 25 * _self.pixelRatio
  317. },
  318. subtitle: {
  319. name: chartData.series[0].name,
  320. color: '#666666',
  321. fontSize: 15 * _self.pixelRatio
  322. },
  323. extra: {
  324. arcbar: {
  325. type: 'default',
  326. width: _self.arcbarWidth * _self.pixelRatio, //圆弧的宽度
  327. backgroundColor: '#ffe3e8',
  328. startAngle: 1.25,
  329. endAngle: 0.75
  330. }
  331. },
  332. background: '#FFFFFF',
  333. pixelRatio: _self.pixelRatio,
  334. series: chartData.series,
  335. animation: false,
  336. width: _self.cWidth3 * _self.pixelRatio,
  337. height: _self.cHeight3 * _self.pixelRatio,
  338. dataLabel: true,
  339. })
  340. },
  341. changeData() {
  342. canvasObj['canvasColumn'].updateData({
  343. series: _self.serverData.ColumnB.series,
  344. categories: _self.serverData.ColumnB.categories
  345. })
  346. },
  347. touchPie(e,id) {
  348. canvasObj[id].showToolTip(e, {
  349. format: function(item) {
  350. return item.name + ':' + item.data
  351. }
  352. })
  353. },
  354. }
  355. }
  356. </script>
  357. <style>
  358. .count_item {
  359. display: inline-block;
  360. width: 40%;
  361. margin-left: 9%;
  362. margin-top: 10px;
  363. }
  364. .topinfos {
  365. margin: 20px auto;
  366. padding: 10px 0 20px;
  367. display: flex;
  368. background-color: #ed2828;
  369. color: #fff;
  370. justify-content: center;
  371. align-items: center;
  372. flex-direction: column;
  373. }
  374. .report-content {
  375. width: 100%;
  376. height: 100%;
  377. }
  378. .mark {
  379. position: relative;
  380. right: 4%;
  381. text-align: center;
  382. font-size: 24px;
  383. font-weight: 700;
  384. }
  385. .ehcarts-title {
  386. display: flex;
  387. justify-content: space-between;
  388. align-items: center;
  389. font-size: 32upx;
  390. color: white;
  391. padding: 30upx 30upx 30upx 50upx;
  392. margin-top: 20upx;
  393. width: 100%;
  394. position: relative;
  395. background-color: #FF9966;
  396. border-bottom: 1px #FF9966 solid
  397. }
  398. .qiun-columns .item {
  399. /* width: 20upx; */
  400. display: inline-block;
  401. float: left;
  402. margin-top: 20upx;
  403. margin-bottom: 20upx;
  404. margin-left: 50upx;
  405. }
  406. page {
  407. background: #F2F2F2;
  408. width: 750upx;
  409. overflow-x: hidden;
  410. }
  411. .qiun-padding {
  412. padding: 2%;
  413. width: 96%;
  414. }
  415. .qiun-wrap {
  416. display: flex;
  417. flex-wrap: wrap;
  418. }
  419. .qiun-rows {
  420. display: flex;
  421. flex-direction: row !important;
  422. }
  423. .qiun-columns {
  424. display: flex;
  425. flex-direction: column !important;
  426. }
  427. .qiun-common-mt {
  428. margin-top: 10upx;
  429. }
  430. .qiun-bg-white {
  431. background: #FFFFFF;
  432. }
  433. .qiun-title-bar {
  434. width: 96%;
  435. padding: 10upx 2%;
  436. flex-wrap: nowrap;
  437. }
  438. .qiun-title-dot-light {
  439. border-left: 10upx solid #0ea391;
  440. padding-left: 10upx;
  441. font-size: 32upx;
  442. color: #000000
  443. }
  444. /* 通用样式 */
  445. .qiun-charts {
  446. width: 750upx;
  447. height: 500upx;
  448. background-color: #FFFFFF;
  449. }
  450. .charts {
  451. width: 750upx;
  452. height: 500upx;
  453. background-color: #FFFFFF;
  454. }
  455. /* 横屏样式 */
  456. .qiun-charts-rotate {
  457. width: 700upx;
  458. height: 1100upx;
  459. background-color: #FFFFFF;
  460. padding: 25upx;
  461. }
  462. .charts-rotate {
  463. width: 700upx;
  464. height: 1100upx;
  465. background-color: #FFFFFF;
  466. }
  467. /* 圆弧进度样式 */
  468. .qiun-charts3 {
  469. width: 750upx;
  470. height: 250upx;
  471. background-color: #FFFFFF;
  472. position: relative;
  473. }
  474. .charts3 {
  475. position: absolute;
  476. width: 250upx;
  477. height: 250upx;
  478. background-color: #FFFFFF;
  479. }
  480. .qiun-tip {
  481. display: block;
  482. width: auto;
  483. overflow: hidden;
  484. padding: 15upx;
  485. height: 30upx;
  486. line-height: 30upx;
  487. margin: 10upx;
  488. background: #ff9933;
  489. font-size: 30upx;
  490. border-radius: 8upx;
  491. justify-content: center;
  492. text-align: center;
  493. border: 1px solid #dc7004;
  494. color: #FFFFFF;
  495. }
  496. </style>