index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. <template>
  2. <div class="bank-report">
  3. <Header></Header>
  4. <section class="section">
  5. <div class="container">
  6. <div
  7. class="section__header section__header--warm"
  8. v-if="examData.doType == 2 && reportdata.reportStatus === null"
  9. >
  10. <div class="title">
  11. <span class="icon">X</span>
  12. 测试未通过
  13. </div>
  14. <div class="desc" v-if="reportdata.doTime">
  15. 总时间:{{ $tools.secondToTime(reportdata.examTime) }}
  16. <span class="note"
  17. >答题时长:{{
  18. $tools.secondToTime(reportdata.doTime, false)
  19. }}</span
  20. >
  21. </div>
  22. </div>
  23. <div
  24. class="section__header section__header--success"
  25. v-if="examData.doType == 2 && reportdata.reportStatus === 1"
  26. >
  27. <div class="title">
  28. <span class="icon">✔</span>
  29. 测试通过
  30. </div>
  31. <div class="desc" v-if="reportdata.doTime">
  32. 总时间:{{ $tools.secondToTime(reportdata.examTime) }}
  33. <span class="note"
  34. >答题时长:{{
  35. $tools.secondToTime(reportdata.doTime, false)
  36. }}</span
  37. >
  38. </div>
  39. </div>
  40. <template v-else>
  41. <div class="section__header" v-if="reportdata.doTime">
  42. <div class="desc">
  43. 总时间:{{ $tools.secondToTime(reportdata.examTime) }}
  44. <span class="note"
  45. >答题时长:{{
  46. $tools.secondToTime(reportdata.doTime, false)
  47. }}</span
  48. >
  49. </div>
  50. </div>
  51. </template>
  52. <div class="section__body">
  53. <div class="section__body__content">
  54. <div class="left-box" v-if="reportdata.totalScore">
  55. <div class="left-box__in">
  56. <div class="title">
  57. 试卷得分
  58. <span class="note">(客观题)</span>
  59. </div>
  60. <div class="desc" style="margin-top: 70px">
  61. {{ reportdata.performance }}
  62. </div>
  63. <div class="other">满分{{ reportdata.totalScore }}</div>
  64. </div>
  65. <!-- <div class="left-box__in left-box__in--bottom">
  66. <div class="title">
  67. 试卷得分
  68. <span class="note">(客观题+主观题)</span>
  69. </div>
  70. <div class="desc">
  71. {{ reportdata.performance + reportdata.score }}
  72. </div>
  73. <div class="other">满分{{ reportdata.totalScore }}</div>
  74. </div> -->
  75. </div>
  76. <div class="right-box">
  77. <div class="right-box__in">
  78. <div class="title">
  79. 正确率
  80. <span class="note">(客观题)</span>
  81. </div>
  82. <div class="desc">
  83. <!-- 练习 -->
  84. <template v-if="examData.doType == 1">
  85. {{
  86. ((reportdata.rightQuestionNum /
  87. reportdata.doQuestionNum || 0) *
  88. 100)
  89. | toFixed(0)
  90. }}%
  91. </template>
  92. <!-- 考试 -->
  93. <template v-if="examData.doType == 2">
  94. {{
  95. ((reportdata.rightQuestionNum /
  96. reportdata.totalQuestionNum || 0) *
  97. 100)
  98. | toFixed(0)
  99. }}%
  100. </template>
  101. </div>
  102. <!-- <div class="other">满分{{ reportdata.totalScore }}</div> -->
  103. </div>
  104. <div class="right-box__in right-box__in--bottom">
  105. <div class="child">
  106. <div class="child__title child__title--success">
  107. {{ reportdata.rightQuestionNum }}
  108. </div>
  109. <div class="child__desc">正确题数</div>
  110. </div>
  111. <div class="child">
  112. <div class="child__title child__title--yellow">
  113. {{ reportdata.lessQuestionNum }}
  114. </div>
  115. <div class="child__desc">少选题数</div>
  116. </div>
  117. <div class="child child---right">
  118. <div class="child__title child__title--warm">
  119. {{ wrongRecordWrongNum }}
  120. </div>
  121. <div class="child__desc">错误题数</div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="section__footer">
  128. <el-button type="primary" @click="back" class="btn"
  129. >返回列表</el-button
  130. >
  131. <el-button
  132. type="primary"
  133. class="btn"
  134. v-if="nextExamId"
  135. @click="backBank"
  136. >练习下一节</el-button
  137. >
  138. <el-button type="primary" class="btn" @click="doRepeat(reportdata)"
  139. >重新做题</el-button
  140. >
  141. <el-button
  142. type="primary"
  143. class="btn"
  144. @click="wrongExplain(reportdata)"
  145. >错题解析</el-button
  146. >
  147. <el-button type="primary" class="btn" @click="allExplain(reportdata)"
  148. >全部解析</el-button
  149. >
  150. </div>
  151. <div v-if="courseList.length" class="course_list">
  152. <div class="course__header">
  153. <div class="title">相关推荐</div>
  154. </div>
  155. <div class="course__body">
  156. <!-- <p
  157. v-if="
  158. !courseList.length
  159. "
  160. class="text_align"
  161. >
  162. 无推荐课程
  163. </p> -->
  164. <ul class="list clearfix">
  165. <template v-for="(item, index) in courseList">
  166. <li class="course-item" :key="index">
  167. <GoodsItem :item="item"></GoodsItem>
  168. </li>
  169. </template>
  170. </ul>
  171. </div>
  172. <div class="pagination">
  173. <el-pagination
  174. @current-change="currentChangeCou"
  175. background
  176. layout="prev, pager, next"
  177. :total="total"
  178. :page-size="pageSize"
  179. >
  180. </el-pagination>
  181. </div>
  182. </div>
  183. </div>
  184. </section>
  185. <ToolBar></ToolBar>
  186. <Footer></Footer>
  187. </div>
  188. </template>
  189. <script>
  190. import Footer from "@/components/footer/index";
  191. import Header from "@/components/header/index";
  192. import ToolBar from "@/components/toolbar/index";
  193. import GoodsItem from "@/components/goodsItem/index";
  194. import { mapGetters } from "vuex";
  195. export default {
  196. name: "BankExplain",
  197. components: {
  198. Footer,
  199. Header,
  200. ToolBar,
  201. GoodsItem,
  202. },
  203. data() {
  204. return {
  205. wrongRecordWrongNum: 0,
  206. nextExamId: "",
  207. examData: {},
  208. reportdata: {},
  209. goodsId: 0,
  210. chapterId: 0,
  211. moduleId: 0,
  212. examId: 0,
  213. recordId: 0,
  214. orderGoodsId: "",
  215. courseList: [],
  216. pageNum: 1,
  217. pageSize: 10,
  218. total: 0,
  219. };
  220. },
  221. computed: {
  222. ...mapGetters(["examResult"]),
  223. },
  224. async mounted() {
  225. this.chapterId = this.$route.query.chapterId;
  226. this.moduleId = this.$route.query.moduleId;
  227. this.examId = this.$route.query.examId;
  228. this.recordId = this.$route.query.recordId;
  229. this.orderGoodsId = this.$route.query.orderGoodsId || "";
  230. this.goodsId = this.$route.params.goodsId;
  231. this.getcourList()
  232. this.examWrongRecordWrongNum();
  233. this.bankExamNextExam();
  234. await this.bankExam();
  235. await this.examReport();
  236. },
  237. methods: {
  238. getcourList() {
  239. this.$axios({
  240. url: '/apply/recommend/goodsList',
  241. method: 'post',
  242. data: {
  243. examId: this.examId,
  244. pageNum: this.pageNum,
  245. pageSize: this.pageSize,
  246. }
  247. }).then((res) => {
  248. if (res.code == 200) {
  249. this.courseList = res.rows || []
  250. this.total = res.total
  251. }
  252. })
  253. },
  254. currentChangeCou(val) {
  255. this.pageNum = val
  256. this.getcourList()
  257. },
  258. back() {
  259. // this.$router.replace({
  260. // path: "/person-center/my-bank/bank-detail/" + this.goodsId,
  261. // query: {
  262. // orderGoodsId: this.orderGoodsId,
  263. // },
  264. // });
  265. this.$router.replace({
  266. path: "/person-center/my-bank/index"
  267. });
  268. },
  269. /**
  270. * 去做题
  271. */
  272. async doRepeat(reportdata) {
  273. // await this.getDetail(reportdata.goodsId);
  274. let count = await this.examRecordCount(
  275. reportdata.examId,
  276. reportdata.goodsId
  277. );
  278. let answerNum = await this.getExamDetail(reportdata.examId);
  279. //超过答题次数
  280. if (answerNum > 0 && count >= answerNum) {
  281. this.$message({
  282. type: "warning",
  283. message: "该试卷只能答题" + answerNum + "次!",
  284. });
  285. return;
  286. }
  287. this.$router.replace({
  288. path: "/bank-exam/" + reportdata.goodsId,
  289. query: {
  290. orderGoodsId: this.orderGoodsId,
  291. examId: reportdata.examId,
  292. moduleId: reportdata.moduleId || 0,
  293. chapterId: reportdata.chapterId || 0,
  294. },
  295. });
  296. },
  297. /**
  298. * @param {Object} exam_id
  299. * 获取试卷可以做的次数
  300. */
  301. getExamDetail(exam_id) {
  302. return new Promise((resolve) => {
  303. this.$request.getExamDetail(exam_id).then((res) => {
  304. resolve(res.data.answerNum);
  305. });
  306. });
  307. },
  308. /**
  309. * 查询试卷历史做题次数
  310. */
  311. examRecordCount(examId, goodsId) {
  312. return new Promise((resolve) => {
  313. this.$request
  314. .examRecordCount({
  315. examId: examId,
  316. goodsId: goodsId,
  317. })
  318. .then((res) => {
  319. resolve(res.data);
  320. });
  321. });
  322. },
  323. getDetail(goodsId) {
  324. return new Promise((resolve) => {
  325. this.$request
  326. .orderInfo({
  327. orderGoodsId: this.orderGoodsId,
  328. })
  329. .then((res) => {
  330. this.goodsData = res.data;
  331. resolve();
  332. });
  333. });
  334. },
  335. examWrongRecordWrongNum() {
  336. return new Promise((resolve) => {
  337. this.$request.examWrongRecordWrongNum(this.recordId).then((res) => {
  338. this.wrongRecordWrongNum = res.data || 0;
  339. resolve();
  340. });
  341. });
  342. },
  343. backBank() {
  344. this.$router.replace({
  345. path: "/bank-exam/" + this.goodsId,
  346. query: {
  347. orderGoodsId: this.orderGoodsId,
  348. examId: this.nextExamId,
  349. moduleId: this.moduleId || 0,
  350. chapterId: this.chapterId || 0,
  351. },
  352. });
  353. },
  354. bankExamNextExam() {
  355. this.$request
  356. .bankExamNextExam({
  357. chapterExamId: this.chapterId,
  358. examId: this.examId,
  359. goodsId: this.goodsId,
  360. orderGoodsId: this.orderGoodsId,
  361. moduleExamId: this.moduleId,
  362. })
  363. .then((res) => {
  364. this.nextExamId = res.data.examId;
  365. })
  366. .catch((err) => {
  367. this.nextExamId = "";
  368. });
  369. },
  370. bankExam() {
  371. return new Promise((resolve) => {
  372. this.$request.bankExam(this.examId).then((res) => {
  373. this.examData = res.data;
  374. resolve();
  375. });
  376. });
  377. },
  378. examReport() {
  379. return new Promise((resolve) => {
  380. this.$request.examReport(this.recordId).then((res) => {
  381. this.reportdata = res.data;
  382. resolve();
  383. });
  384. });
  385. },
  386. wrongExplain(reportdata) {
  387. this.$router.push({
  388. path: "/bank-exam-wrong-explain/" + reportdata.recordId,
  389. query: {
  390. examId: reportdata.examId,
  391. moduleId: reportdata.moduleId || 0,
  392. chapterId: reportdata.chapterId || 0,
  393. goodsId: this.goodsId,
  394. orderGoodsId: this.orderGoodsId,
  395. },
  396. });
  397. },
  398. allExplain(reportdata) {
  399. this.$router.push({
  400. path: "/bank-exam-all-explain/" + reportdata.recordId,
  401. query: {
  402. examId: reportdata.examId,
  403. moduleId: reportdata.moduleId || 0,
  404. chapterId: reportdata.chapterId || 0,
  405. goodsId: this.goodsId,
  406. },
  407. });
  408. },
  409. },
  410. };
  411. </script>
  412. <!-- Add "scoped" attribute to limit CSS to this component only -->
  413. <style scoped lang="scss">
  414. .bank-report {
  415. .section {
  416. &__header {
  417. height: 120px;
  418. border-radius: 0px;
  419. padding-top: 10px;
  420. &--warm {
  421. background: #fff3f5;
  422. .title {
  423. text-align: center;
  424. font-size: 18px;
  425. font-family: Microsoft YaHei;
  426. font-weight: bold;
  427. color: #ff3b30;
  428. .icon {
  429. vertical-align: middle;
  430. display: inline-block;
  431. width: 48px;
  432. height: 58px;
  433. text-align: center;
  434. line-height: 58px;
  435. background: #ff3b30;
  436. color: #fff;
  437. font-size: 30px;
  438. }
  439. }
  440. }
  441. &--success {
  442. background: #f8fef9;
  443. .title {
  444. text-align: center;
  445. font-size: 18px;
  446. font-family: Microsoft YaHei;
  447. font-weight: bold;
  448. color: #34c759;
  449. .icon {
  450. vertical-align: middle;
  451. display: inline-block;
  452. width: 48px;
  453. height: 58px;
  454. text-align: center;
  455. line-height: 58px;
  456. background: #34c759;
  457. color: #fff;
  458. font-size: 30px;
  459. }
  460. }
  461. }
  462. .desc {
  463. margin-top: 20px;
  464. text-align: center;
  465. font-size: 14px;
  466. font-family: Microsoft YaHei;
  467. font-weight: 400;
  468. color: #333333;
  469. .note {
  470. font-size: 14px;
  471. font-family: Microsoft YaHei;
  472. font-weight: 400;
  473. color: #999999;
  474. }
  475. }
  476. }
  477. &__body {
  478. width: 100%;
  479. height: 305px;
  480. border-bottom: 1px solid #eee;
  481. &__content {
  482. width: 100%;
  483. height: 100%;
  484. display: flex;
  485. align-items: center;
  486. justify-content: center;
  487. .left-box {
  488. width: 300px;
  489. height: 240px;
  490. background: #ffffff;
  491. border: 1px solid #eeeeee;
  492. border-radius: 8px;
  493. display: flex;
  494. flex-direction: column;
  495. margin: 0 10px;
  496. &__in {
  497. flex: 1;
  498. border-bottom: 1px solid #eee;
  499. padding: 5px 18px;
  500. .title {
  501. font-size: 14px;
  502. font-family: Microsoft YaHei;
  503. font-weight: 400;
  504. color: #333333;
  505. line-height: 24px;
  506. .note {
  507. color: #999;
  508. }
  509. }
  510. .desc {
  511. margin-top: 20px;
  512. font-size: 48px;
  513. font-family: Microsoft YaHei;
  514. font-weight: 400;
  515. color: #333333;
  516. line-height: 24px;
  517. text-align: center;
  518. }
  519. .other {
  520. margin-top: 14px;
  521. font-size: 14px;
  522. font-family: Microsoft YaHei;
  523. font-weight: 400;
  524. color: #999999;
  525. line-height: 24px;
  526. text-align: center;
  527. }
  528. &--bottom {
  529. border: 0;
  530. }
  531. }
  532. }
  533. .right-box {
  534. margin: 0 10px;
  535. display: flex;
  536. width: 300px;
  537. height: 240px;
  538. background: #ffffff;
  539. border: 1px solid #eeeeee;
  540. border-radius: 8px;
  541. flex-direction: column;
  542. &__in {
  543. flex: 1;
  544. border-bottom: 1px solid #eee;
  545. padding: 5px 18px;
  546. .title {
  547. font-size: 14px;
  548. font-family: Microsoft YaHei;
  549. font-weight: 400;
  550. color: #333333;
  551. line-height: 24px;
  552. .note {
  553. color: #999;
  554. }
  555. }
  556. .desc {
  557. margin-top: 20px;
  558. font-size: 48px;
  559. font-family: Microsoft YaHei;
  560. font-weight: 400;
  561. color: #333333;
  562. line-height: 24px;
  563. text-align: center;
  564. }
  565. .other {
  566. margin-top: 14px;
  567. font-size: 14px;
  568. font-family: Microsoft YaHei;
  569. font-weight: 400;
  570. color: #999999;
  571. line-height: 24px;
  572. text-align: center;
  573. }
  574. &--bottom {
  575. padding: 0;
  576. border: 0;
  577. height: 100%;
  578. display: flex;
  579. .child {
  580. flex: 1;
  581. height: 100%;
  582. border-right: 1px solid #eee;
  583. padding: 5px 18px;
  584. &:nth-last-of-type(1) {
  585. border-right: 0;
  586. }
  587. &--right {
  588. border: 0;
  589. }
  590. &__title {
  591. margin-top: 20px;
  592. font-size: 36px;
  593. font-family: Microsoft YaHei;
  594. font-weight: 400;
  595. color: #34c759;
  596. line-height: 24px;
  597. text-align: center;
  598. &--success {
  599. color: #34c759;
  600. }
  601. &--warm {
  602. color: #ff3b30;
  603. }
  604. &--yellow {
  605. color: #ffc53d;
  606. }
  607. }
  608. &__desc {
  609. margin-top: 10px;
  610. font-size: 14px;
  611. font-family: Microsoft YaHei;
  612. font-weight: 400;
  613. color: #999999;
  614. line-height: 24px;
  615. text-align: center;
  616. }
  617. }
  618. }
  619. }
  620. }
  621. }
  622. }
  623. &__footer {
  624. display: flex;
  625. align-items: center;
  626. justify-content: center;
  627. padding: 40px 0;
  628. .btn {
  629. cursor: pointer;
  630. width: 140px;
  631. height: 32px;
  632. padding: 0;
  633. border-radius: 16px;
  634. text-align: center;
  635. line-height: 30px;
  636. font-size: 12px;
  637. margin: 0 4px;
  638. }
  639. }
  640. }
  641. .course_list {
  642. .course {
  643. background: #f5f7fa;
  644. padding-top: 40px;
  645. &__header {
  646. display: flex;
  647. align-items: center;
  648. justify-content: space-between;
  649. .title {
  650. background: url("~@/assets/video.png") no-repeat left center;
  651. padding-left: 36px;
  652. font-size: 24px;
  653. font-family: YouSheBiaoTiHei;
  654. font-weight: 400;
  655. color: #333333;
  656. text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
  657. }
  658. }
  659. &__body {
  660. .list {
  661. width: 100%;
  662. .course-item {
  663. float: left;
  664. }
  665. }
  666. }
  667. }
  668. .pagination {
  669. display: flex;
  670. align-items: center;
  671. justify-content: center;
  672. margin: 20px 0px;
  673. }
  674. }
  675. }
  676. </style>