|
@@ -5,6 +5,7 @@
|
|
|
<tr class="list-header qm-primary-strong-text">
|
|
|
<td>课程</td>
|
|
|
<td>考试进入时间</td>
|
|
|
+ <td>考试时间周期</td>
|
|
|
<td>练习次数</td>
|
|
|
<td>最近正确率</td>
|
|
|
<td>平均正确率</td>
|
|
@@ -19,6 +20,9 @@
|
|
|
~ <br />
|
|
|
{{ course.endTime }}
|
|
|
</td>
|
|
|
+ <td>
|
|
|
+ <span v-html="cycleDesc(course)" />
|
|
|
+ </td>
|
|
|
<td>{{ course.practiceCount }}</td>
|
|
|
<td>{{ course.recentObjectiveAccuracy }}%</td>
|
|
|
<td>{{ course.aveObjectiveAccuracy }}%</td>
|
|
@@ -33,7 +37,8 @@
|
|
|
>
|
|
|
<i-button
|
|
|
class="qm-primary-button qm-primary-button-padding-fix"
|
|
|
- :disabled="!courseInBetween(course)"
|
|
|
+ :disabled="disableTheCourse(course) || enterButtonClicked"
|
|
|
+ :title="disableTheCourse(course) ? disableReason(course) : ''"
|
|
|
@click="enterPractice(course)"
|
|
|
>
|
|
|
进入练习
|
|
@@ -69,7 +74,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
|
- return { now: new Date(), selectedCourse: null };
|
|
|
+ return { now: new Date(), selectedCourse: null, enterButtonClicked: false };
|
|
|
},
|
|
|
computed: {
|
|
|
...globalMapState(["user", "timeDifference"]),
|
|
@@ -83,6 +88,26 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations(["toggleFaceCheckModal"]),
|
|
|
+ cycleDesc(course) {
|
|
|
+ if (!course.examCycleEnabled) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ const weekdayNames = {
|
|
|
+ 1: "一",
|
|
|
+ 2: "二",
|
|
|
+ 3: "三",
|
|
|
+ 4: "四",
|
|
|
+ 5: "五",
|
|
|
+ 6: "六",
|
|
|
+ 7: "日",
|
|
|
+ };
|
|
|
+ const weekDesc = course.examCycleWeek.map((v) => "周" + weekdayNames[v]);
|
|
|
+ const timeRangeDesc = course.examCycleTimeRange
|
|
|
+ .map((v) => v.timeRange)
|
|
|
+ .map((v) => v[0] + "~" + v[1])
|
|
|
+ .join("<br>");
|
|
|
+ return weekDesc + "<br>" + timeRangeDesc;
|
|
|
+ },
|
|
|
getNow() {
|
|
|
this.now = Date.now() + this.timeDifference;
|
|
|
},
|
|
@@ -92,24 +117,66 @@ export default {
|
|
|
moment(course.endTime)
|
|
|
);
|
|
|
},
|
|
|
- async enterPractice(course) {
|
|
|
- this.logger({
|
|
|
- page: "在线练习页面",
|
|
|
- button: "进入练习按钮",
|
|
|
- action: "点击",
|
|
|
- });
|
|
|
- const alreadyInExam = await this.checkExamInProgress();
|
|
|
- if (alreadyInExam) {
|
|
|
- window._hmt.push(["_trackEvent", "在线练习页面", "断点续考", "进入"]);
|
|
|
- this.logger({ action: "断点续考", detail: "在线练习页面" });
|
|
|
- return;
|
|
|
+ disableReason(course) {
|
|
|
+ if (!this.courseInBetween(course)) {
|
|
|
+ return "当前时间不在练习开放时间范围";
|
|
|
+ } else if (course.allowExamCount < 1) {
|
|
|
+ return "无剩余练习次数";
|
|
|
+ } else if (this.countdown > 0) {
|
|
|
+ return "请稍后点击";
|
|
|
+ } else if (!this.courseInCycle(course)) {
|
|
|
+ return "不在练习时间周期内";
|
|
|
+ } else {
|
|
|
+ return "";
|
|
|
}
|
|
|
-
|
|
|
- window._hmt.push(["_trackEvent", "在线练习页面", "进入练习"]);
|
|
|
- this.$router.push(
|
|
|
- `/online-exam/exam/${course.examId}/overview?examStudentId=${course.examStudentId}`
|
|
|
+ },
|
|
|
+ courseInCycle(course) {
|
|
|
+ if (!course.examCycleEnabled) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ const weekday = moment().isoWeekday();
|
|
|
+ if (!course.examCycleWeek.includes(weekday)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const HHmm = moment().format("HH:mm");
|
|
|
+ const ranges = course.examCycleTimeRange.map((v) => v.timeRange);
|
|
|
+ // console.log(HHmm, ranges);
|
|
|
+ // console.log(HHmm > "11:00" && HHmm < "23:00");
|
|
|
+ const inRange = ranges.some((v) => HHmm > v[0] && HHmm < v[1]);
|
|
|
+ // console.log(inRange);
|
|
|
+ return inRange;
|
|
|
+ },
|
|
|
+ disableTheCourse(course) {
|
|
|
+ return (
|
|
|
+ !this.courseInBetween(course) ||
|
|
|
+ course.allowExamCount < 1 ||
|
|
|
+ this.countdown > 0 ||
|
|
|
+ !this.courseInCycle(course)
|
|
|
);
|
|
|
},
|
|
|
+ async enterPractice(course) {
|
|
|
+ this.enterButtonClicked = true;
|
|
|
+ try {
|
|
|
+ this.logger({
|
|
|
+ page: "在线练习页面",
|
|
|
+ button: "进入练习按钮",
|
|
|
+ action: "点击",
|
|
|
+ });
|
|
|
+ const alreadyInExam = await this.checkExamInProgress();
|
|
|
+ if (alreadyInExam) {
|
|
|
+ window._hmt.push(["_trackEvent", "在线练习页面", "断点续考", "进入"]);
|
|
|
+ this.logger({ action: "断点续考", detail: "在线练习页面" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ window._hmt.push(["_trackEvent", "在线练习页面", "进入练习"]);
|
|
|
+ this.$router.push(
|
|
|
+ `/online-exam/exam/${course.examId}/overview?examStudentId=${course.examStudentId}`
|
|
|
+ );
|
|
|
+ } finally {
|
|
|
+ this.enterButtonClicked = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
async enterPracticeList(course) {
|
|
|
this.logger({
|
|
|
page: "在线练习页面",
|