wuhongyu %!s(int64=4) %!d(string=hai) anos
pai
achega
bc2aa3c406
Modificáronse 2 ficheiros con 35 adicións e 15 borrados
  1. 33 13
      src/views/class/achieve.vue
  2. 2 2
      src/views/user/pingfenclass.vue

+ 33 - 13
src/views/class/achieve.vue

@@ -40,7 +40,7 @@ const { mapActions: mapClass } = createNamespacedHelpers('classes');
 const { mapActions: mapLesson } = createNamespacedHelpers('lesson');
 const { mapActions: mapUploadtask } = createNamespacedHelpers('uploadtask');
 const { mapActions: mapSubject } = createNamespacedHelpers('subject');
-
+const { mapActions: group } = createNamespacedHelpers('group');
 export default {
   name: 'achieve',
   props: {},
@@ -70,6 +70,8 @@ export default {
     taskid: '',
     subname: '',
     task: [],
+
+    groupsocre: '',
   }),
   created() {
     this.search();
@@ -97,13 +99,14 @@ export default {
     ...mapLesson({ lessoninfo: 'fetch', lessonlist: 'query' }),
     ...mapUploadtask({ uploadtaskinfo: 'fetch', uploadtasklist: 'query', uploadtaskupdate: 'update' }),
     ...mapSubject({ subjectinfo: 'fetch', subjectlist: 'query' }),
+    ...group({ groupinfo: 'query', groupfetch: 'fetch', findbystuid: 'findbystuid', groupupdate: 'update' }),
     // 平时成绩学生名单查询+作业成绩学生名单查询
     async search() {
       let classid;
       if (this.user.type === '1') classid = this.classid;
       else classid = this.user.classid;
       const res = await this.list({ classid });
-      console.log(res.data);
+
       this.$set(this, `peaceAchieveList`, res.data);
       let classsid = this.user.classid;
       const result = await this.uploadtasklist({ classsid });
@@ -117,7 +120,6 @@ export default {
       let stus = [];
       for (const val of result.data) {
         let newsid = val.lessonid;
-        console.log(newsid);
 
         let classid = this.user.classid;
         //查询这个班的课程
@@ -125,9 +127,8 @@ export default {
 
         for (const hic of lessonInfo.data) {
           //过滤出有作业的科目
-          console.log(hic);
+
           var fff = hic.lessons.filter(item => item.subid === newsid);
-          console.log(fff);
 
           for (const less of fff) {
             console.log(less.subname);
@@ -136,9 +137,7 @@ export default {
           }
         }
         val.subName = this.subname;
-
         const stuInfo = await this.fet(val.studentid);
-
         if (stuInfo.data.name) {
           val.stuName = stuInfo.data.name;
           //创建学生名字相关数组
@@ -150,8 +149,6 @@ export default {
           //去掉重复数组对象
           var appArray = _.uniqBy(stus, _.isEqual);
 
-          console.log(appArray);
-
           //合并数组
           this.$set(this, `achieveList`, appArray);
           let lessonss = [{ name: this.subname, id: val.studentid, taskid: val.id, score: val.score }];
@@ -192,14 +189,39 @@ export default {
     async onConfirm(peaceScore) {
       let data = {};
       data.id = this.studid;
-      data.selfscore = Number(peaceScore) + Number(peaceScore);
+
+      const ress = await this.fet(this.studid);
+
+      data.selfscore = Number(ress.data.selfscore) + Number(peaceScore);
+
       const res = await this.updates(data);
       this.$message({
         message: '平时成绩上分成功',
         type: 'success',
       });
-      this.showPicker = false;
+
+      let classid = this.user.classid;
+
+      const group = await this.findbystuid({ stuid: this.studid });
+
+      for (const acc of group.data.students) {
+        var ref = this.peaceAchieveList.filter(item => item.id === acc.stuid);
+
+        for (const aaa of ref) {
+          acc.stores = aaa.selfscore;
+        }
+        let asd = group.data.students.map(i => i.stores);
+        console.log(asd);
+        let nes = asd.filter(d => d);
+        console.log(nes);
+        let snewcore = eval(nes.join('+'));
+        this.groupsocre = snewcore;
+      }
+      group.data.score = Number(data.selfscore) + Number(this.groupsocre);
+      let groups = group.data;
+      const groupup = await this.groupupdate(groups);
       this.search();
+      this.showPicker = false;
     },
     //  作业成绩列表
     async searchinfo({ ...info } = {}) {
@@ -244,8 +266,6 @@ export default {
     },
     //为了获取当前点击学生id和当前学生上传的作业
     async onsist({ id }) {
-      console.log(id);
-
       var arr = this.task.filter(item => item.id === id);
 
       this.$set(this, `lesson`, arr);

+ 2 - 2
src/views/user/pingfenclass.vue

@@ -54,8 +54,8 @@ export default {
     async searchInfo({ ...info } = {}) {
       let batchid = this.user.batchid;
       let termid = this.user.termid;
-      let id = this.user.classid;
-      const res = await this.classinfo({ batchid, termid, id, ...info });
+      let classid = this.user.classid;
+      const res = await this.classinfo({ batchid, termid, classid, ...info });
       console.log(res.data);
 
       this.$set(this, `classList`, res.data);