|
@@ -0,0 +1,359 @@
|
|
|
+<template>
|
|
|
+ <div class="bank-record">
|
|
|
+ <div class="bank-record__header">做题记录</div>
|
|
|
+ <div class="bank-record__body">
|
|
|
+ <div class="bank-item" v-for="(record, index) in recordList" :key="index">
|
|
|
+ <div class="bank-item__header">
|
|
|
+ <div class="note" v-if="record.paperName">{{ record.paperName }}</div>
|
|
|
+ {{ record.examName }}
|
|
|
+ </div>
|
|
|
+ <div class="bank-item__body">
|
|
|
+ <div class="list">
|
|
|
+ <div class="exam-item">
|
|
|
+ <div class="exam-item__body">
|
|
|
+ <div class="text">
|
|
|
+ <span class="title">{{
|
|
|
+ $tools.timestampToTime(record.updateTime, false)
|
|
|
+ }}</span>
|
|
|
+ <span class="desc"
|
|
|
+ >总{{ record.totalQuestionNum }}题/对{{
|
|
|
+ record.rightQuestionNum
|
|
|
+ }}题</span
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div class="btns-wrap">
|
|
|
+ <div class="btns">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ class="btn"
|
|
|
+ @click="
|
|
|
+ go('/bank-exam-continue/' + record.goodsId, {
|
|
|
+ recordId: record.recordId,
|
|
|
+ examId: record.examId,
|
|
|
+ chapterId: record.chapterExamId,
|
|
|
+ moduleId: record.moduleExamId,
|
|
|
+ })
|
|
|
+ "
|
|
|
+ v-if="record.status == 0 && record.historyExamJson"
|
|
|
+ >继续答题</el-button
|
|
|
+ >
|
|
|
+
|
|
|
+ <div class="btn-line">
|
|
|
+ <div
|
|
|
+ class="btn-line__in"
|
|
|
+ @click="doRepeat(record)"
|
|
|
+ v-if="record.status == 1"
|
|
|
+ >
|
|
|
+ <div>重新做题</div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="btn-line__in"
|
|
|
+ @click="
|
|
|
+ go('/bank-exam-explain/' + record.goodsId, {
|
|
|
+ examId: record.examId,
|
|
|
+ chapterId: record.chapterExamId,
|
|
|
+ moduleId: record.moduleExamId,
|
|
|
+ })
|
|
|
+ "
|
|
|
+ v-if="record.status == 1"
|
|
|
+ >
|
|
|
+ <div>解析</div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="btn-line__in"
|
|
|
+ v-if="record.status == 1"
|
|
|
+ @click="
|
|
|
+ go('/bank-report/' + record.goodsId, {
|
|
|
+ chapterId: record.chapterExamId,
|
|
|
+ moduleId: record.moduleExamId,
|
|
|
+ examId: record.examId,
|
|
|
+ recordId: record.recordId,
|
|
|
+ })
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <div>做题报告</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="bank-record__footer">
|
|
|
+ <div class="pagination">
|
|
|
+ <el-pagination
|
|
|
+ @current-change="currentChange"
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="total"
|
|
|
+ :pager-count="5"
|
|
|
+ :page-size="param.pageSize"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "BankRecord",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ param: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ moduleExamId: 0,
|
|
|
+ chapterExamId: 0,
|
|
|
+ examId: 0,
|
|
|
+ goodsId: 0,
|
|
|
+ },
|
|
|
+ recordList: [],
|
|
|
+ total: 0,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.param.moduleExamId = this.$route.query.moduleId;
|
|
|
+ this.param.chapterExamId = this.$route.query.chapterId;
|
|
|
+ this.param.examId = this.$route.query.examId;
|
|
|
+ this.param.goodsId = this.$route.params.goodsId;
|
|
|
+ this.examRecordList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ go(path, query) {
|
|
|
+ console.log(path);
|
|
|
+ console.log(query);
|
|
|
+ this.$router.push({
|
|
|
+ path,
|
|
|
+ query,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ currentChange(e) {
|
|
|
+ this.param.pageNum = e;
|
|
|
+ this.getExamRecordList();
|
|
|
+ },
|
|
|
+ examRecordList() {
|
|
|
+ this.$request.examRecordList(this.param).then((res) => {
|
|
|
+ this.recordList = res.rows;
|
|
|
+ this.total = res.total;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ async doRepeat(section) {
|
|
|
+ let count = await this.examRecordCount(section.examId);
|
|
|
+ let answerNum = await this.getExamDetail(section.examId);
|
|
|
+ //超过答题次数
|
|
|
+ if (answerNum > 0 && count >= answerNum) {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "该试卷只能答题" + answerNum + "次!",
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm(`是否清空答案重做?`, "提示", {
|
|
|
+ confirmButtonText: "重做",
|
|
|
+ cancelButtonText: "查看上次",
|
|
|
+ closeOnClickModal: false,
|
|
|
+ closeOnPressEscape: false,
|
|
|
+ distinguishCancelAndClose: false,
|
|
|
+ showClose: false,
|
|
|
+ })
|
|
|
+ .then((_) => {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/bank-exam/" + section.goodsId,
|
|
|
+ query: {
|
|
|
+ examId: section.examId,
|
|
|
+ moduleId: section.moduleExamId || 0,
|
|
|
+ chapterId: section.chapterExamId || 0,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch((_) => {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/bank-exam-all-explain/" + section.recordId,
|
|
|
+ query: {
|
|
|
+ examId: section.examId,
|
|
|
+ moduleId: section.moduleExamId || 0,
|
|
|
+ chapterId: section.chapterExamId || 0,
|
|
|
+ goodsId: section.goodsId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询试卷历史做题次数
|
|
|
+ */
|
|
|
+ examRecordCount(examId) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ this.$request
|
|
|
+ .examRecordCount({
|
|
|
+ examId: examId,
|
|
|
+ goodsId: this.id,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ resolve(res.data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @param {Object} exam_id
|
|
|
+ * 获取试卷可以做的次数
|
|
|
+ */
|
|
|
+ getExamDetail(exam_id) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ this.$request.getExamDetail(exam_id).then((res) => {
|
|
|
+ resolve(res.data.answerNum);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
|
+<style scoped lang="scss">
|
|
|
+.bank-record {
|
|
|
+ &__header {
|
|
|
+ height: 56px;
|
|
|
+ line-height: 56px;
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
+ }
|
|
|
+ &__body {
|
|
|
+ .bank-item {
|
|
|
+ margin-top: 24px;
|
|
|
+
|
|
|
+ &__header {
|
|
|
+ height: 32px;
|
|
|
+ line-height: 32px;
|
|
|
+ .note {
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 15px;
|
|
|
+ width: 80px;
|
|
|
+ height: 32px;
|
|
|
+ line-height: 32px;
|
|
|
+ background: #3f8dfd;
|
|
|
+ text-align: center;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 16px;
|
|
|
+ border-radius: 8px 0 8px 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &__body {
|
|
|
+ .list {
|
|
|
+ .exam-item {
|
|
|
+ height: 65px;
|
|
|
+ background: #fafbfc;
|
|
|
+ border-radius: 8px;
|
|
|
+ overflow: hidden;
|
|
|
+ line-height: 65px;
|
|
|
+ border-top: 1px solid #eee;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ &__body {
|
|
|
+ .text {
|
|
|
+ .title {
|
|
|
+ margin-left: 24px;
|
|
|
+ font-size: 16px;
|
|
|
+ font-family: Microsoft YaHei;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+
|
|
|
+ .desc {
|
|
|
+ margin-left: 24px;
|
|
|
+ color: #666;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btns-wrap {
|
|
|
+ display: table;
|
|
|
+ position: absolute;
|
|
|
+ right: 0;
|
|
|
+ top: 0;
|
|
|
+ height: 100%;
|
|
|
+ margin-right: 20px;
|
|
|
+
|
|
|
+ .btns {
|
|
|
+ display: table-cell;
|
|
|
+ vertical-align: middle;
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ cursor: pointer;
|
|
|
+ width: 122px;
|
|
|
+ height: 32px;
|
|
|
+ padding: 0;
|
|
|
+ border-radius: 16px;
|
|
|
+ display: inline-block;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 32px;
|
|
|
+ vertical-align: middle;
|
|
|
+
|
|
|
+ /deep/ span {
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn-line {
|
|
|
+ margin: 0 10px;
|
|
|
+ overflow: hidden;
|
|
|
+ vertical-align: middle;
|
|
|
+ display: inline-block;
|
|
|
+ background: #ffffff;
|
|
|
+ border: 1px solid #3f8dfd;
|
|
|
+ border-radius: 30px;
|
|
|
+ font-size: 0;
|
|
|
+ line-height: 0;
|
|
|
+
|
|
|
+ &__in {
|
|
|
+ cursor: pointer;
|
|
|
+ display: inline-block;
|
|
|
+ padding: 7px 0;
|
|
|
+ color: #3f8dfd;
|
|
|
+
|
|
|
+ > div {
|
|
|
+ text-align: center;
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 16px;
|
|
|
+ width: 96px;
|
|
|
+ height: 16px;
|
|
|
+ border-right: 1px solid #3f8dfd;
|
|
|
+ }
|
|
|
+
|
|
|
+ &:nth-last-of-type(1) {
|
|
|
+ > div {
|
|
|
+ border: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &:hover {
|
|
|
+ background: #3f8dfd;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &__footer {
|
|
|
+ .pagination {
|
|
|
+ padding: 30px 0;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|