wuhongyu 4 years ago
parent
commit
7e06a9d204

+ 2 - 2
src/views/class/achieve.vue

@@ -103,8 +103,8 @@ export default {
       if (this.user.type === '1') classid = this.classid;
       if (this.user.type === '1') classid = this.classid;
       else classid = this.user.classid;
       else classid = this.user.classid;
       const res = await this.list({ classid });
       const res = await this.list({ classid });
+      console.log(res.data);
       this.$set(this, `peaceAchieveList`, res.data);
       this.$set(this, `peaceAchieveList`, res.data);
-
       let classsid = this.user.classid;
       let classsid = this.user.classid;
       const result = await this.uploadtasklist({ classsid });
       const result = await this.uploadtasklist({ classsid });
 
 
@@ -192,7 +192,7 @@ export default {
     async onConfirm(peaceScore) {
     async onConfirm(peaceScore) {
       let data = {};
       let data = {};
       data.id = this.studid;
       data.id = this.studid;
-      data.selfscore = peaceScore;
+      data.selfscore = Number(peaceScore) + Number(peaceScore);
       const res = await this.updates(data);
       const res = await this.updates(data);
       this.$message({
       this.$message({
         message: '平时成绩上分成功',
         message: '平时成绩上分成功',

+ 122 - 47
src/views/user/dati.vue

@@ -141,6 +141,7 @@ export default {
       };
       };
       let answers = {};
       let answers = {};
       let data = this.datilist.question;
       let data = this.datilist.question;
+
       var answer = data.map(i => {
       var answer = data.map(i => {
         answers.questionid = i._id;
         answers.questionid = i._id;
         answers.answer = JSON.stringify(i.answers);
         answers.answer = JSON.stringify(i.answers);
@@ -156,60 +157,134 @@ export default {
           };
           };
         }
         }
       });
       });
-      console.log(answer);
 
 
       //上传
       //上传
       let dati = this.resdata;
       let dati = this.resdata;
       //作业
       //作业
       let task = this.datilist;
       let task = this.datilist;
-      console.log(task);
-      //合并集合时使用
-      let newsc = [];
-      for (const shangchan of dati) {
-        console.log(shangchan);
-        task.question.map(n => {
-          if (n.type == 1) {
-            // a b array类型
-            let a = n.answer.split(';');
-            let b = n.answers;
-            console.log(b);
-            let c = new Set(a);
-            let d = new Set(b);
-            //差集判断答案
-            let differenceABSet = new Set([...d].filter(x => !c.has(x)));
-            var sc = shangchan.answers.map(a => {
-              if (n._id == a.questionid) {
-                if (differenceABSet.size === 0) {
-                  return {
-                    // 转换成string
-                    answer: JSON.stringify(n.answers),
-                    questionid: n._id,
-                    questionscore: n.score,
-                  };
-                }
+
+      task.question.map(n => {
+        console.log(n._id);
+
+        if (n.type == 1) {
+          // a b array类型
+          let a = n.answer.split(';');
+          let b = n.answers;
+
+          let c = new Set(a);
+          let d = new Set(b);
+          console.log(d);
+          console.log(c);
+          let differenceABSet = new Set([...d].filter(x => !c.has(x)));
+
+          var sc = this.datilist.question.map(a => {
+            if (n._id == a._id) {
+              console.log('dw');
+
+              if (differenceABSet.size === 0) {
+                return {
+                  // 转换成string
+                  answer: JSON.stringify(n.answers),
+                  questionid: n._id,
+                  questionscore: n.score,
+                };
               }
               }
-            });
-          } else {
-            var sc = shangchan.answers.map(a => {
-              //字符串判断答案
-              if (n._id == a.questionid) {
-                if (n.answers === n.answer) {
-                  return {
-                    answer: n.answers,
-                    questionid: n._id,
-                    questionscore: n.score,
-                  };
-                }
+            }
+          });
+          console.log(sc);
+        } else {
+          console.log(this.datilist.question);
+
+          var sc = this.datilist.question.map(a => {
+            console.log(n._id);
+            console.log(a.questionid);
+
+            if (n._id == a._id) {
+              if (n.answers === n.answer) {
+                return {
+                  answer: n.answers,
+                  questionid: n._id,
+                  questionscore: n.score,
+                };
+              } else {
+                return {
+                  answer: n.answers,
+                  questionid: n._id,
+                  questionscore: 0,
+                };
               }
               }
-            });
-          }
-          //合并数组
-          newsc = [...sc, ...newsc];
-          var arr = newsc.filter(item => item);
-          answerss.answers = arr;
-        });
-      }
-      let res = await this.Uploadtaskupdates(answerss);
+            }
+          });
+
+          // var sc = shangchan.answers.map(a => {
+          //   //字符串判断答案
+          //   if (n._id == a.questionid) {
+          //     if (n.answers === n.answer) {
+          //       return {
+          //         answer: n.answers,
+          //         questionid: n._id,
+          //         questionscore: n.score,
+          //       };
+          //     }
+          //   }
+          // });
+        }
+
+        // console.log(sc);
+
+        //合并数组
+        // newsc = [...sc, ...newsc];
+        // var arr = newsc.filter(item => item);
+        // answerss.answers = arr;
+      });
+
+      // //合并集合时使用
+      // let newsc = [];
+      // for (const shangchan of dati) {
+      //   console.log(shangchan);
+      //   task.question.map(n => {
+      //     if (n.type == 1) {
+      //       // a b array类型
+      //       let a = n.answer.split(';');
+      //       let b = n.answers;
+      //       console.log(b);
+      //       let c = new Set(a);
+      //       let d = new Set(b);
+      //       //差集判断答案
+      //       let differenceABSet = new Set([...d].filter(x => !c.has(x)));
+      //       var sc = shangchan.answers.map(a => {
+      //         if (n._id == a.questionid) {
+      //           if (differenceABSet.size === 0) {
+      //             return {
+      //               // 转换成string
+      //               answer: JSON.stringify(n.answers),
+      //               questionid: n._id,
+      //               questionscore: n.score,
+      //             };
+      //           }
+      //         }
+      //       });
+      //     } else {
+      //       var sc = shangchan.answers.map(a => {
+      //         //字符串判断答案
+      //         if (n._id == a.questionid) {
+      //           if (n.answers === n.answer) {
+      //             return {
+      //               answer: n.answers,
+      //               questionid: n._id,
+      //               questionscore: n.score,
+      //             };
+      //           }
+      //         }
+      //       });
+      //     }
+      //     //合并数组
+      //     newsc = [...sc, ...newsc];
+      //     var arr = newsc.filter(item => item);
+      //     answerss.answers = arr;
+      //   });
+      // }
+      // let res = await this.Uploadtaskupdates(answerss);
     },
     },
   },
   },
 };
 };

