Переглянути джерело

Merge branch 'master' of http://git.cc-lotus.info/new_train/train-dirtea

reloaded 4 роки тому
батько
коміт
c55745dc5f

+ 6 - 8
src/layout/class/achieveList/homeworkAchiece.vue

@@ -5,18 +5,16 @@
         <van-collapse v-model="openCollapse">
           <van-collapse-item :name="index" v-for="(item, index) in achieveList" :key="index">
             <div slot="title" class="title" @click="clickcds(item.id)">
-              <span class="name">{{ item.stuname }}</span>
+              <span class="name">{{ item.name }}</span>
             </div>
-            <van-row v-for="(tag, index) in item.lesson" :key="index">
+            <van-row v-for="(tag, index) in lesson" :key="index">
               <el-col :span="18">
-                <van-col :span="24" class="score"> 名称:{{ tag.name }} </van-col>
+                <van-col :span="24" class="score"> 名称:{{ tag.lessonname }} </van-col>
                 <van-col :span="24" class="score"> 作业分: {{ tag.score }}分</van-col>
               </el-col>
               <el-col :span="6" class="anniu">
                 <van-col :span="3" class="score">
-                  <van-button v-if="user.job == '学委' || user.type == '3'" type="primary" size="mini" @click="clickBtn(tag.taskid, tag.name, tag.score)"
-                    >上成绩</van-button
-                  >
+                  <van-button v-if="user.type == '3'" type="primary" size="mini" @click="clickBtn(tag.id, tag.name, tag.score)">上成绩</van-button>
                 </van-col>
               </el-col>
             </van-row>
