guhongwei 5 年之前
父節點
當前提交
ce08cf81df
共有 3 個文件被更改,包括 124 次插入0 次删除
  1. 7 0
      src/router/index.js
  2. 6 0
      src/store/index.js
  3. 111 0
      src/views/league/index.vue

+ 7 - 0
src/router/index.js

@@ -136,6 +136,13 @@ const routes = [
         meta: { title: '特殊班考勤管理' },
         component: () => import('@/views/classes/tsbattendance.vue'),
       },
+      // 08-23
+      {
+        path: '/league/index',
+        name: 'league_index',
+        meta: { title: '积分榜' },
+        component: () => import('@/views/league/index.vue'),
+      },
     ],
   },
   {

+ 6 - 0
src/store/index.js

@@ -27,6 +27,9 @@ import setting from '@frame/store/setting';
 import notice from '@frame/store/notice';
 import trainBatch from '@frame/store/train-plan-year';
 import group from '@frame/store/group';
+import personalscore from '@frame/store/personalscore';
+import groupscore from '@frame/store/groupscore';
+import uploadtask from '@frame/store/uploadtask';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
 import * as dostate from '@frame/store/setting/state';
@@ -62,6 +65,9 @@ export default new Vuex.Store({
     questionanswer,
     notice,
     group,
+    personalscore,
+    groupscore,
+    uploadtask,
   },
   state: { ...ustate, ...dostate },
   mutations: { ...umutations, ...domutations },

+ 111 - 0
src/views/league/index.vue

@@ -0,0 +1,111 @@
+<template>
+  <div id="index">
+    <list-frame :title="pageTitle" :needFilter="false" :needAdd="false">
+      <leagueData
+        :lessonList="lessonList"
+        :groupList="groupList"
+        :list="list"
+        :getPScore="getPScore"
+        :homeworkList="homeworkList"
+        :groupscoreList="groupscoreList"
+      ></leagueData>
+    </list-frame>
+  </div>
+</template>
+
+<script>
+var moment = require('moment');
+import _ from 'lodash';
+import leagueData from '@frame/layout/leagueData.vue';
+import listFrame from '@frame/layout/admin/detail-frame';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
+const { mapActions: group } = createNamespacedHelpers('group');
+const { mapActions: uploadtask } = createNamespacedHelpers('uploadtask');
+const { mapActions: pscore } = createNamespacedHelpers('personalscore');
+const { mapActions: groupscore } = createNamespacedHelpers('groupscore');
+const { mapActions: util } = createNamespacedHelpers('util');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    listFrame,
+    leagueData,
+  },
+  data: function() {
+    return {
+      // 课表
+      lessonList: [],
+      // 组列表
+      groupList: [],
+      // 学生名单
+      list: [],
+      // 平时成绩
+      getPScore: [],
+      // 作业成绩
+      homeworkList: [],
+      // 团队分
+      groupscoreList: [],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...lesson({ lessonQuery: 'query', lessonFetch: 'fetch' }),
+    ...group({ groupQuery: 'query' }),
+    ...uploadtask({ uploadtaskQuery: 'query' }),
+    ...pscore({ getPScoreList: 'query', pscoreOpera: 'opera' }),
+    ...groupscore({ groupscoreQuery: 'query' }),
+    ...util({ modelFetch: 'fetch' }),
+    async search() {
+      // 查询课表
+      let classid = this.id;
+      let res = await this.modelFetch({ model: 'lesson', classid });
+      let r = res.data.lessons.filter(f => f.subid);
+      r = r.map(r => {
+        let time = r.time.split('-');
+        r.start = `${r.date} ${time[0]}`;
+        return r;
+      });
+      r = Object.values(_.groupBy(r, 'subid'));
+      r = r.map(a => {
+        let na = _.orderBy(a, ['start'], ['asc']);
+        return _.head(na);
+      });
+      this.$set(this, `lessonList`, r);
+      res = await this.groupQuery({ classid });
+      this.$set(this, `groupList`, res.data);
+      for (const val of res.data) {
+        for (const student of val.students) {
+          student.groupname = val.name;
+          student.groupid = val.id;
+        }
+      }
+      let arr = res.data.map(item => item.students);
+      arr = _.flattenDeep(arr);
+      this.$set(this, `list`, arr);
+      // 平时成绩
+      res = await this.getPScoreList({ classid: classid });
+      this.$set(this, `getPScore`, res.data);
+      // 作业成绩
+      res = await this.uploadtaskQuery({ classid });
+      this.$set(this, `homeworkList`, res.data);
+      // 团队分
+      res = await this.groupscoreQuery({ classid });
+      this.$set(this, `groupscoreList`, res.data);
+    },
+  },
+  computed: {
+    ...mapState(['user', 'defaultOption']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+    id() {
+      return this.defaultOption.classid;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>