|
@@ -0,0 +1,200 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <list-frame title="积分榜" :needPag="false" :needFilter="false" :newAdd="false">
|
|
|
+ <el-form :inline="true" size="mini">
|
|
|
+ <el-form-item label="期">
|
|
|
+ <el-select v-model="form.termid" placeholder="请选择期数" @change="getClasses">
|
|
|
+ <el-option v-for="(i, index) in termList" :key="index" :label="`第${i.term}期`" :value="i._id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="班级">
|
|
|
+ <el-select v-model="form.classid" placeholder="请选择班级">
|
|
|
+ <el-option v-for="(i, index) in classList" :key="index" :label="i.name" :value="i._id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="search">查询</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-col :span="24">
|
|
|
+ <leagueData :lessonList="lessonList" :list="list"></leagueData>
|
|
|
+ </el-col>
|
|
|
+ </list-frame>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import _ from 'lodash';
|
|
|
+import leagueData from './leagueData.vue';
|
|
|
+import listFrame from '@frame/layout/admin/list-frame';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
+const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
+const { mapActions: student } = createNamespacedHelpers('student');
|
|
|
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
|
|
|
+const { mapActions: group } = createNamespacedHelpers('group');
|
|
|
+const { mapActions: uploadtask } = createNamespacedHelpers('uploadtask');
|
|
|
+const { mapActions: util } = createNamespacedHelpers('util');
|
|
|
+export default {
|
|
|
+ metaInfo: { title: '积分榜' },
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ listFrame,
|
|
|
+ // 积分榜组件
|
|
|
+ leagueData,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ // 查询
|
|
|
+ form: {},
|
|
|
+ // 班级
|
|
|
+ classList: [],
|
|
|
+ // 期
|
|
|
+ termList: [],
|
|
|
+ // 课表
|
|
|
+ lessonList: [
|
|
|
+ {
|
|
|
+ id: '1',
|
|
|
+ name: '测试1',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: '2',
|
|
|
+ name: '测试2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: '3',
|
|
|
+ name: '测试3',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: '4',
|
|
|
+ name: '测试4',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ // 学生名单
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ group: '1',
|
|
|
+ index: '1',
|
|
|
+ name: '测试1',
|
|
|
+ team: '10',
|
|
|
+ person: '10',
|
|
|
+ homework: '10',
|
|
|
+ team1: '10',
|
|
|
+ person1: '10',
|
|
|
+ homework1: '10',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ group: '1',
|
|
|
+ index: '2',
|
|
|
+ name: '测试2',
|
|
|
+ team: '10',
|
|
|
+ person: '10',
|
|
|
+ homework: '10',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ group: '1',
|
|
|
+ index: '3',
|
|
|
+ name: '测试3',
|
|
|
+ team: '10',
|
|
|
+ person: '10',
|
|
|
+ homework: '10',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ group: '2',
|
|
|
+ index: '1',
|
|
|
+ name: '测试4',
|
|
|
+ team: '10',
|
|
|
+ person: '10',
|
|
|
+ homework: '10',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ group: '2',
|
|
|
+ index: '2',
|
|
|
+ name: '测试5',
|
|
|
+ team: '10',
|
|
|
+ person: '10',
|
|
|
+ homework: '10',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ group: '2',
|
|
|
+ index: '3',
|
|
|
+ name: '测试6',
|
|
|
+ team: '10',
|
|
|
+ person: '10',
|
|
|
+ homework: '10',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getPlan();
|
|
|
+ },
|
|
|
+ computed: { ...mapState(['user', 'defaultOption']) },
|
|
|
+ methods: {
|
|
|
+ ...trainplan({ planfetch: 'fetch' }),
|
|
|
+ ...classes({ classesquery: 'query', classesFetch: 'fetch' }),
|
|
|
+ ...student({ studentQuery: 'query', studentFetch: 'fetch' }),
|
|
|
+ ...lesson({ lessonQuery: 'query', lessonFetch: 'fetch' }),
|
|
|
+ ...group({ groupQuery: 'query' }),
|
|
|
+ ...uploadtask({ uploadtaskQuery: 'query' }),
|
|
|
+ ...util({ modelFetch: 'fetch' }),
|
|
|
+ async search() {
|
|
|
+ console.log(this.form);
|
|
|
+ // 查询课表
|
|
|
+ let classid = this.form.classid;
|
|
|
+ let res = await this.modelFetch({ model: 'lesson', classid });
|
|
|
+ let lesson = _.uniqBy(
|
|
|
+ res.data.lessons.filter(item => item.subid != null),
|
|
|
+ 'subid'
|
|
|
+ );
|
|
|
+ this.$set(this, `lessonList`, lesson);
|
|
|
+ // 查询学生
|
|
|
+ res = await this.groupQuery({ classid });
|
|
|
+ for (const val of res.data) {
|
|
|
+ for (const student of val.students) {
|
|
|
+ // 组成绩
|
|
|
+ student.groupScore = val.score;
|
|
|
+ let studentInfo = await this.studentFetch(student.stuid);
|
|
|
+ // 平时成绩
|
|
|
+ student.selfscore = studentInfo.data.selfscore;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 作业成绩
|
|
|
+ let homeWork = await this.uploadtaskQuery({ classid });
|
|
|
+ console.log(homeWork.data);
|
|
|
+ // console.log(res.data);
|
|
|
+ // let student = res.data.map(item => item.students);
|
|
|
+ // student = _.flattenDeep(student);
|
|
|
+ // console.log(student);
|
|
|
+ },
|
|
|
+ // 期
|
|
|
+ async getPlan() {
|
|
|
+ const res = await this.planfetch(this.defaultOption.planid);
|
|
|
+ let terms = res.data.termnum;
|
|
|
+ this.$set(this, `termList`, terms);
|
|
|
+ if (this.defaultOption.termid) {
|
|
|
+ this.form.termid = this.defaultOption.termid;
|
|
|
+ this.getClasses(this.form.termid);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 班级
|
|
|
+ async getClasses(termid) {
|
|
|
+ const res = await this.classesquery({ termid });
|
|
|
+ this.$set(this, `classList`, res.data);
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ watch: {
|
|
|
+ defaultOption: {
|
|
|
+ handler(val) {
|
|
|
+ this.form.termid = this.defaultOption.termid;
|
|
|
+ this.getClasses(this.form.termid);
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|