index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  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. 答题时长:{{ reportdata.doTime }}分钟
  16. <span class="note">(限时{{ reportdata.examTime }}分钟)</span>
  17. </div>
  18. </div>
  19. <div
  20. class="section__header section__header--success"
  21. v-if="examData.doType == 2 && reportdata.reportStatus !== null"
  22. >
  23. <div class="title">
  24. <span class="icon">✔</span>
  25. 测试通过
  26. </div>
  27. <div class="desc" v-if="reportdata.doTime">
  28. 答题时长:{{ reportdata.doTime }}分钟
  29. <span class="note">(限时{{ reportdata.examTime }}分钟)</span>
  30. </div>
  31. </div>
  32. <div class="section__body">
  33. <div class="section__body__content">
  34. <div class="left-box">
  35. <div class="left-box__in">
  36. <div class="title">
  37. 试卷得分
  38. <span class="note">(客观题)</span>
  39. </div>
  40. <div class="desc">{{ reportdata.performance }}</div>
  41. <div class="other">满分{{ reportdata.totalScore }}</div>
  42. </div>
  43. <div class="left-box__in left-box__in--bottom">
  44. <div class="title">
  45. 试卷得分
  46. <span class="note">(客观题+主观题)</span>
  47. </div>
  48. <div class="desc">
  49. {{ reportdata.performance + reportdata.score }}
  50. </div>
  51. <div class="other">满分{{ reportdata.totalScore }}</div>
  52. </div>
  53. </div>
  54. <div class="right-box">
  55. <div class="right-box__in">
  56. <div class="title">
  57. 试卷得分
  58. <span class="note">(客观题)</span>
  59. </div>
  60. <div class="desc">{{ reportdata.performance }}</div>
  61. <div class="other">满分{{ reportdata.totalScore }}</div>
  62. </div>
  63. <div class="right-box__in right-box__in--bottom">
  64. <div class="child">
  65. <div class="child__title child__title--success">
  66. {{ reportdata.rightQuestionNum }}
  67. </div>
  68. <div class="child__desc">正确题数</div>
  69. </div>
  70. <div class="child child---right">
  71. <div class="child__title child__title--warm">
  72. {{ wrongRecordWrongNum }}
  73. </div>
  74. <div class="child__desc">错误题数</div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="section__footer">
  81. <el-button type="primary" @click="back" class="btn"
  82. >返回列表</el-button
  83. >
  84. <el-button
  85. type="primary"
  86. class="btn"
  87. v-if="nextExamId"
  88. @click="backBank"
  89. >练习下一节</el-button
  90. >
  91. <el-button type="primary" class="btn" @click="doRepeat(reportdata)"
  92. >重新做题</el-button
  93. >
  94. <el-button
  95. type="primary"
  96. class="btn"
  97. @click="wrongExplain(reportdata)"
  98. >错题解析</el-button
  99. >
  100. <el-button type="primary" class="btn" @click="allExplain(reportdata)"
  101. >全部解析</el-button
  102. >
  103. </div>
  104. </div>
  105. </section>
  106. <ToolBar></ToolBar>
  107. <Footer></Footer>
  108. </div>
  109. </template>
  110. <script>
  111. import Footer from "@/components/footer/index";
  112. import Header from "@/components/header/index";
  113. import ToolBar from "@/components/toolbar/index";
  114. import { mapGetters } from "vuex";
  115. export default {
  116. name: "BankExplain",
  117. components: {
  118. Footer,
  119. Header,
  120. ToolBar,
  121. },
  122. data() {
  123. return {
  124. wrongRecordWrongNum: 0,
  125. nextExamId: "",
  126. examData: {},
  127. reportdata: {},
  128. goodsId: 0,
  129. chapterId: 0,
  130. moduleId: 0,
  131. examId: 0,
  132. recordId: 0,
  133. };
  134. },
  135. computed: {
  136. ...mapGetters(["examResult"]),
  137. },
  138. async mounted() {
  139. this.chapterId = this.$route.query.chapterId;
  140. this.moduleId = this.$route.query.moduleId;
  141. this.examId = this.$route.query.examId;
  142. this.recordId = this.$route.query.recordId;
  143. this.goodsId = this.$route.params.goodsId;
  144. this.examWrongRecordWrongNum();
  145. this.bankExamNextExam();
  146. await this.bankExam();
  147. await this.examReport();
  148. },
  149. methods: {
  150. back() {
  151. this.$router.replace({
  152. path: "/person-center/my-bank/bank-detail/" + this.goodsId,
  153. });
  154. },
  155. /**
  156. * 去做题
  157. */
  158. async doRepeat(reportdata) {
  159. // await this.getDetail(reportdata.goodsId);
  160. let count = await this.examRecordCount(
  161. reportdata.examId,
  162. reportdata.goodsId
  163. );
  164. let answerNum = await this.getExamDetail(reportdata.examId);
  165. //超过答题次数
  166. if (answerNum > 0 && count >= answerNum) {
  167. this.$message({
  168. type: "warning",
  169. message: "该试卷只能答题" + answerNum + "次!",
  170. });
  171. return;
  172. }
  173. this.$router.replace({
  174. path: "/bank-exam/" + reportdata.goodsId,
  175. query: {
  176. examId: reportdata.examId,
  177. moduleId: reportdata.moduleId || 0,
  178. chapterId: reportdata.chapterId || 0,
  179. },
  180. });
  181. },
  182. /**
  183. * @param {Object} exam_id
  184. * 获取试卷可以做的次数
  185. */
  186. getExamDetail(exam_id) {
  187. return new Promise((resolve) => {
  188. this.$request.getExamDetail(exam_id).then((res) => {
  189. resolve(res.data.answerNum);
  190. });
  191. });
  192. },
  193. /**
  194. * 查询试卷历史做题次数
  195. */
  196. examRecordCount(examId, goodsId) {
  197. return new Promise((resolve) => {
  198. this.$request
  199. .examRecordCount({
  200. examId: examId,
  201. goodsId: goodsId,
  202. })
  203. .then((res) => {
  204. resolve(res.data);
  205. });
  206. });
  207. },
  208. getDetail(goodsId) {
  209. return new Promise((resolve) => {
  210. this.$request.goodsDetail(goodsId).then((res) => {
  211. this.goodsData = res.data;
  212. resolve();
  213. });
  214. });
  215. },
  216. examWrongRecordWrongNum() {
  217. return new Promise((resolve) => {
  218. this.$request.examWrongRecordWrongNum(this.recordId).then((res) => {
  219. this.wrongRecordWrongNum = res.data || 0;
  220. resolve();
  221. });
  222. });
  223. },
  224. backBank() {
  225. this.$router.replace({
  226. path: "/bank-exam/" + this.nextExamId,
  227. query: {
  228. examId: this.examId,
  229. moduleId: this.moduleId || 0,
  230. chapterId: this.chapterId || 0,
  231. },
  232. });
  233. },
  234. bankExamNextExam() {
  235. this.$request
  236. .bankExamNextExam({
  237. chapterExamId: this.chapterId,
  238. examId: this.examId,
  239. goodsId: this.goodsId,
  240. moduleExamId: this.moduleId,
  241. })
  242. .then((res) => {
  243. this.nextExamId = res.data.examId;
  244. })
  245. .catch((err) => {
  246. this.nextExamId = "";
  247. });
  248. },
  249. bankExam() {
  250. return new Promise((resolve) => {
  251. this.$request.bankExam(this.examId).then((res) => {
  252. this.examData = res.data;
  253. resolve();
  254. });
  255. });
  256. },
  257. examReport() {
  258. return new Promise((resolve) => {
  259. this.$request.examReport(this.recordId).then((res) => {
  260. this.reportdata = res.data;
  261. resolve();
  262. });
  263. });
  264. },
  265. wrongExplain(reportdata) {
  266. this.$router.push({
  267. path: "/bank-exam-wrong-explain/" + reportdata.recordId,
  268. query: {
  269. examId: reportdata.examId,
  270. moduleId: reportdata.moduleId || 0,
  271. chapterId: reportdata.chapterId || 0,
  272. goodsId: this.goodsId,
  273. },
  274. });
  275. },
  276. allExplain(reportdata) {
  277. this.$router.push({
  278. path: "/bank-exam-all-explain/" + reportdata.recordId,
  279. query: {
  280. examId: reportdata.examId,
  281. moduleId: reportdata.moduleId || 0,
  282. chapterId: reportdata.chapterId || 0,
  283. goodsId: this.goodsId,
  284. },
  285. });
  286. },
  287. },
  288. };
  289. </script>
  290. <!-- Add "scoped" attribute to limit CSS to this component only -->
  291. <style scoped lang="scss">
  292. .bank-report {
  293. .section {
  294. &__header {
  295. height: 120px;
  296. border-radius: 0px;
  297. padding-top: 10px;
  298. &--warm {
  299. background: #fff3f5;
  300. .title {
  301. text-align: center;
  302. font-size: 18px;
  303. font-family: Microsoft YaHei;
  304. font-weight: bold;
  305. color: #ff3b30;
  306. .icon {
  307. vertical-align: middle;
  308. display: inline-block;
  309. width: 48px;
  310. height: 58px;
  311. text-align: center;
  312. line-height: 58px;
  313. background: #ff3b30;
  314. color: #fff;
  315. font-size: 30px;
  316. }
  317. }
  318. }
  319. &--success {
  320. background: #f8fef9;
  321. .title {
  322. text-align: center;
  323. font-size: 18px;
  324. font-family: Microsoft YaHei;
  325. font-weight: bold;
  326. color: #34c759;
  327. .icon {
  328. vertical-align: middle;
  329. display: inline-block;
  330. width: 48px;
  331. height: 58px;
  332. text-align: center;
  333. line-height: 58px;
  334. background: #34c759;
  335. color: #fff;
  336. font-size: 30px;
  337. }
  338. }
  339. }
  340. .desc {
  341. margin-top: 20px;
  342. text-align: center;
  343. font-size: 14px;
  344. font-family: Microsoft YaHei;
  345. font-weight: 400;
  346. color: #333333;
  347. .note {
  348. font-size: 14px;
  349. font-family: Microsoft YaHei;
  350. font-weight: 400;
  351. color: #999999;
  352. }
  353. }
  354. }
  355. &__body {
  356. width: 100%;
  357. height: 305px;
  358. border-bottom: 1px solid #eee;
  359. &__content {
  360. width: 100%;
  361. height: 100%;
  362. display: flex;
  363. align-items: center;
  364. justify-content: center;
  365. .left-box {
  366. width: 300px;
  367. height: 240px;
  368. background: #ffffff;
  369. border: 1px solid #eeeeee;
  370. border-radius: 8px;
  371. display: flex;
  372. flex-direction: column;
  373. margin: 0 10px;
  374. &__in {
  375. flex: 1;
  376. border-bottom: 1px solid #eee;
  377. padding: 5px 18px;
  378. .title {
  379. font-size: 14px;
  380. font-family: Microsoft YaHei;
  381. font-weight: 400;
  382. color: #333333;
  383. line-height: 24px;
  384. .note {
  385. color: #999;
  386. }
  387. }
  388. .desc {
  389. margin-top: 20px;
  390. font-size: 48px;
  391. font-family: Microsoft YaHei;
  392. font-weight: 400;
  393. color: #333333;
  394. line-height: 24px;
  395. text-align: center;
  396. }
  397. .other {
  398. margin-top: 14px;
  399. font-size: 14px;
  400. font-family: Microsoft YaHei;
  401. font-weight: 400;
  402. color: #999999;
  403. line-height: 24px;
  404. text-align: center;
  405. }
  406. &--bottom {
  407. border: 0;
  408. }
  409. }
  410. }
  411. .right-box {
  412. margin: 0 10px;
  413. display: flex;
  414. width: 300px;
  415. height: 240px;
  416. background: #ffffff;
  417. border: 1px solid #eeeeee;
  418. border-radius: 8px;
  419. flex-direction: column;
  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. padding: 0;
  454. border: 0;
  455. height: 100%;
  456. display: flex;
  457. .child {
  458. flex: 1;
  459. height: 100%;
  460. border-right: 1px solid #eee;
  461. padding: 5px 18px;
  462. &--right {
  463. border: 0;
  464. }
  465. &__title {
  466. margin-top: 20px;
  467. font-size: 36px;
  468. font-family: Microsoft YaHei;
  469. font-weight: 400;
  470. color: #34c759;
  471. line-height: 24px;
  472. text-align: center;
  473. &--success {
  474. color: #34c759;
  475. }
  476. &--warm {
  477. color: #ff3b30;
  478. }
  479. }
  480. &__desc {
  481. margin-top: 10px;
  482. font-size: 14px;
  483. font-family: Microsoft YaHei;
  484. font-weight: 400;
  485. color: #999999;
  486. line-height: 24px;
  487. text-align: center;
  488. }
  489. }
  490. }
  491. }
  492. }
  493. }
  494. }
  495. &__footer {
  496. display: flex;
  497. align-items: center;
  498. justify-content: center;
  499. padding: 40px 0;
  500. .btn {
  501. cursor: pointer;
  502. width: 140px;
  503. height: 32px;
  504. padding: 0;
  505. border-radius: 16px;
  506. text-align: center;
  507. line-height: 30px;
  508. font-size: 12px;
  509. margin: 0 4px;
  510. }
  511. }
  512. }
  513. }
  514. </style>