index.vue 17 KB

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