index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. <template>
  2. <view>
  3. <nav-bar title="试卷报告"></nav-bar>
  4. <view class="top">
  5. <view class="title">{{ reportdata.examName }}</view>
  6. <view class="desc">交卷时间:{{ $method.timestampToTime(reportdata.updateTime, false) }}</view>
  7. <view class="box">
  8. <view class="left">
  9. <view>
  10. <!-- 考试 -->
  11. {{
  12. ((reportdata.rightQuestionNum /
  13. reportdata.totalQuestionNum || 0).toFixed(0) *
  14. 100)
  15. }}%
  16. <!-- {{ (((reportdata.rightQuestionNum / (reportdata.rightQuestionNum + wrongRecordWrongNum)) || 0) * 100).toFixed(0)}}% -->
  17. </view>
  18. <view>正确率</view>
  19. <view>不含简答/案例题</view>
  20. </view>
  21. <view class="right">
  22. <view class="flex up">
  23. <!-- <u-icon name="checkmark" color="#16D48B" size="48" style="margin-right: 14rpx;"></u-icon> -->
  24. <image class="right_num" src="/static/right_num.png" mode="widthFix"></image>
  25. <view class="text">正确题数</view>
  26. <text class="green">{{ reportdata.rightQuestionNum }}</text>
  27. </view>
  28. <view class="flex up">
  29. <!-- <u-icon name="checkmark" color="#16D48B" size="48" style="margin-right: 14rpx;"></u-icon> -->
  30. <image class="out_num" src="/static/out_num.png" mode="widthFix"></image>
  31. <view class="text">少选题数</view>
  32. <text class="yellow">{{ reportdata.lessQuestionNum }}</text>
  33. </view>
  34. <view class="flex down">
  35. <!-- <u-icon name="close" color="#FF3B30" size="38" style="margin-right: 26rpx;"></u-icon> -->
  36. <image class="wrong_num" src="/static/wrong_num.png" mode="widthFix"></image>
  37. <view class="text">错误题数</view>
  38. <text class="red">{{ wrongRecordWrongNum }}</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="dis_fst">
  43. <navigator
  44. v-if="wrongRecordWrongNum != 0"
  45. :url="
  46. '/pages2/bank/questionBankWrongExplain?recordId=' + reportdata.recordId+'&id='+examData.examId
  47. "
  48. >
  49. <view class="btnACs">错题解析</view>
  50. </navigator>
  51. <navigator
  52. :url="
  53. '/pages2/bank/questionBankAllExplain?id=' +
  54. reportdata.examId +
  55. '&goodsid=' +
  56. reportdata.goodsId +
  57. '&moduleId=' +
  58. reportdata.moduleExamId +
  59. '&chapterId=' +
  60. reportdata.chapterExamId +
  61. '&recordId='+ reportdata.recordId
  62. "
  63. >
  64. <view class="btnACs">全部解析</view>
  65. </navigator>
  66. <view class="btnACs">去做题</view>
  67. </view>
  68. </view>
  69. <view class="bottom">
  70. <view class="circle-wrap">
  71. <view class="circle-list">
  72. <view class="item" v-show="reportdata.totalScore">
  73. <view class="title">
  74. 试卷得分
  75. <text>(不含简答和案例题)</text>
  76. </view>
  77. <canvas class="canvas" canvas-id="Canvas1"></canvas>
  78. </view>
  79. <view class="item" v-show="reportdata.examTime">
  80. <view class="title">答题时长</view>
  81. <canvas canvas-id="Canvas2"></canvas>
  82. </view>
  83. <view class="item" v-show="reportdata.score != -1">
  84. <view class="title">试卷得分
  85. <text>(含简答和案例题)</text>
  86. </view>
  87. <canvas canvas-id="Canvas3"></canvas>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="notice">
  93. <image class="img" mode="widthFix" src="../static/notice1.png"></image>
  94. <view class="text">
  95. 模考讲解直播将在<text class="blue">2022年4月20日20:00</text>开始 开启模考讲解直播提醒,不错过每一个考点
  96. </view>
  97. <view class="btn" @click="noticeModal = true">开启模考讲解直播提醒</view>
  98. </view>
  99. <u-popup class="notice__modal" v-model="noticeModal" mode="center" border-radius="24" :mask-close-able="false">
  100. <view class="notice__content">
  101. <view class="body">
  102. <image class="img" src="/pages5/static/notice4.png" mode="widthFix"></image>
  103. <view class="content">
  104. <view class="bold center">开启模考讲解直播提醒</view>
  105. <view class="center text">
  106. 此科目模考分析将在<text class="blue">4月20日 20:00</text>进行直播讲解,开启直播提醒,不错过名师讲解
  107. </view>
  108. </view>
  109. </view>
  110. <view class="footer">
  111. <view class="btn close" @click="noticeModal = false">暂不开启</view>
  112. <view class="btn" @click="noticeModal = false">开启提醒</view>
  113. </view>
  114. </view>
  115. </u-popup>
  116. </view>
  117. </template>
  118. <script>
  119. import { mapGetters } from 'vuex';
  120. export default {
  121. data() {
  122. return {
  123. id: '',
  124. noticeModal:false,
  125. recordId:'',
  126. reportdata: {},
  127. examData:{},
  128. examId:'',
  129. moduleId:'',
  130. goodsId:'',
  131. chapterId:'',
  132. context1: null,
  133. context2: null,
  134. nextExamId:'',
  135. wrongRecordWrongNum:'',
  136. orderGoodsId:'',
  137. };
  138. },
  139. onUnload() {},
  140. computed: { ...mapGetters(['userInfo']) },
  141. async onShow() {
  142. },
  143. async onLoad(option) {
  144. console.log(option)
  145. this.orderGoodsId = option.orderGoodsId
  146. this.recordId = option.id;
  147. this.examId = option.examId;
  148. this.moduleId = option.moduleId || 0;
  149. this.chapterId = option.chapterId || 0;
  150. this.goodsId = option.goodsId || '';
  151. this.examWrongRecordWrongNum();
  152. this.bankExamNextExam()
  153. await this.bankExam();
  154. await this.examReport();
  155. uni.getSystemInfo({
  156. success: res => {
  157. var winW = res.screenWidth;
  158. var winH = res.screenHeight;
  159. uni.createSelectorQuery()
  160. .in(this)
  161. .select('.canvas')
  162. .boundingClientRect()
  163. .exec(async newRes => {
  164. var width = newRes[0].width;
  165. var height = newRes[0].height;
  166. var caculateX = winW / 750;
  167. var caculateY = winH / 1334;
  168. console.log(caculateX);
  169. if(this.reportdata.totalScore) {
  170. var context1 = uni.createCanvasContext('Canvas1');
  171. this.context1 = context1;
  172. context1.setStrokeStyle('#EEEEEE');
  173. context1.setLineWidth(caculateX * 20);
  174. context1.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true);
  175. context1.stroke();
  176. context1.beginPath();
  177. context1.setStrokeStyle('#32D74B');
  178. context1.setFillStyle('#32D74B');
  179. context1.setTextAlign('center');
  180. context1.setTextBaseline('middle');
  181. context1.setLineCap('round');
  182. context1.setFontSize(caculateX * 64);
  183. context1.fillText(this.reportdata.performance, caculateX * 90, caculateX * 90, caculateX * 180);
  184. context1.setFillStyle('#999999');
  185. context1.setFontSize(caculateX * 20);
  186. context1.fillText(`满分${this.reportdata.totalScore}`, caculateX * 90, caculateX * 130, caculateX * 180);
  187. context1.arc(caculateX * 90, caculateX * 90, caculateX * 80, -Math.PI/2, -Math.PI/2 + (this.reportdata.performance / this.reportdata.totalScore) * 2 * Math.PI, false);
  188. context1.stroke();
  189. context1.draw();
  190. }
  191. if(this.reportdata.examTime) {
  192. var context2 = uni.createCanvasContext('Canvas2');
  193. this.context2 = context2;
  194. context2.setStrokeStyle('#EEEEEE');
  195. context2.setLineWidth(caculateX * 20);
  196. context2.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true);
  197. context2.stroke();
  198. context2.beginPath();
  199. context2.setStrokeStyle('#007AFF');
  200. context2.setFillStyle('#007AFF');
  201. context2.setTextAlign('center');
  202. context2.setTextBaseline('middle');
  203. context2.setLineCap('round');
  204. context2.setFontSize(caculateX * 64);
  205. context2.fillText(`${this.reportdata.doTime}'`, caculateX * 90, caculateX * 90, caculateX * 180);
  206. context2.setFillStyle('#999999');
  207. context2.setFontSize(caculateX * 20);
  208. context2.fillText(`限时${this.reportdata.examTime}'`, caculateX * 90, caculateX * 130, caculateX * 180);
  209. context2.arc(caculateX * 90, caculateX * 90, caculateX * 80, -Math.PI/2, -Math.PI/2 + (this.reportdata.doTime / this.reportdata.examTime) * 2 * Math.PI, false);
  210. context2.stroke();
  211. context2.draw();
  212. }
  213. if(this.reportdata.score != -1) {
  214. var context3 = uni.createCanvasContext('Canvas3');
  215. this.context3 = context3;
  216. context3.setStrokeStyle('#EEEEEE');
  217. context3.setLineWidth(caculateX * 20);
  218. context3.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true);
  219. context3.stroke();
  220. context3.beginPath();
  221. context3.setStrokeStyle('#32D74B');
  222. context3.setFillStyle('#32D74B');
  223. context3.setTextAlign('center');
  224. context3.setTextBaseline('middle');
  225. context3.setLineCap('round');
  226. context3.setFontSize(caculateX * 64);
  227. context3.fillText((this.reportdata.performance + this.reportdata.score), caculateX * 90, caculateX * 90, caculateX * 180);
  228. context3.setFillStyle('#999999');
  229. context3.setFontSize(caculateX * 20);
  230. context3.fillText(`满分${this.reportdata.totalScore}`, caculateX * 90, caculateX * 130, caculateX * 180);
  231. context3.arc(caculateX * 90, caculateX * 90, caculateX * 80, -Math.PI/2, -Math.PI/2 + ((this.reportdata.performance + this.reportdata.score) / this.reportdata.totalScore) * 2 * Math.PI, false);
  232. context3.stroke();
  233. context3.draw();
  234. }
  235. });
  236. }
  237. });
  238. },
  239. methods: {
  240. bankExamNextExam() {
  241. this.$api.bankExamNextExam({
  242. chapterExamId:this.chapterId,
  243. examId:this.examId,
  244. goodsId:this.goodsId,
  245. orderGoodsId:this.orderGoodsId,
  246. moduleExamId:this.moduleId
  247. }).then(res => {
  248. if(res.data.code == 500) {
  249. this.nextExamId = '';
  250. } else if(res.data.code == 200) {
  251. this.nextExamId = res.data.data.examId;
  252. }
  253. })
  254. },
  255. backBank() {
  256. uni.navigateTo({
  257. url: '/pages2/bank/questionBank?orderGoodsId='+orderGoodsId+'&id=' +this.nextExamId + '&goodsid=' + this.goodsId + '&moduleId=' + this.moduleId + '&chapterId=' + this.chapterId + ''
  258. });
  259. // uni.navigateBack({
  260. // delta:1
  261. // })
  262. // uni.redirectTo({
  263. // url: '/pages2/bank/my_question'
  264. // });
  265. },
  266. bankExam(){
  267. return new Promise(resolve =>{
  268. this.$api.bankExam(this.examId).then(res => {
  269. this.examData = res.data.data;
  270. resolve()
  271. })
  272. })
  273. },
  274. /**
  275. * 去做题
  276. */
  277. async doRepeat(id, goodsId, moduleId = 0, chapterId = 0) {
  278. // await this.getDetail(goodsId);
  279. let count = await this.examRecordCount(id, goodsId);
  280. let answerNum = await this.getExamDetail(id);
  281. //超过答题次数
  282. if (answerNum > 0 && count >= answerNum) {
  283. this.$u.toast('该试卷只能答题' + answerNum + '次!');
  284. return;
  285. }
  286. var pages = getCurrentPages();
  287. var prepage = pages[pages.length - 2]; //上一个页面
  288. prepage.$vm.isRepeat = true;
  289. uni.redirectTo({
  290. url: '/pages2/bank/questionBank?orderGoodsId='+this.orderGoodsId+'&id=' + id + '&goodsid=' + goodsId + '&moduleId=' + moduleId + '&chapterId=' + chapterId + ''
  291. });
  292. },
  293. /**
  294. * @param {Object} exam_id
  295. * 获取试卷可以做的次数
  296. */
  297. getExamDetail(exam_id) {
  298. return new Promise(resolve => {
  299. this.$api.getExamDetail(exam_id).then(res => {
  300. resolve(res.data.data.answerNum);
  301. });
  302. });
  303. },
  304. examWrongRecordWrongNum() {
  305. return new Promise(resolve => {
  306. this.$api.examWrongRecordWrongNum(this.recordId).then(res => {
  307. this.wrongRecordWrongNum = res.data.data || 0;
  308. resolve();
  309. });
  310. });
  311. },
  312. /**
  313. * 查询试卷历史做题次数
  314. */
  315. examRecordCount(examId, goodsId) {
  316. return new Promise(resolve => {
  317. this.$api
  318. .examRecordCount({
  319. examId: examId,
  320. orderGoodsId: this.orderGoodsId,
  321. })
  322. .then(res => {
  323. resolve(res.data.data);
  324. });
  325. });
  326. },
  327. getDetail(id) {
  328. return new Promise(resolve => {
  329. this.$api.goodsDetail(id).then(res => {
  330. this.goodsData = res.data.data;
  331. resolve();
  332. });
  333. });
  334. },
  335. examReport() {
  336. return new Promise(resolve => {
  337. this.$api.examReport(this.recordId).then(res => {
  338. this.reportdata = res.data.data;
  339. resolve()
  340. });
  341. })
  342. }
  343. }
  344. };
  345. </script>
  346. <style>
  347. page {
  348. background-color: #eaeef1;
  349. }
  350. </style>
  351. <style lang="scss" scope>
  352. .disNone {
  353. display: none;
  354. }
  355. .dis_fst {
  356. margin-top: 40rpx;
  357. display: flex;
  358. align-items: center;
  359. justify-content: space-around;
  360. }
  361. .btnACs {
  362. height: 48rpx;
  363. width: 160rpx;
  364. text-align: center;
  365. line-height: 48rpx;
  366. border: 1rpx solid #007aff;
  367. border-radius: 16rpx;
  368. color: #007aff;
  369. font-size: 24rpx;
  370. }
  371. .top {
  372. margin: 16rpx 16rpx 0;
  373. border-radius: 16rpx;
  374. padding: 40rpx 24rpx 16rpx;
  375. background: #fff;
  376. .title {
  377. font-size: 32rpx;
  378. font-weight: bold;
  379. color: #333333;
  380. }
  381. .desc {
  382. margin-top: 20rpx;
  383. font-size: 24rpx;
  384. color: #999999;
  385. }
  386. .box {
  387. margin-top: 30rpx;
  388. display: flex;
  389. .left {
  390. width: 250rpx;
  391. height: 272rpx;
  392. background: #f5f5f5;
  393. border-radius: 16rpx;
  394. display: flex;
  395. align-items: center;
  396. justify-content: center;
  397. flex-direction: column;
  398. margin-right: 16rpx;
  399. view {
  400. text-align: center;
  401. &:nth-of-type(1) {
  402. font-size: 60rpx;
  403. font-weight: bold;
  404. color: #007aff;
  405. }
  406. &:nth-of-type(2) {
  407. font-size: 32rpx;
  408. font-weight: bold;
  409. color: #333333;
  410. }
  411. &:nth-of-type(3) {
  412. font-size: 24rpx;
  413. color: #999999;
  414. }
  415. }
  416. }
  417. .right {
  418. flex: 1;
  419. display: flex;
  420. flex-direction: column;
  421. justify-content: space-between;
  422. .flex {
  423. background: #f5f5f5;
  424. display: flex;
  425. height: 80rpx;
  426. align-items: center;
  427. padding: 0 40rpx;
  428. border-radius: 16rpx;
  429. image {
  430. margin-right: 28rpx;
  431. &.right_num {
  432. width:26rpx;
  433. }
  434. &.out_num {
  435. width:38rpx;
  436. }
  437. &.wrong_num {
  438. width:30rpx;
  439. }
  440. }
  441. .text {
  442. flex: 1;
  443. font-size: 30rpx;
  444. color: #666666;
  445. }
  446. text {
  447. font-size: 48rpx;
  448. color: #e12626;
  449. &.red {
  450. color: #FF3B30;
  451. }
  452. &.green {
  453. color: #36C75A;
  454. }
  455. &.yellow {
  456. color:#FFC53D;
  457. }
  458. }
  459. }
  460. }
  461. }
  462. }
  463. .bottom {
  464. .circle-wrap {
  465. .circle-list {
  466. display: flex;
  467. .item {
  468. padding: 20rpx;
  469. border-radius: 16rpx;
  470. background: #fff;
  471. margin: 16rpx;
  472. flex: 1;
  473. .title {
  474. font-weight: bold;
  475. font-size: 30rpx;
  476. line-height: 24rpx;
  477. color: #333333;
  478. text {
  479. font-size: 20rpx;
  480. color: #999999;
  481. }
  482. }
  483. canvas {
  484. margin: 36rpx auto 0;
  485. width: 180rpx;
  486. height: 180rpx;
  487. }
  488. .text {
  489. text-align: center;
  490. margin-top: 16rpx;
  491. font-size: 24rpx;
  492. color: #333333;
  493. }
  494. }
  495. }
  496. }
  497. }
  498. .notice {
  499. background:#fff;
  500. padding:40rpx;
  501. .img {
  502. width:100%;
  503. }
  504. .text {
  505. text-align: center;
  506. font-size: 28rpx;
  507. color: #666666;
  508. line-height: 48rpx;
  509. .blue {
  510. color:#007AFF;
  511. }
  512. }
  513. .btn {
  514. text-align: center;
  515. line-height: 80rpx;
  516. margin:40rpx auto 0;
  517. width: 528rpx;
  518. height: 80rpx;
  519. background: #007AFF;
  520. border-radius: 40rpx;
  521. color:#fff;
  522. }
  523. }
  524. .notice__modal {
  525. .notice__content {
  526. width: 640rpx;
  527. height: 779rpx;
  528. background: #FFFFFF;
  529. display: flex;
  530. flex-direction: column;
  531. .body {
  532. flex:1;
  533. .content {
  534. padding:30rpx 40rpx 28rpx;
  535. line-height: 40rpx;
  536. font-size: 28rpx;
  537. color:#666;
  538. .img {
  539. width:100%;
  540. }
  541. .bold {
  542. color:#333;
  543. font-size: 32rpx;
  544. font-weight: bold;
  545. }
  546. .center {
  547. text-align: center;
  548. }
  549. .blue {
  550. color:#007AFF;
  551. }
  552. .text {
  553. margin-top:20rpx;
  554. }
  555. }
  556. }
  557. .footer {
  558. height:140rpx;
  559. border-top:1px solid #EEEEEE;
  560. display: flex;
  561. align-items: center;
  562. justify-content: center;
  563. .btn {
  564. margin:0 12rpx;
  565. width: 268rpx;
  566. height: 80rpx;
  567. color:#fff;
  568. font-size: 30rpx;
  569. text-align: center;
  570. line-height: 80rpx;
  571. background: #007AFF;
  572. border-radius: 40rpx 40rpx 40rpx 40rpx;
  573. &.close {
  574. color:#007AFF;
  575. background: #F5F5F5;
  576. border-radius: 40rpx 40rpx 40rpx 40rpx;
  577. }
  578. }
  579. }
  580. }
  581. }
  582. </style>