|
@@ -0,0 +1,366 @@
|
|
|
+<template>
|
|
|
+ <view>
|
|
|
+ <nav-bar title="做题记录" class="nav"></nav-bar>
|
|
|
+
|
|
|
+ <view class="record">
|
|
|
+ <view class="item" v-for="(record,index) in recordList" :key="index">
|
|
|
+ <view class="note">{{ record.paperName }}</view>
|
|
|
+ <view class="title">{{ record.examName }}</view>
|
|
|
+ <view class="desc">
|
|
|
+ <view>
|
|
|
+ <image src="/static/icon/wk_icon2.png"></image>
|
|
|
+ <text>{{ $method.timestampToTime(record.updateTime, false) }}</text>
|
|
|
+ </view>
|
|
|
+ <view>
|
|
|
+ <image src="/static/icon/wk_icon2.png"></image>
|
|
|
+ <text>总共 {{ record.totalQuestionNum }} 题 做对 {{ record.rightQuestionNum }} 题</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="btns">
|
|
|
+ <view class="btn" v-if="record.status == 1" @click="doRepeat(record.examId, record.goodsId, record.moduleExamId, record.chapterExamId,index)">重做</view>
|
|
|
+ <view class="btn" @click="questionBankExplain(record)" v-if="record.status == 1">解析</view>
|
|
|
+ <view class="btn" @click="questionReport(record)" v-if="record.status == 1">报告</view>
|
|
|
+ <view class="btn continue" @click="doContinue(record,index)" v-if="record.status == 0 && record.historyExamJson">继续答题</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ index: 0,
|
|
|
+ list: [],
|
|
|
+ list1: [],
|
|
|
+ recordList: [],
|
|
|
+ goodsData: {},
|
|
|
+ param: {
|
|
|
+ moduleExamId:0,
|
|
|
+ chapterId:0,
|
|
|
+ examId:0,
|
|
|
+ goodsId:0,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
+ isRepeat:false,
|
|
|
+ total: 0,
|
|
|
+ activeIndex: 0,
|
|
|
+ typeIndex:0,
|
|
|
+ itemIndex:'',
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+
|
|
|
+ this.param.moduleExamId = option.moduleId,
|
|
|
+ this.param.chapterExamId = option.chapterId,
|
|
|
+ this.param.examId = option.examId,
|
|
|
+ this.param.goodsId = option.goodsId,
|
|
|
+ this.getExamRecordList();
|
|
|
+ },
|
|
|
+ onPullDownRefresh() {
|
|
|
+ let that = this;
|
|
|
+ this.param = {
|
|
|
+ moduleExamId:this.param.moduleId,
|
|
|
+ chapterExamId:this.param.chapterId,
|
|
|
+ examId:this.param.examId,
|
|
|
+ goodsId:this.param.goodsId,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ };
|
|
|
+ this.getExamRecordList();
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ }, 500);
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ if (this.recordList.length < this.total) {
|
|
|
+ this.param.pageNum++;
|
|
|
+ this.getExamRecordList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ if(this.isRepeat) {
|
|
|
+ this.addRecord();
|
|
|
+ } else {
|
|
|
+ if(this.itemIndex !== '') {
|
|
|
+ this.refreshByIndex();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ questionBankExplain(record) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pages2/bank/questionBankExplain?id='+record.examId +'&goodsid='+record.goodsId+'&moduleId='+record.moduleExamId+'&chapterId='+record.chapterExamId
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ questionReport(record) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pages2/bank/question_report?goodsId='+record.goodsId+'&chapterId='+record.chapterExamId+'&moduleId='+record.moduleExamId+'&examId='+record.examId+'&id=' + record.recordId
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addRecord() {
|
|
|
+ this.$api.examRecordList({
|
|
|
+ moduleExamId:this.param.moduleId,
|
|
|
+ chapterExamId:this.param.chapterId,
|
|
|
+ examId:this.param.examId,
|
|
|
+ goodsId:this.param.goodsId,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1
|
|
|
+ }).then(res => {
|
|
|
+ this.recordList.unshift(res.data.rows[0])
|
|
|
+ });
|
|
|
+ this.isRepeat = false;
|
|
|
+ },
|
|
|
+ refreshByIndex() {
|
|
|
+ this.$api.examRecordGroupList({
|
|
|
+ moduleExamId:this.param.moduleId,
|
|
|
+ chapterExamId:this.param.chapterId,
|
|
|
+ examId:this.param.examId,
|
|
|
+ goodsId:this.param.goodsId,
|
|
|
+ pageNum: this.itemIndex+1,
|
|
|
+ pageSize: 1
|
|
|
+ }).then(res => {
|
|
|
+ this.$set(this.recordList,this.itemIndex,res.data.rows[0])
|
|
|
+ this.itemIndex = ''
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getExamRecordList() {
|
|
|
+ if (this.param.pageNum == 1) {
|
|
|
+ this.recordList = [];
|
|
|
+ }
|
|
|
+ this.$api.examRecordList(this.param).then(res => {
|
|
|
+ this.recordList.push.apply(this.recordList, res.data.rows);
|
|
|
+ this.total = res.data.total;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 继续做题
|
|
|
+ */
|
|
|
+ doContinue(record,index) {
|
|
|
+ this.itemIndex = index;
|
|
|
+ this.isRepeat = false;
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pages2/bank/questionBankContinue?recordId=' +
|
|
|
+ record.recordId +
|
|
|
+ '&id=' +
|
|
|
+ record.examId +
|
|
|
+ '&goodsid=' +
|
|
|
+ record.goodsId +
|
|
|
+ '&moduleId=' +
|
|
|
+ record.moduleExamId +
|
|
|
+ '&chapterId=' +
|
|
|
+ record.chapterExamId
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 去做题
|
|
|
+ */
|
|
|
+ async doRepeat(id, goodsId, moduleId = 0, chapterId = 0,index) {
|
|
|
+ // await this.getDetail(goodsId);
|
|
|
+ this.itemIndex = '';
|
|
|
+ this.isRepeat = true;
|
|
|
+ let count = await this.examRecordCount(id,goodsId);
|
|
|
+ let answerNum = await this.getExamDetail(id);
|
|
|
+ //超过答题次数
|
|
|
+ if (answerNum > 0 && count >= answerNum) {
|
|
|
+ this.$u.toast('该试卷只能答题' + answerNum + '次!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages2/bank/questionBank?id=' + id + '&goodsid=' + goodsId + '&moduleId=' + moduleId + '&chapterId=' + chapterId + ''
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @param {Object} exam_id
|
|
|
+ * 获取试卷可以做的次数
|
|
|
+ */
|
|
|
+ getExamDetail(exam_id) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.$api.getExamDetail(exam_id).then(res => {
|
|
|
+ resolve(res.data.data.answerNum);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 查询试卷历史做题次数
|
|
|
+ */
|
|
|
+ examRecordCount(examId,goodsId) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.$api
|
|
|
+ .examRecordCount({
|
|
|
+ examId: examId,
|
|
|
+ goodsId: goodsId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ resolve(res.data.data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ getDetail(id) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.$api.goodsDetail(id).then(res => {
|
|
|
+ this.goodsData = res.data.data;
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+page {
|
|
|
+ background: #eaeef1;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang="scss" scope>
|
|
|
+ .animals{
|
|
|
+ transition: all 0.3s;
|
|
|
+ transform: rotate(180deg);
|
|
|
+ }
|
|
|
+
|
|
|
+.record {
|
|
|
+ padding: 16rpx 8rpx;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ .item {
|
|
|
+ margin-bottom: 16rpx;
|
|
|
+ width:359rpx;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ padding: 65rpx 20rpx 22rpx;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ &:nth-of-type(2n) {
|
|
|
+ margin-left:16rpx;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ .note {
|
|
|
+ color: #fff;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ // width: 112rpx;
|
|
|
+ padding: 0rpx 10rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 40rpx;
|
|
|
+ background: linear-gradient(180deg, #4facfe, #007aff);
|
|
|
+ border-radius: 16rpx 0px 16rpx 0rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 32rpx;
|
|
|
+ color: #333333;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ .desc {
|
|
|
+ margin-top: 26rpx;
|
|
|
+ view {
|
|
|
+ margin: 16rpx 0;
|
|
|
+
|
|
|
+ image {
|
|
|
+ width: 23rpx;
|
|
|
+ height: 24rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ text {
|
|
|
+ margin-left: 15rpx;
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #999999;
|
|
|
+ line-height: 36rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btns {
|
|
|
+ margin-top: 26rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ .btn {
|
|
|
+ flex:1;
|
|
|
+ margin:0 5rpx;
|
|
|
+ height: 48rpx;
|
|
|
+ line-height: 48rpx;
|
|
|
+ text-align: center;
|
|
|
+ color: #007aff;
|
|
|
+ background: #ffffff;
|
|
|
+ border: 1rpx solid #007aff;
|
|
|
+ border-radius: 16rpx;
|
|
|
+
|
|
|
+ &.continue {
|
|
|
+ width:317rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.modal {
|
|
|
+ bottom:0;
|
|
|
+ z-index: 199999999;
|
|
|
+ position: fixed;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ .content {
|
|
|
+ position: relative;
|
|
|
+ z-index: 10;
|
|
|
+ background: #fff;
|
|
|
+ padding: 8rpx 12rpx 20rpx;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+
|
|
|
+ .top {
|
|
|
+ margin: 0 auto;
|
|
|
+ width: 726rpx;
|
|
|
+ height: 80rpx;
|
|
|
+ background: #f5f5f5;
|
|
|
+ color: #666666;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 80rpx;
|
|
|
+ font-size: 32rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .list {
|
|
|
+ width:100%;
|
|
|
+ margin-top: 16rpx;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ .item {
|
|
|
+ padding: 25rpx 20rpx;
|
|
|
+ width: 49%;
|
|
|
+ background: #f5f5f5;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ font-size: 32rpx;
|
|
|
+ color: #666666;
|
|
|
+ margin: 8rpx 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .modal_wrap {
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ top: 0;
|
|
|
+ height: 100%;
|
|
|
+ background: rgba(0, 0, 0, 0.3);
|
|
|
+ }
|
|
|
+}
|
|
|
+.activesty {
|
|
|
+ background: #007aff !important;
|
|
|
+ color: #fff !important;
|
|
|
+}
|
|
|
+</style>
|