123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480 |
- <template>
- <div class="bank-record">
- <div class="bank-record__header">
- <div class="title">做题记录</div>
- <div class="content">
- <el-select clearable @change="reGetExamRecordList" v-model="param.goodsId" placeholder="请选择">
- <el-option clearable v-for="item in list" :key="item.goodsId" :label="item.goodsName" :value="item.goodsId">
- </el-option>
- </el-select>
- <el-select @change="reGetExamRecordList" v-model="param.paperId" placeholder="请选择">
- <el-option v-for="item in list1" :key="item.paperId" :label="item.paperName" :value="item.paperId">
- </el-option>
- </el-select>
- </div>
- </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,
- orderGoodsId: record.orderGoodsId,
- })
- " 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 && record.paperName != '随机练习'">
- <div>重新做题</div>
- </div>
- <div class="btn-line__in" @click="
- go('/bank-exam-explain/' + record.goodsId, {
- examId: record.examId,
- chapterId: record.courseType == 2 ? record.chapterId : record.chapterExamId,
- moduleId: record.courseType == 2 ? record.moduleId : record.moduleExamId,
- orderGoodsId: record.orderGoodsId,
- })
- " v-if="record.status == 1">
- <div>解析</div>
- </div>
- <div class="btn-line__in" v-if="record.status == 1" @click="doReport(record)">
- <div>做题报告</div>
- </div>
- <div class="btn-line__in" @click="moreRecords(record)">
- <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 {
- list1: [],
- list: [],
- param: {
- pageNum: 1,
- pageSize: 5,
- goodsId: "",
- paperId: "",
- },
- recordList: [],
- total: 0,
- };
- },
- mounted() {
- this.listGoodsUserQuestion();
- this.examaperList();
- this.getExamRecordList();
- },
- methods: {
- reGetExamRecordList() {
- this.param.pageNum = 1;
- this.getExamRecordList();
- },
- examaperList() {
- this.$request.examaperList().then((res) => {
- this.list1 = res.rows;
- this.list1.unshift({
- paperId: "",
- paperName: "全部试卷类型",
- });
- });
- },
- listGoodsUserQuestion() {
- this.$request.listGoodsUserQuestion().then((res) => {
- this.list = res.rows;
- this.list.unshift({
- goodsId: "",
- goodsName: "全部题库记录",
- });
- });
- },
- go(path, query) {
- this.$router.push({
- path,
- query,
- });
- },
- moreRecords(record) {
- let queryData = {}
- if (record.courseType == 2) {
- queryData = {
- examId: record.examId,
- gradeId: record.gradeId,
- chapterId: record.chapterId,
- moduleId: record.moduleId,
- courseId: record.courseId,
- sectionId: record.sectionId,
- courseType: record.courseType,
- }
- this.$router.push({
- path: '/person-center/record-list/' + record.goodsId,
- query: queryData
- })
- } else {
- queryData = {
- examId: record.examId,
- chapterId: record.chapterExamId,
- moduleId: record.moduleExamId,
- recordId: record.recordId,
- courseType: record.courseType,
- }
- this.$router.push({
- path: '/person-center/record-list/' + record.goodsId,
- query: queryData
- })
- }
- },
- currentChange(e) {
- this.param.pageNum = e;
- this.getExamRecordList();
- },
- getExamRecordList() {
- this.$request.examRecordGroupList(this.param).then((res) => {
- this.recordList = res.rows;
- this.total = res.total;
- });
- },
- async doRepeat(section) {
- console.log('section:', section)
- let count = 0
- if (section.courseType == 2) {
- count = await this.bankRecordDoNum(section)
- } else {
- count = await this.examRecordCount(section.examId)
- }
- console.log('已做的次数', count)
- 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((_) => {
- if (section.courseType == 2) {
- this.$router.push({
- path: "/course-exam/" + section.goodsId,
- query: {
- courseId: section.courseId,
- gradeId: section.gradeId || 0,
- moduleId: section.moduleId || 0,
- sectionId: section.sectionId || 0,
- examId: section.examId,
- type: section.type, // 模块卷类型
- chapterId: section.chapterId || 0,
- orderGoodsId: section.orderGoodsId,
- },
- })
- } else {
- this.$router.push({
- path: "/bank-exam/" + section.goodsId,
- query: {
- orderGoodsId: section.orderGoodsId,
- 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,
- orderGoodsId: section.orderGoodsId,
- courseType: section.courseType,
- },
- });
- });
- },
- /**
- * 获取视频试卷已做的次数
- */
- bankRecordDoNum(section) {
- return new Promise((resolve) => {
- this.$request
- .bankRecordDoNum({
- goodsId: section.goodsId,
- gradeId: section.gradeId,
- chapterId: section.chapterId || 0,
- courseId: section.courseId,
- moduleId: section.moduleId || 0,
- examId: section.examId,
- })
- .then((res) => {
- resolve(res.data);
- });
- });
- },
- /**
- * 查询试卷历史做题次数
- */
- 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);
- });
- });
- },
- doReport(record) {
- console.log('做题报告', record, record.courseType)
- if (record.courseType == 2) {
- this.$router.push({
- path: "/course-report",
- query: {
- examId: record.examId,
- recordId: record.recordId,
- type: record.type, //type:1章卷,2节卷,3模块卷
- },
- })
- } else {
- this.$router.push({
- path: '/bank-report/' + record.goodsId,
- query: {
- chapterId: record.chapterExamId,
- moduleId: record.moduleExamId,
- examId: record.examId,
- recordId: record.recordId,
- orderGoodsId: record.orderGoodsId,
- },
- })
- }
- // go('/bank-report/' + record.goodsId, {
- // chapterId: record.chapterExamId,
- // moduleId: record.moduleExamId,
- // examId: record.examId,
- // recordId: record.recordId,
- // orderGoodsId: record.orderGoodsId,
- // })
- },
- },
- };
- </script>
- <!-- Add "scoped" attribute to limit CSS to this component only -->
- <style scoped lang="scss">
- .bank-record {
- &__header {
- .title {
- height: 56px;
- line-height: 56px;
- }
- .content {
- margin: 10px 0;
- }
- 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>
|