@@ -73,8 +71,8 @@ export default {
     clickcds(id) {
       this.$emit('submitss', { id: id });
     },
-    clickBtn(taskid, name, score) {
-      this.$emit('clickDialog', { id: taskid, name: name, score: score });
+    clickBtn(id, name, score) {
+      this.$emit('clickDialog', { id: id, name: name, score: score });
     },
     onSubmit() {
       this.$emit('submit', { data: this.form });

+ 3 - 4
src/layout/class/achieveList/peaceAchieve.vue

@@ -50,11 +50,10 @@ export default {
 </script>
 
 <style lang="less" scoped>
-.info {
-  padding: 0 30px;
-}
 .list {
-  border-bottom: 1px dashed #333;
+  background: #fff;
+  margin: 0 10px 10px 10px;
+  width: 95%;
 }
 .list .name {
   padding: 15px 15px;

+ 11 - 12
src/layout/index/mainData.vue

@@ -12,7 +12,7 @@
             </el-col>
           </el-row>
           <el-col :span="24" class="top">
-            <el-col :span="12" class="time">时间</el-col>
+            <el-col :span="12" class="time">上课时间</el-col>
             <el-col :span="12" class="date">
               <el-col :span="24"> {{ today.date }}</el-col>
               <el-col :span="24">{{ today.day }}</el-col>
@@ -25,7 +25,9 @@
               </el-col>
               <el-col :span="12" class="contextclass">
                 <p>{{ item.subname }}</p>
-                <p class="title" @click="click(item)">{{ item.teaname }}</p>
+                <p class="title">
+                  <span @click="click(item)">{{ item.teaname }}</span>
+                </p>
               </el-col>
               <el-col :span="24">
                 <p></p>
@@ -82,11 +84,10 @@ p {
   padding: 7px 0 0 0;
 }
 .beijing {
-  background-color: #eee;
-  min-height: 700px;
+  background-color: #f9fafc;
 }
 .top {
-  margin: 20px 0 0 0;
+  margin: 10px 0 0 0;
 }
 /deep/.el-button {
   border-radius: 11px;
@@ -94,26 +95,24 @@ p {
 }
 .time {
   background-color: #ffffff;
-  height: 70px;
   font-size: 16px;
-  padding: 0px 0px 0 50px;
-  line-height: 60px;
   color: #222222;
+  text-align: center;
+  padding: 15px 0;
 }
 .date {
   background-color: #ffffff;
-  height: 70px;
   font-size: 16px;
-
-  line-height: 30px;
   color: #222222;
+  text-align: center;
+  padding: 6px 0;
 }
 .context {
   background-color: #ffffff;
-  height: 102px;
   width: 92%;
   margin: 15px 15px 0 15px;
   color: #bbbbbb;
+  padding: 15px 0;
 }
 
 .contexttime {

+ 39 - 57
src/views/class/achieve.vue

@@ -33,14 +33,14 @@
 
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
-import achieves from './info/achieve.vue';
+import achieves from '@/layout/class/achieve.vue';
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapStudent } = createNamespacedHelpers('student');
 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: [],
+    homework: [],
+    groupsocre: '',
   }),
   created() {
     this.search();
@@ -97,66 +99,21 @@ 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;
+      classid = this.user.classid;
       const res = await this.list({ classid });
+
       this.$set(this, `peaceAchieveList`, res.data);
       let classsid = this.user.classid;
       const result = await this.uploadtasklist({ classsid });
 
-      for (const accc of res.data) {
-        var arr = result.data.filter(item => item.studentid === accc.id);
-      }
-
-      // let lessons = [];
-      let lessone = [];
-      let stus = [];
-      for (const val of result.data) {
-        let newsid = val.lessonid;
-        let classid = this.user.classid;
-        //查询这个班的课程
-        const lessonInfo = await this.lessonlist({ classid });
-
-        for (const hic of lessonInfo.data) {
-          //过滤出有作业的科目
-          var fff = hic.lessons.filter(item => item.subid === newsid);
-          for (const less of fff) {
-            this.$set(this, `subname`, less.subname);
-          }
-        }
-        val.subName = this.subname;
-
-        const stuInfo = await this.fet(val.studentid);
-
-        if (stuInfo.data.name) {
-          val.stuName = stuInfo.data.name;
-          //创建学生名字相关数组
-          let stu = [{ stuname: stuInfo.data.name, id: val.studentid, lesson: [] }];
-          //合并数组
-          stus = [...stu, ...stus];
-          //去掉重复数组对象
-          var appArray = _.uniqBy(stus, _.isEqual);
-          //合并数组
-          this.$set(this, `achieveList`, appArray);
-          let lessonss = [{ name: this.subname, id: val.studentid, taskid: val.id, score: val.score }];
-          lessone = [...lessonss, ...lessone];
-        }
-
-        for (const ss of appArray) {
-          var vre = lessone.filter(item => item.id === ss.id);
-
-          ss.lesson = vre;
-        }
-        // for (const eee of appArray) {
-        //   eee.less = lessone;
-        //   var qq = eee.less.filter(item => item.id === eee.id);
-
-        // }
+      for (const accc of result.data) {
+        var arr = res.data.filter(item => item.id === accc.studentid);
+        this.$set(this, `achieveList`, arr);
       }
-      this.$set(this, `task`, appArray);
     },
     // 学委上作业分+存储学生id
     clickAchieve({ id }) {
@@ -179,14 +136,37 @@ 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);
+        let nes = asd.filter(d => d);
+        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 } = {}) {
@@ -231,9 +211,9 @@ export default {
     },
     //为了获取当前点击学生id和当前学生上传的作业
     async onsist({ id }) {
-      var arr = this.task.filter(item => item.id === id);
+      const result = await this.uploadtasklist({ studentid: id });
 
-      this.$set(this, `lesson`, arr);
+      this.$set(this, `lesson`, result.data);
     },
     async opensave({ id, name, score }) {
       this.show = true;
@@ -243,8 +223,10 @@ export default {
     },
     async onsave(form) {
       this.form.id = this.taskid;
+
       let res = await this.uploadtaskupdate(this.form);
       this.show = false;
+      this.search();
     },
   },
 };

+ 0 - 5
src/views/home/index.vue

@@ -8,9 +8,6 @@
         <el-col :span="24" class="main">
           <mainData :lesson="lesson" :today="today" @getLesson="getLesson" :arrange="arrange"></mainData>
         </el-col>
-        <!-- <el-col :span="24" class="foot">
-          <footInfo></footInfo>
-        </el-col> -->
       </el-col>
     </el-row>
   </div>
@@ -18,7 +15,6 @@
 
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
-// import footInfo from '@/layout/common/footInfo.vue';
 import mainData from '@/layout/index/mainData.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: lesson } = createNamespacedHelpers('lesson');
@@ -27,7 +23,6 @@ export default {
   props: {},
   components: {
     NavBar,
-    // footInfo,
     mainData,
   },
   data: function() {

+ 6 - 1
src/views/question/dir/dir-quest.vue

@@ -103,4 +103,9 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+p {
+  padding: 0;
+  margin: 0;
+}
+</style>

+ 0 - 5
src/views/question/index.vue

@@ -8,9 +8,6 @@
         <el-col :span="24" class="main">
           <dir-quest v-if="user.type == 1"></dir-quest>
         </el-col>
-        <!-- <el-col :span="24" class="foot">
-          <footInfo></footInfo>
-        </el-col> -->
       </el-col>
     </el-row>
   </div>
@@ -19,7 +16,6 @@
 <script>
 import dirQuest from './dir/dir-quest.vue';
 import NavBar from '@/layout/common/topInfo.vue';
-// import footInfo from '@/layout/common/footInfo.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   metaInfo() {
@@ -29,7 +25,6 @@ export default {
   props: {},
   components: {
     NavBar,
-    // footInfo,
     dirQuest,
   },
   data: function() {