index.vue 17 KB

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