+ 7 - 4
src/views/user/homework.vue

@@ -82,11 +82,14 @@ export default {
       console.log(crr);
       console.log(crr);
 
 
       this.$set(this, `workLists`, crr);
       this.$set(this, `workLists`, crr);
+      for (const val of resout.data) {
+        var arr = crr.filter(item => item.subid === val.code);
+        console.log(arr);
+      }
 
 
-      // var arr = crr.filter(item => item.subid === val.code);
-      // for (const att of arr) {
-      //   att.display = 'second';
-      // }
+      for (const att of arr) {
+        att.display = 'second';
+      }
     },
     },
   },
   },
 };
 };

+ 12 - 5
src/views/user/leave.vue

@@ -22,7 +22,7 @@
 <script>
 <script>
 import NavBar from '@/layout/common/topTitle.vue';
 import NavBar from '@/layout/common/topTitle.vue';
 import leaveList from '@/layout/user/leaveList.vue';
 import leaveList from '@/layout/user/leaveList.vue';
-import { createNamespacedHelpers, mapGetters } from 'vuex';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapLeave } = createNamespacedHelpers('leave');
 const { mapActions: mapLeave } = createNamespacedHelpers('leave');
 export default {
 export default {
   metaInfo: { title: '请假管理' },
   metaInfo: { title: '请假管理' },
@@ -42,7 +42,7 @@ export default {
   created() {
   created() {
     this.searchInfo();
     this.searchInfo();
   },
   },
-  computed: {},
+  computed: { ...mapState(['user']) },
   mounted() {
   mounted() {
     this.title = this.$route.meta.title;
     this.title = this.$route.meta.title;
     this.isleftarrow = this.$route.meta.isleftarrow;
     this.isleftarrow = this.$route.meta.isleftarrow;
@@ -56,9 +56,16 @@ export default {
   methods: {
   methods: {
     ...mapLeave(['query']),
     ...mapLeave(['query']),
     async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
     async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
-      let type = 0;
-      const res = await this.query({ skip, limit, type, ...info });
-      this.$set(this, `leaveList`, res.data);
+      if (this.user.type == 4) {
+        let type = 0;
+        let name = this.user.name;
+        const res = await this.query({ skip, limit, type, name, ...info });
+        this.$set(this, `leaveList`, res.data);
+      } else {
+        let type = 0;
+        const res = await this.query({ skip, limit, type, ...info });
+        this.$set(this, `leaveList`, res.data);
+      }
     },
     },
     // 跳转到请假
     // 跳转到请假
     onClickRight() {
     onClickRight() {

+ 4 - 1
src/views/user/leaveDetail.vue

@@ -87,7 +87,10 @@ export default {
       this.form.studentid = this.user.userid;
       this.form.studentid = this.user.userid;
       this.form.type = '1';
       this.form.type = '1';
       let data = this.form;
       let data = this.form;
-
+      this.form.batchid = this.user.batchid;
+      this.form.termid = this.user.termid;
+      this.form.classid = this.user.classid;
+      this.form.stuname = this.user.name;
       let res = await this.create(data);
       let res = await this.create(data);
       if (res.errcode === 0) {
       if (res.errcode === 0) {
         let msg = `${this.keyWord}添加成功`;
         let msg = `${this.keyWord}添加成功`;

+ 3 - 1
src/views/user/pingfenindex.vue

@@ -69,10 +69,12 @@ export default {
     ...mapclass({ mapclass: 'query', classfetch: 'fetch' }),
     ...mapclass({ mapclass: 'query', classfetch: 'fetch' }),
     async searchInfo() {
     async searchInfo() {
       console.log('a');
       console.log('a');
-      let classid = this.id;
+      let classid = this.user.classid;
       const acc = await this.query({ classid });
       const acc = await this.query({ classid });
       console.log(acc);
       console.log(acc);
       var res = acc.data.filter(item => item.classid === classid);
       var res = acc.data.filter(item => item.classid === classid);
+      console.log(res.data);
+
       let selfscore = res.map(i => i.selfscore);
       let selfscore = res.map(i => i.selfscore);
       let nes = selfscore.filter(d => d);
       let nes = selfscore.filter(d => d);
       console.log(nes);
       console.log(nes);

+ 12 - 5
src/views/user/quit.vue

@@ -22,7 +22,7 @@
 <script>
 <script>
 import NavBar from '@/layout/common/topTitle.vue';
 import NavBar from '@/layout/common/topTitle.vue';
 import quitList from '@/layout/user/quitList.vue';
 import quitList from '@/layout/user/quitList.vue';
-import { createNamespacedHelpers, mapGetters } from 'vuex';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapLeave } = createNamespacedHelpers('leave');
 const { mapActions: mapLeave } = createNamespacedHelpers('leave');
 export default {
 export default {
   metaInfo: { title: '请假管理' },
   metaInfo: { title: '请假管理' },
@@ -42,7 +42,7 @@ export default {
   created() {
   created() {
     this.searchInfo();
     this.searchInfo();
   },
   },
-  computed: {},
+  computed: { ...mapState(['user']) },
   mounted() {
   mounted() {
     this.title = this.$route.meta.title;
     this.title = this.$route.meta.title;
     this.isleftarrow = this.$route.meta.isleftarrow;
     this.isleftarrow = this.$route.meta.isleftarrow;
@@ -56,9 +56,16 @@ export default {
   methods: {
   methods: {
     ...mapLeave(['query']),
     ...mapLeave(['query']),
     async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
     async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
-      let type = 1;
-      const res = await this.query({ skip, limit, type, ...info });
-      this.$set(this, `leaveList`, res.data);
+      if (this.user.type == 4) {
+        let type = 1;
+        let name = this.user.name;
+        const res = await this.query({ skip, limit, type, name, ...info });
+        this.$set(this, `leaveList`, res.data);
+      } else {
+        let type = 1;
+        const res = await this.query({ skip, limit, type, ...info });
+        this.$set(this, `leaveList`, res.data);
+      }
     },
     },
     // 跳转到请假
     // 跳转到请假
     onClickRight() {
     onClickRight() {

+ 4 - 1
src/views/user/socre.vue

@@ -78,14 +78,17 @@ export default {
       this.$set(this, `columns`, name);
       this.$set(this, `columns`, name);
     },
     },
     async onvalue(value) {
     async onvalue(value) {
+      console.log(value);
+
       let name = value.value;
       let name = value.value;
       const res = await this.list({ name });
       const res = await this.list({ name });
       for (const acc of res.data) {
       for (const acc of res.data) {
         this.$set(this, `info`, acc);
         this.$set(this, `info`, acc);
       }
       }
-      this.form.id = value.value.id;
     },
     },
     async submit() {
     async submit() {
+      console.log(this.info);
+
       console.log(this.form);
       console.log(this.form);
       this.info.selfscore = Number(this.form.selfscore) + Number(this.info.selfscore);
       this.info.selfscore = Number(this.form.selfscore) + Number(this.info.selfscore);
       console.log(this.info.selfscore);
       console.log(this.info.selfscore);