|
@@ -9,8 +9,8 @@
|
|
|
<div class="home">
|
|
|
|
|
|
<div style="display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; text-align: left">
|
|
|
- <div>批次: <span></span></div>
|
|
|
- <div>科目: <span></span></div>
|
|
|
+ <div>批次: <span>{{examName}}</span></div>
|
|
|
+ <div>科目: <span>{{courseName}}</span></div>
|
|
|
<div>平均正确率: <span>{{aveAccuracy}}%</span></div>
|
|
|
<div>最高正确率: <span>{{maxAccuracy}}%</span></div>
|
|
|
</div>
|
|
@@ -64,7 +64,7 @@ import moment from "moment";
|
|
|
export default {
|
|
|
name: "OnlinePracticeRecordList",
|
|
|
data() {
|
|
|
- return { exam: null, recordList: [] };
|
|
|
+ return { recordList: [] };
|
|
|
},
|
|
|
async created() {
|
|
|
const res = await this.$http.get(
|
|
@@ -86,8 +86,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ examName() {
|
|
|
+ return this.$route.query.examName;
|
|
|
+ },
|
|
|
+ courseName() {
|
|
|
+ return this.$route.query.courseName;
|
|
|
+ },
|
|
|
maxAccuracy() {
|
|
|
- return Math.max(...this.recordList.map(v => v.objectiveAccuracy)) || 0;
|
|
|
+ if (this.recordList.length === 0) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return Math.max(...this.recordList.map(v => v.objectiveAccuracy)).toFixed(
|
|
|
+ 2
|
|
|
+ );
|
|
|
},
|
|
|
aveAccuracy() {
|
|
|
if (this.recordList.length === 0) {
|
|
@@ -96,7 +107,7 @@ export default {
|
|
|
return (
|
|
|
this.recordList.map(v => v.objectiveAccuracy).reduce((a, b) => a + b) /
|
|
|
this.recordList.length
|
|
|
- );
|
|
|
+ ).toFixed(2);
|
|
|
}
|
|
|
}
|
|
|
};
|