index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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="!reportdata.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="reportdata.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">{{ reportdata.performance }}</div>
  70. <div class="other">满分{{ reportdata.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. {{ reportdata.rightQuestionNum }}
  76. </div>
  77. <div class="child__desc">正确题数</div>
  78. </div>
  79. <div class="child">
  80. <div class="child__title child__title--yellow">
  81. {{ reportdata.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. {{ 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. reportdata: {},
  164. };
  165. },
  166. computed: {
  167. ...mapGetters(["examResult"]),
  168. doWrongQuestionNum() {
  169. let value = this.reportdata.totalQuestionNum - this.reportdata.rightQuestionNum - this.reportdata.lessQuestionNum
  170. return value > 0 ? value : 0
  171. }
  172. },
  173. created() {
  174. const { examId, recordId, type } = this.$route.query
  175. this.examId = examId
  176. this.recordId = recordId
  177. this.type = type
  178. this.getcourList()
  179. this.bankReport()
  180. },
  181. mounted() {
  182. console.log('examResult:', this.examResult)
  183. // if (JSON.stringify(this.examResult) == "{}") {
  184. // this.$router.back(-1);
  185. // }
  186. },
  187. methods: {
  188. getcourList() {
  189. this.$axios({
  190. url: '/apply/recommend/goodsList',
  191. method: 'post',
  192. data: {
  193. examId: this.examId,
  194. pageNum: this.pageNum,
  195. pageSize: this.pageSize,
  196. platform: 2,
  197. }
  198. }).then((res) => {
  199. if (res.code == 200) {
  200. this.courseList = res.rows || []
  201. this.total = res.total
  202. }
  203. })
  204. },
  205. bankReport() {
  206. this.$request.bankReportData(this.recordId).then((res) => {
  207. this.reportdata = res.data
  208. // console.log('reportdata:', this.reportdata)
  209. });
  210. },
  211. currentChangeCou(val) {
  212. this.pageNum = val
  213. this.getcourList()
  214. },
  215. backList() {
  216. this.$router.go(-1)
  217. },
  218. /**
  219. * 去做题
  220. */
  221. async doRepeat(reportdata) {
  222. // /bank/record/doNum
  223. let count = await this.bankRecordDoNum()
  224. console.log('已做的次数', count)
  225. let answerNum = await this.getExamDetail(this.reportdata.examId)
  226. console.log('全部的次数', answerNum)
  227. //超过答题次数
  228. if (answerNum > 0 && count >= answerNum) {
  229. this.$message({
  230. type: "warning",
  231. message: "该试卷只能答题" + answerNum + "次!",
  232. });
  233. return;
  234. }
  235. // answerNum==0没有答题次数限制
  236. if (answerNum == 0 || (answerNum - count > 0 && answerNum > 0)) {
  237. this.$router.push({
  238. path: "/course-exam/" + this.reportdata.goodsId,
  239. query: {
  240. courseId: this.reportdata.courseId,
  241. gradeId: this.reportdata.gradeId || 0,
  242. moduleId: this.reportdata.moduleId || 0,
  243. sectionId: this.reportdata.sectionId || 0,
  244. examId: this.reportdata.examId,
  245. type: this.type,
  246. chapterId: this.reportdata.chapterId || 0,
  247. orderGoodsId: this.reportdata.orderGoodsId,
  248. },
  249. })
  250. }
  251. // this.studyLog()
  252. },
  253. /**
  254. * 获取试卷已做的次数
  255. */
  256. bankRecordDoNum() {
  257. return new Promise((resolve) => {
  258. this.$request
  259. .bankRecordDoNum({
  260. goodsId: this.reportdata.goodsId,
  261. gradeId: this.reportdata.gradeId,
  262. chapterId: this.reportdata.chapterId || 0,
  263. courseId: this.reportdata.courseId,
  264. moduleId: this.reportdata.moduleId || 0,
  265. examId: this.reportdata.examId,
  266. })
  267. .then((res) => {
  268. resolve(res.data);
  269. });
  270. });
  271. },
  272. /**
  273. * @param {Object} exam_id
  274. * 获取试卷可以做的次数
  275. */
  276. getExamDetail(exam_id) {
  277. return new Promise((resolve) => {
  278. this.$request.getExamDetail(exam_id).then((res) => {
  279. resolve(res.data.answerNum);
  280. });
  281. });
  282. },
  283. // 新增用户视频学习日志
  284. studyLog() {
  285. this.$axios({
  286. url: "/user/study/log",
  287. method: "post",
  288. data: {
  289. goodsId: this.reportdata.goodsId,
  290. courseId: this.reportdata.courseId,
  291. moduleId: this.reportdata.moduleId || 0,
  292. chapterId: this.reportdata.chapterId || 0,
  293. sectionId: this.reportdata.sectionId || 0,
  294. fromPlat: 2, //来源平台 1小程序 2PC网站
  295. goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  296. orderGoodsId: this.reportdata.orderGoodsId,
  297. },
  298. }).then((res) => {
  299. });
  300. },
  301. wrongExplain(reportdata) {
  302. this.$router.push({
  303. path: "/bank-exam-wrong-explain/" + reportdata.recordId,
  304. query: {
  305. examId: reportdata.examId,
  306. moduleId: reportdata.moduleId || 0,
  307. chapterId: reportdata.chapterId || 0,
  308. goodsId: reportdata.goodsId,
  309. orderGoodsId: reportdata.orderGoodsId,
  310. courseType: 2,
  311. },
  312. });
  313. },
  314. allExplain(reportdata) {
  315. this.$router.push({
  316. path: "/bank-exam-all-explain/" + reportdata.recordId,
  317. query: {
  318. examId: reportdata.examId,
  319. moduleId: reportdata.moduleId || 0,
  320. chapterId: reportdata.chapterId || 0,
  321. goodsId: reportdata.goodsId,
  322. courseType: 2,
  323. },
  324. });
  325. },
  326. },
  327. };
  328. </script>
  329. <!-- Add "scoped" attribute to limit CSS to this component only -->
  330. <style scoped lang="scss">
  331. .bank-report {
  332. .re_back {
  333. text-align: right;
  334. margin: 10px 0px;
  335. .back-btn {
  336. width: 100px;
  337. }
  338. }
  339. .section {
  340. &__header {
  341. height: 120px;
  342. border-radius: 0px;
  343. padding-top: 10px;
  344. &--warm {
  345. background: #fff3f5;
  346. .title {
  347. text-align: center;
  348. font-size: 18px;
  349. font-family: Microsoft YaHei;
  350. font-weight: bold;
  351. color: #ff3b30;
  352. .icon {
  353. vertical-align: middle;
  354. display: inline-block;
  355. width: 48px;
  356. height: 58px;
  357. text-align: center;
  358. line-height: 58px;
  359. background: #ff3b30;
  360. color: #fff;
  361. font-size: 30px;
  362. }
  363. }
  364. }
  365. &--success {
  366. background: #f8fef9;
  367. .title {
  368. text-align: center;
  369. font-size: 18px;
  370. font-family: Microsoft YaHei;
  371. font-weight: bold;
  372. color: #34c759;
  373. .icon {
  374. vertical-align: middle;
  375. display: inline-block;
  376. width: 48px;
  377. height: 58px;
  378. text-align: center;
  379. line-height: 58px;
  380. background: #34c759;
  381. color: #fff;
  382. font-size: 30px;
  383. }
  384. }
  385. }
  386. .desc {
  387. margin-top: 20px;
  388. text-align: center;
  389. font-size: 14px;
  390. font-family: Microsoft YaHei;
  391. font-weight: 400;
  392. color: #333333;
  393. .note {
  394. font-size: 14px;
  395. font-family: Microsoft YaHei;
  396. font-weight: 400;
  397. color: #999999;
  398. }
  399. }
  400. }
  401. &__body {
  402. width: 100%;
  403. height: 305px;
  404. border-bottom: 1px solid #eee;
  405. &__content {
  406. width: 100%;
  407. height: 100%;
  408. display: flex;
  409. align-items: center;
  410. justify-content: center;
  411. .left-box {
  412. width: 300px;
  413. height: 240px;
  414. background: #ffffff;
  415. border: 1px solid #eeeeee;
  416. border-radius: 8px;
  417. display: flex;
  418. flex-direction: column;
  419. margin: 0 10px;
  420. &__in {
  421. flex: 1;
  422. border-bottom: 1px solid #eee;
  423. padding: 5px 18px;
  424. .title {
  425. font-size: 14px;
  426. font-family: Microsoft YaHei;
  427. font-weight: 400;
  428. color: #333333;
  429. line-height: 24px;
  430. .note {
  431. color: #999;
  432. }
  433. }
  434. .desc {
  435. margin-top: 20px;
  436. font-size: 48px;
  437. font-family: Microsoft YaHei;
  438. font-weight: 400;
  439. color: #333333;
  440. line-height: 24px;
  441. text-align: center;
  442. }
  443. .other {
  444. margin-top: 14px;
  445. font-size: 14px;
  446. font-family: Microsoft YaHei;
  447. font-weight: 400;
  448. color: #999999;
  449. line-height: 24px;
  450. text-align: center;
  451. }
  452. &--bottom {
  453. border: 0;
  454. }
  455. }
  456. }
  457. .right-box {
  458. margin: 0 10px;
  459. display: flex;
  460. width: 300px;
  461. height: 240px;
  462. background: #ffffff;
  463. border: 1px solid #eeeeee;
  464. border-radius: 8px;
  465. flex-direction: column;
  466. &__in {
  467. flex: 1;
  468. border-bottom: 1px solid #eee;
  469. padding: 5px 18px;
  470. .title {
  471. font-size: 14px;
  472. font-family: Microsoft YaHei;
  473. font-weight: 400;
  474. color: #333333;
  475. line-height: 24px;
  476. .note {
  477. color: #999;
  478. }
  479. }
  480. .desc {
  481. margin-top: 20px;
  482. font-size: 48px;
  483. font-family: Microsoft YaHei;
  484. font-weight: 400;
  485. color: #333333;
  486. line-height: 24px;
  487. text-align: center;
  488. }
  489. .other {
  490. margin-top: 14px;
  491. font-size: 14px;
  492. font-family: Microsoft YaHei;
  493. font-weight: 400;
  494. color: #999999;
  495. line-height: 24px;
  496. text-align: center;
  497. }
  498. &--bottom {
  499. padding: 0;
  500. border: 0;
  501. height: 100%;
  502. display: flex;
  503. .child {
  504. flex: 1;
  505. height: 100%;
  506. border-right: 1px solid #eee;
  507. padding: 5px 18px;
  508. &--right {
  509. border: 0;
  510. }
  511. &__title {
  512. margin-top: 20px;
  513. font-size: 36px;
  514. font-family: Microsoft YaHei;
  515. font-weight: 400;
  516. color: #34c759;
  517. line-height: 24px;
  518. text-align: center;
  519. &--success {
  520. color: #34c759;
  521. }
  522. &--warm {
  523. color: #ff3b30;
  524. }
  525. &--yellow {
  526. color: #ffc53d;
  527. }
  528. }
  529. &__desc {
  530. margin-top: 10px;
  531. font-size: 14px;
  532. font-family: Microsoft YaHei;
  533. font-weight: 400;
  534. color: #999999;
  535. line-height: 24px;
  536. text-align: center;
  537. }
  538. }
  539. }
  540. }
  541. }
  542. }
  543. }
  544. &__footer {
  545. display: flex;
  546. align-items: center;
  547. justify-content: center;
  548. padding: 40px 0;
  549. .btn {
  550. cursor: pointer;
  551. width: 140px;
  552. height: 32px;
  553. padding: 0;
  554. border-radius: 16px;
  555. text-align: center;
  556. line-height: 30px;
  557. font-size: 12px;
  558. margin: 0 4px;
  559. }
  560. }
  561. }
  562. .course_list {
  563. .course {
  564. background: #f5f7fa;
  565. padding-top: 40px;
  566. &__header {
  567. display: flex;
  568. align-items: center;
  569. justify-content: space-between;
  570. .title {
  571. background: url("~@/assets/video.png") no-repeat left center;
  572. padding-left: 36px;
  573. font-size: 24px;
  574. font-family: YouSheBiaoTiHei;
  575. font-weight: 400;
  576. color: #333333;
  577. text-shadow: 0px 6px 6px rgba(249, 113, 13, 0.08);
  578. }
  579. }
  580. &__body {
  581. .list {
  582. width: 100%;
  583. .course-item {
  584. float: left;
  585. }
  586. }
  587. }
  588. }
  589. .pagination {
  590. display: flex;
  591. align-items: center;
  592. justify-content: center;
  593. margin: 20px 0px;
  594. }
  595. }
  596. }
  597. </style>