|
@@ -3,35 +3,39 @@
|
|
|
<section class="section">
|
|
|
<div class="section__body">
|
|
|
<div class="left-box">
|
|
|
- <el-tabs v-model="activeName" @tab-click="goodsBank">
|
|
|
+ <el-tabs v-model="activeName" @tab-click="handelTab">
|
|
|
<el-tab-pane v-for="tab in newList" :key="tab.paperId" :label="tab.paperName" :name="tab.paperId + ''">
|
|
|
<div v-if="tab.paperName == '每日一练'">
|
|
|
- <div class="day-box">
|
|
|
- <div>
|
|
|
- <p>打卡任务</p>
|
|
|
- <p>白金卷每日一练</p>
|
|
|
+ <template v-if="tab.examInfo">
|
|
|
+ <div class="day-box">
|
|
|
+ <div>
|
|
|
+ <p>打卡任务</p>
|
|
|
+ <p>{{ tab.examInfo.examName }}</p>
|
|
|
+ </div>
|
|
|
+ <div>打卡进度超过了{{ tab.examInfo.recordPercentage }}的学员,快来打卡呀~</div>
|
|
|
+ <div @click="handelPunchClock(tab)">{{ tab.examInfo.examRecord ? '完成打卡' : '快来打卡' }}</div>
|
|
|
</div>
|
|
|
- <div>打卡进度超过了85%的学员,快来打卡呀~</div>
|
|
|
- <div>快来打卡</div>
|
|
|
- </div>
|
|
|
- <div class="clock-in-box">
|
|
|
- <p>累计打卡1天</p>
|
|
|
- <el-calendar>
|
|
|
- <template slot="dateCell" slot-scope="{date, data}">
|
|
|
- <p :class="data.isSelected ? 'is-selected' : ''" style="text-align: center;">
|
|
|
- {{ data.day.split('-').slice(2).join('-') }}
|
|
|
- </p>
|
|
|
- <div style="text-align: center;"> {{ data.isSelected ? '✔️' : '✔️' }}</div>
|
|
|
- </template>
|
|
|
- </el-calendar>
|
|
|
- </div>
|
|
|
-
|
|
|
+ <div class="clock-in-box">
|
|
|
+ <p>累计打卡{{ tab.examInfo && tab.examInfo.recordCount }}天</p>
|
|
|
+ <el-calendar>
|
|
|
+ <template slot="dateCell" slot-scope="{date, data}">
|
|
|
+ <p :class="isSelected(data.day) ? 'is-selected' : ''" style="text-align: center;">
|
|
|
+ {{ data.day.split('-').slice(2).join('-') }}
|
|
|
+ </p>
|
|
|
+ <div style="text-align: center;"> {{ isSelected(data.day) ? '✔️' : '' }}</div>
|
|
|
+ </template>
|
|
|
+ </el-calendar>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
<div v-else-if="tab.paperName == '随机练习'">
|
|
|
<div class="day-box">
|
|
|
<p>试卷情况:</p>
|
|
|
- <p>已做/总题:100/1000</p>
|
|
|
- <p>已完成练习10%的题目,加油,希望就在前方~</p>
|
|
|
+ <template v-if="tab.examInfo">
|
|
|
+ <p>已做/总题:{{ tab.examInfo.doNum }}/{{ tab.examInfo.totalNum }}</p>
|
|
|
+ <p>已完成练习{{ (tab.examInfo.doNum / tab.examInfo.totalNum).toFixed(2) }}%的题目,加油,希望就在前方~</p>
|
|
|
+ </template>
|
|
|
+
|
|
|
</div>
|
|
|
<div>
|
|
|
<p>做题数量</p>
|
|
@@ -230,10 +234,8 @@
|
|
|
<el-button v-if="
|
|
|
item.recordStatus == 1 ||
|
|
|
(item.recordStatus == 0 && item.doType == 2)
|
|
|
- " :disabled="
|
|
|
- item.answerNum > 0 &&
|
|
|
- item.doNum >= item.answerNum
|
|
|
-" type="primary" @click="doRepeat(item, 0, 0)" class="btn">重新做题</el-button>
|
|
|
+ " :disabled="item.answerNum > 0 && item.doNum >= item.answerNum" type="primary"
|
|
|
+ @click="doRepeat(item, 0, 0)" class="btn">重新做题</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -258,7 +260,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- newList: [{ paperId: 12, paperName: "每日一练" }, { paperId: 14, paperName: "随机练习" }],
|
|
|
+ newList: [],
|
|
|
examListNew: [],
|
|
|
orderGoodsId: "",
|
|
|
activeName: "0",
|
|
@@ -279,7 +281,8 @@ export default {
|
|
|
needOpen: true, //是否需要打开第一章节
|
|
|
recordItem: null,
|
|
|
numList: [5, 10, 15, 20, 50, 100],
|
|
|
- activeNum: 5
|
|
|
+ activeNum: 5,
|
|
|
+ punchList: []
|
|
|
};
|
|
|
},
|
|
|
mounted() { },
|
|
@@ -308,6 +311,19 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ toFixed(num) {
|
|
|
+ if (num) {
|
|
|
+ let str = String(num).indexOf(".");
|
|
|
+
|
|
|
+ if (str != -1) {
|
|
|
+ return +num.toFixed(2);
|
|
|
+ } else {
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
async initData(data, recordItem) {
|
|
|
this.recordItem = recordItem;
|
|
|
this.orderGoodsId = data.orderGoodsId;
|
|
@@ -474,11 +490,19 @@ export default {
|
|
|
getExamType(id) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$request.exampapergoodsExamPaper(id).then((res) => {
|
|
|
- let data = [{ paperId: 12, paperName: "每日一练" }, { paperId: 14, paperName: "随机练习" }]
|
|
|
- this.newList = [{ paperId: 0, paperName: "全部" }, ...res.data, ...data];
|
|
|
+ this.newList = [{ paperId: 0, paperName: "全部" }, ...res.data];
|
|
|
// if (parseInt(this.activeName) > 0) {
|
|
|
// this.tabChange({ name: this.activeName });
|
|
|
// }
|
|
|
+ // 从结果页返回
|
|
|
+ let examType = this.$route.query.examType
|
|
|
+ if (examType) {
|
|
|
+ let item = this.newList.find(e => e.paperName == ['每日一练', '随机练习'][examType - 1])
|
|
|
+ if (item) {
|
|
|
+ this.activeName = item.paperId + ''
|
|
|
+ this.handelTab()
|
|
|
+ }
|
|
|
+ }
|
|
|
resolve();
|
|
|
});
|
|
|
});
|
|
@@ -509,6 +533,24 @@ export default {
|
|
|
/**
|
|
|
* 获取课程目录
|
|
|
*/
|
|
|
+ handelTab() {
|
|
|
+ let item = this.newList.find(tab => tab.paperId == this.activeName)
|
|
|
+ if (item.paperName == "每日一练") {
|
|
|
+ this.$request.getToDayExam(this.goodsId).then(res => {
|
|
|
+ this.$set(item, 'examInfo', res.data)
|
|
|
+ })
|
|
|
+ this.$request.getPunchRecord({ goodsId: this.goodsId }).then(res => {
|
|
|
+ this.punchList = res.data
|
|
|
+ })
|
|
|
+ return
|
|
|
+ } else if (item.paperName == "随机练习") {
|
|
|
+ this.$request.getRandomExam(this.orderGoodsId).then(res => {
|
|
|
+ this.$set(item, 'examInfo', res.data)
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.goodsBank()
|
|
|
+ },
|
|
|
goodsBank() {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$request
|
|
@@ -648,12 +690,30 @@ export default {
|
|
|
});
|
|
|
this.studyLog(0, moduleId, chapterId, section.examId);
|
|
|
},
|
|
|
-
|
|
|
+ handelPunchClock({ examInfo }) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/bank-exam/" + this.goodsId,
|
|
|
+ query: {
|
|
|
+ examId: examInfo.examId,
|
|
|
+ moduleId: examInfo.moduleExamId,
|
|
|
+ chapterId: examInfo.chapterExamId,
|
|
|
+ orderGoodsId: this.orderGoodsId,
|
|
|
+ examType: 1
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ isSelected(date) {
|
|
|
+ date = new Date(date + ' 00:00:00')
|
|
|
+ let time = date.valueOf() / 1000
|
|
|
+ if (!this.punchList.length) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return this.punchList.some(e => e.recordTime == time)
|
|
|
+ },
|
|
|
/**
|
|
|
* 继续做题
|
|
|
*/
|
|
|
continueDo(section, chapterId, moduleId) {
|
|
|
- console.log(section);
|
|
|
this.$router.push({
|
|
|
path: "/bank-exam-continue/" + this.goodsId,
|
|
|
query: {
|