|
|
@@ -30,18 +30,18 @@
|
|
|
{{ props.row.id }}
|
|
|
</b-table-column>
|
|
|
<b-table-column label="学生姓名" width="120" centered>
|
|
|
- {{ props.row.student }}
|
|
|
+ {{ props.row.user.nickname }}
|
|
|
</b-table-column>
|
|
|
<b-table-column label="文档作业" centered sortable>
|
|
|
- 80
|
|
|
+ {{ average(props.row.documents) }}
|
|
|
</b-table-column>
|
|
|
|
|
|
<b-table-column label="代码作业" centered sortable>
|
|
|
- 90
|
|
|
+ {{ average(props.row.codes) }}
|
|
|
</b-table-column>
|
|
|
|
|
|
<b-table-column label="互评作业" centered sortable>
|
|
|
- 100
|
|
|
+ {{ average(props.row.reviews) }}
|
|
|
</b-table-column>
|
|
|
<b-table-column
|
|
|
field="finalResult"
|
|
|
@@ -49,8 +49,8 @@
|
|
|
sortable
|
|
|
centered
|
|
|
>
|
|
|
- <span :class="['tag', type(props.row.finalResult)]">
|
|
|
- {{ props.row.finalResult }}
|
|
|
+ <span :class="['tag', type(getFinalResult(props.row))]">
|
|
|
+ {{ getFinalResult(props.row) }}
|
|
|
</span>
|
|
|
</b-table-column>
|
|
|
</template>
|
|
|
@@ -66,30 +66,30 @@
|
|
|
<div class="homework-class">文档作业</div>
|
|
|
<div
|
|
|
class="result"
|
|
|
- v-for="item in props.row.documentHomeworkResult"
|
|
|
+ v-for="item in props.row.documents"
|
|
|
:key="item.id"
|
|
|
>
|
|
|
- {{ item.name }} : {{ item.result }}
|
|
|
+ {{ item.name }} : {{ item.score }}
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="document-homework">
|
|
|
<div class="homework-class">代码作业</div>
|
|
|
<div
|
|
|
class="result"
|
|
|
- v-for="item in props.row.codeHomeworkResult"
|
|
|
+ v-for="item in props.row.codes"
|
|
|
:key="item.id"
|
|
|
>
|
|
|
- {{ item.name }} : {{ item.result }}
|
|
|
+ {{ item.name }} : {{ item.score }}
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="document-homework">
|
|
|
<div class="homework-class">互评作业</div>
|
|
|
<div
|
|
|
class="result"
|
|
|
- v-for="item in props.row.reviewHomeworkResult"
|
|
|
+ v-for="item in props.row.reviews"
|
|
|
:key="item.id"
|
|
|
>
|
|
|
- {{ item.name }} : {{ item.result }}
|
|
|
+ {{ item.name }} : {{ item.score }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -175,180 +175,13 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapState } from "vuex";
|
|
|
-import { getStudentCourseReviewList } from "@/api/review";
|
|
|
+// import { getStudentCourseReviewList } from "@/api/review";
|
|
|
import PageHeader from "@/components/PageHeader";
|
|
|
import PageBody from "@/components/PageBody/index";
|
|
|
import Chart from "chart.js";
|
|
|
import BInput from "buefy/src/components/input/Input";
|
|
|
import { required, numeric, between } from "vuelidate/lib/validators";
|
|
|
-
|
|
|
-const data = [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- student: "小白",
|
|
|
- documentHomeworkResult: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "第二次作业",
|
|
|
- result: 85
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- name: "第三次作业",
|
|
|
- result: 99
|
|
|
- }
|
|
|
- ],
|
|
|
- charge: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- }
|
|
|
- ],
|
|
|
- score: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "第二次作业",
|
|
|
- result: 85
|
|
|
- }
|
|
|
- ],
|
|
|
- finalResult: 99
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- student: "yasen",
|
|
|
- documentHomeworkResult: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "第二次作业",
|
|
|
- result: 85
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- name: "第三次作业",
|
|
|
- result: 99
|
|
|
- }
|
|
|
- ],
|
|
|
- charge: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- }
|
|
|
- ],
|
|
|
- score: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "第二次作业",
|
|
|
- result: 85
|
|
|
- }
|
|
|
- ],
|
|
|
-
|
|
|
- finalResult: 79
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- student: "soleil",
|
|
|
- documentHomeworkResult: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "第二次作业",
|
|
|
- result: 85
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- name: "第三次作业",
|
|
|
- result: 99
|
|
|
- }
|
|
|
- ],
|
|
|
- charge: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- }
|
|
|
- ],
|
|
|
- score: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "第二次作业",
|
|
|
- result: 85
|
|
|
- }
|
|
|
- ],
|
|
|
- finalResult: 59
|
|
|
- },
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- student: "xiaohan",
|
|
|
- documentHomeworkResult: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "第二次作业",
|
|
|
- result: 85
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- name: "第三次作业",
|
|
|
- result: 99
|
|
|
- }
|
|
|
- ],
|
|
|
- charge: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- }
|
|
|
- ],
|
|
|
- score: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "第一次作业",
|
|
|
- result: 80
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "第二次作业",
|
|
|
- result: 85
|
|
|
- }
|
|
|
- ],
|
|
|
- finalResult: 99
|
|
|
- }
|
|
|
-];
|
|
|
+import { getStudentFinaleResult } from "@/api/resultstatistics";
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -377,10 +210,11 @@ export default {
|
|
|
{ id: 1, title: "文档作业题目" },
|
|
|
{ id: 2, title: "代码作业题目" }
|
|
|
],
|
|
|
- data,
|
|
|
+ data: [],
|
|
|
isCardModalActive: false,
|
|
|
myChart2: {},
|
|
|
- percent: ""
|
|
|
+ percent: "",
|
|
|
+ finalResultPercentage: [20, 20, 20, 10, 10, 10, 10]
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -393,12 +227,43 @@ export default {
|
|
|
} else if (number >= 80) {
|
|
|
return "is-success";
|
|
|
}
|
|
|
+ },
|
|
|
+ //计算平均成绩
|
|
|
+ average(resultList) {
|
|
|
+ let res = 0;
|
|
|
+ for (let item of resultList) {
|
|
|
+ res += item.score;
|
|
|
+ }
|
|
|
+ return res / resultList.length;
|
|
|
+ },
|
|
|
+ //计算总评
|
|
|
+ getFinalResult(result) {
|
|
|
+ let finalRes = 0;
|
|
|
+ let currentIndex = 0;
|
|
|
+ for (let docRes of result.documents) {
|
|
|
+ finalRes +=
|
|
|
+ docRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
+ currentIndex++;
|
|
|
+ }
|
|
|
+ for (let codeRes of result.codes) {
|
|
|
+ finalRes +=
|
|
|
+ codeRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
+ currentIndex++;
|
|
|
+ }
|
|
|
+ for (let reviewRes of result.reviews) {
|
|
|
+ finalRes +=
|
|
|
+ reviewRes.score * (this.finalResultPercentage[currentIndex] / 100);
|
|
|
+ currentIndex++;
|
|
|
+ }
|
|
|
+ return parseInt(finalRes);
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- getStudentCourseReviewList(this.courses.id).then(
|
|
|
- value => (this.review = value.data)
|
|
|
- );
|
|
|
+ //获取成绩信息
|
|
|
+ getStudentFinaleResult(this.courses.id).then(res => {
|
|
|
+ console.log(res.data);
|
|
|
+ this.data = res.data;
|
|
|
+ });
|
|
|
//绘制图表
|
|
|
var resultChart = document.getElementById("result-chart");
|
|
|
var myChart2 = new Chart(resultChart, {
|