|
@@ -0,0 +1,78 @@
|
|
|
+<template>
|
|
|
+ <div id="score">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="style">
|
|
|
+ <el-col :span="24" class="top">
|
|
|
+ <NavBar v-show="true" :title="pageTitle" :isleftarrow="true"> </NavBar>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="main"> </el-col>
|
|
|
+ <el-col :span="24" class="foot">
|
|
|
+ <footInfo></footInfo>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import _ from 'lodash';
|
|
|
+import NavBar from '@/layout/common/topInfo.vue';
|
|
|
+import footInfo from '@/layout/common/footInfo.vue';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: student } = createNamespacedHelpers('student');
|
|
|
+const { mapActions: uploadtask } = createNamespacedHelpers('uploadtask');
|
|
|
+export default {
|
|
|
+ name: 'score',
|
|
|
+ props: {},
|
|
|
+ components: { NavBar, footInfo },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ list: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...student(['query']),
|
|
|
+ ...uploadtask({ getTaskList: 'query' }),
|
|
|
+ async search() {
|
|
|
+ let res = await this.query({ classid: this.classid });
|
|
|
+ let classList = [];
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ classList = res.data;
|
|
|
+ }
|
|
|
+ let classTask = await this.getTaskList({ classid: this.classid });
|
|
|
+ if (this.$checkRes(classTask)) {
|
|
|
+ classList = classList.map(i => {
|
|
|
+ let r = classTask.data.filter(f => f.studentid == i.id);
|
|
|
+ // if (r.length > 0) {
|
|
|
+ r = r.map(task => {
|
|
|
+ let score = 0;
|
|
|
+ if (task.answers.length > 0) {
|
|
|
+ let s = task.answers.reduce((prev, next) => prev + next.questionscore * 1, 0);
|
|
|
+ score = _.isNumber(s) ? s : 0;
|
|
|
+ }
|
|
|
+ return score;
|
|
|
+ });
|
|
|
+ i.taskScore = r.reduce((prev, next) => prev + next * 1, 0);
|
|
|
+ // }
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ this.$set(this, `list`, classList);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user', 'classid']),
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|