浏览代码

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

lrf402788946 5 年之前
父节点
当前提交
d073d057bf

+ 14 - 1
src/layout/class/achieve.vue

@@ -7,7 +7,17 @@
             <peaceAchieve v-on="$listeners" :peaceAchieveList="peaceAchieveList" :showPicker="showPicker" :peaceScore="peaceScore"></peaceAchieve>
           </van-tab>
           <van-tab title="作业成绩">
-            <homeworkAchiece v-on="$listeners" :lesson="lesson" :achieveList="achieveList" :deptList="deptList" :show="show" :form="form"></homeworkAchiece>
+            <homeworkAchiece
+              v-on="$listeners"
+              :lesslist="lesslist"
+              :lesson="lesson"
+              :achieveList="achieveList"
+              :deptList="deptList"
+              :show="show"
+              :form="form"
+              :names="names"
+              :score="score"
+            ></homeworkAchiece>
           </van-tab>
         </van-tabs>
       </el-col>
@@ -29,6 +39,9 @@ export default {
     form: null, //修改form
     deptList: null,
     lesson: null,
+    lesslist: null,
+    names: null,
+    score: null,
   },
   components: {
     peaceAchieve, //平時成績

+ 28 - 19
src/layout/class/achieveList/homeworkAchiece.vue

@@ -5,17 +5,18 @@
         <van-collapse v-model="openCollapse">
           <van-collapse-item :name="index" v-for="(item, index) in achieveList" :key="index">
             <div slot="title" class="title">
-              <span class="name">{{ item.name }}</span>
-              <van-button type="primary" size="mini" @click="clickBtn(item.id)">上成绩</van-button>
+              <span class="name" @click="clickcds(item.id)">{{ item.stuname }}</span>
             </div>
-
-            <!-- <van-row v-for="(tag, index) in item.lesson" :key="index">
-              <van-col :span="14" class="score"> 课程名称:{{ tag.code }} </van-col>
-              <van-col :span="10" class="score"> 作业分:{{ tag.score }} 分</van-col>
-            </van-row> -->
             <van-row v-for="(tag, index) in lesson" :key="index">
-              <van-col :span="14" class="score"> 课程名称:{{ tag.subname }} </van-col>
-              <van-col :span="10" class="score"> 作业分:{{ tag.score }} 分</van-col>
+              <el-col :span="18">
+                <van-col :span="24" class="score"> 名称:{{ tag.name }} </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 type="primary" size="mini" @click="clickBtn(tag.taskid, tag.name, tag.score)">上成绩</van-button>
+                </van-col>
+              </el-col>
             </van-row>
           </van-collapse-item>
         </van-collapse>
@@ -23,13 +24,8 @@
     </el-row>
     <van-dialog v-model="show" title="学生成绩上传" :showConfirmButton="false">
       <van-form @submit="onSubmit">
-        <van-field v-model="form.name" name="学生名称" disabled />
-        <!-- <van-field v-model="form.lessonid" name="课程名称" label="课程名称" placeholder="请输入课程名称" /> -->
-        <span class="lesson">课程名称</span>
-        <el-select v-model="form.lessonid" placeholder="请选择课程名称">
-          <el-option v-for="(item, index) in deptList" :key="index" :label="item.name" :value="item.code"></el-option>
-        </el-select>
-        <van-field v-model="form.score" name="作业分数" label="作业分数" placeholder="请输入作业分数" />
+        <span class="lesson">课程名称</span><span class="lesson">{{ names }}</span>
+        <van-field v-model="form.score" name="作业分数" :value="score" label="作业分数" placeholder="请输入作业分数" />
         <div style="margin: 16px;">
           <van-button round block type="info" native-type="submit">
             提交
@@ -50,6 +46,9 @@ export default {
     lessonList: null,
     deptList: null,
     lesson: null,
+    lesslist: null,
+    names: null,
+    score: null,
   },
   components: {},
   data: () => ({
@@ -68,8 +67,14 @@ export default {
       this.value = value;
       this.showPicker = false;
     },
-    clickBtn(id) {
-      this.$emit('clickDialog', { id: id });
+    clickcds(id) {
+      this.$emit('submitss', { id: id });
+    },
+    clickBtn(taskid, name, score) {
+      console.log(taskid);
+      console.log(name);
+
+      this.$emit('clickDialog', { id: taskid, name: name, score: score });
     },
     onSubmit() {
       this.$emit('submit', { data: this.form });
@@ -105,6 +110,7 @@ p {
 /deep/.van-collapse-item__content {
   border-bottom-left-radius: 10px;
   border-bottom-right-radius: 10px;
+  padding: 5px 10px;
 }
 /deep/.van-collapse-item {
   margin: 0 0 10px 0;
@@ -113,9 +119,12 @@ p {
   padding: 10px 0 10px 0;
 }
 .list .score {
-  padding: 10px 0;
+  padding: 5px 0;
   font-size: 18px;
 }
+.anniu {
+  padding: 20px 0 0 0;
+}
 .lesson {
   font-size: 14px;
   padding: 0 21px 0 16px;

+ 67 - 0
src/layout/question/classProgress.vue

@@ -0,0 +1,67 @@
+<template>
+  <div id="classProgress">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="24" class="top">
+          <span style="padding:0 50px 0 0;">
+            问卷进度:<span>{{ progressInfo.answertotal }}/{{ progressInfo.alltotal }}</span>
+          </span>
+          <span>
+            总完成度:<span>{{ progressInfo.completiontotal }}</span>
+          </span>
+        </el-col>
+        <el-col :span="24" class="main">
+          <el-col :span="24" class="list" v-for="(item, index) in progressInfo.data" :key="index">
+            <el-col :span="16" class="name">
+              <span>{{ item.name }}</span>
+            </el-col>
+            <el-col :span="8" class="completion"> 完成度:{{ item.completion }} </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'classProgress',
+  props: {
+    progressInfo: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.info {
+  padding: 15px 10px 0 10px;
+}
+.info .top {
+  text-align: center;
+  padding: 10px 0;
+  border-bottom: 1px dashed #333;
+}
+.info .top span span {
+  color: red;
+}
+.main {
+  padding: 10px 0 0 0;
+}
+.list {
+  padding: 10px;
+  background: #fff;
+  margin: 0 0 10px 0;
+  border-radius: 10px;
+}
+.list .name {
+  padding: 0;
+}
+.list .completion {
+  padding: 0;
+}
+</style>

+ 91 - 0
src/layout/question/quesProgress.vue

@@ -0,0 +1,91 @@
+<template>
+  <div id="quesProgress">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="24" class="list" v-for="(item, index) in quesProgress" :key="index">
+          <el-col :span="18" class="name">
+            <p>{{ item.name }}</p>
+          </el-col>
+          <el-col :span="6" class="btn">
+            <el-link :underline="false" @click="showBtn(item.id)">查看完成度</el-link>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+    <!-- <van-overlay :show="show" @click="closeBtn">
+      <div class="wrapper" @click="closeBtn">
+        <el-col :span="24" class="center">
+          <el-col :span="24" class="top">
+            <span>问卷进度:{{ progressInfo.answertotal }}/{{ progressInfo.alltotal }}</span>
+          </el-col>
+          <el-col :span="24" v-for="(item, index) in progressInfo.data" :key="index">
+            <el-col :span="12">
+              <span>{{ item.name }}</span>
+            </el-col>
+            <el-col :span="12">
+              {{ item.completion }}
+            </el-col>
+          </el-col>
+        </el-col>
+      </div>
+    </van-overlay> -->
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'quesProgress',
+  props: {
+    quesProgress: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {
+    classid() {
+      return this.$route.query.classid;
+    },
+  },
+  methods: {
+    showBtn(questionnaireid) {
+      this.$router.push({ path: '/question/classProgress', query: { questionnaireid: questionnaireid, classid: this.classid } });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+p {
+  padding: 0;
+  margin: 0;
+}
+.list {
+  padding: 10px;
+  margin: 10px;
+  background: #fff;
+  border-radius: 10px;
+  width: 95%;
+}
+.list .name p {
+  padding: 10px 0;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.list .btn {
+  text-align: center;
+  padding: 10px 0;
+}
+.wrapper {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 100%;
+}
+.center {
+  width: 90%;
+  background: #ffffff;
+  padding: 0 0 10px 0;
+  border-radius: 10px;
+}
+</style>

+ 1 - 1
src/layout/question/teaClass.vue

@@ -8,7 +8,7 @@
             <p>班级人数:{{ item.number }}</p>
           </el-col>
           <el-col :span="7" class="btn">
-            <el-link :underline="false" @click="$router.push({ path: '/question/progress', query: { classid: item.id } })">班级问卷进度</el-link>
+            <el-link :underline="false" @click="$router.push({ path: '/question/teaProgress', query: { classid: item.id } })">班级问卷进度</el-link>
           </el-col>
         </el-col>
       </el-col>

+ 17 - 11
src/layout/user/workList.vue

@@ -1,13 +1,14 @@
 <template>
   <div id="leaveList">
     <el-row>
-      <el-col :span="24" class="list" v-for="(item, index) in workLists" :key="index">
-        <el-col :span="14" class="time">
-          <el-col>科目:{{ item.name }}</el-col>
-          <el-col>标题{{ item.title }}</el-col>
-          <el-col :span="24" class="anniu">
-            <el-button type="primary" size="small" @click="clickBtn(item.id)">在线作答</el-button>
-            <el-button type="primary" size="small" @click="clickzy(item.id)">上传作业</el-button>
+      <el-col :span="24" class="info">
+        <el-col :span="24" class="list" v-for="(item, index) in workLists" :key="index">
+          <el-col :span="14" class="time">
+            <el-col>科目:{{ item.name }}</el-col>
+            <el-col :span="24" class="anniu">
+              <el-button v-if="item.display === 'second'" type="primary" size="small" @click="clickBtn(item.id)">在线作答</el-button>
+              <el-button v-else type="primary" size="small" @click="clickzy(item.id)">上传作业</el-button>
+            </el-col>
           </el-col>
         </el-col>
       </el-col>
@@ -20,6 +21,8 @@ export default {
   name: 'leaveList',
   props: {
     workLists: null,
+    names: null,
+    display: { type: String, default: 'first' },
   },
   components: {},
   data: () => ({}),
@@ -27,12 +30,11 @@ export default {
   computed: {},
   methods: {
     clickBtn(id) {
-      console.log(id);
       this.$router.push({ path: '/user/dati', query: { id: id } });
     },
-
     clickzy(id) {
       console.log(id);
+
       this.$router.push({ path: '/user/chuanzuoye', query: { id: id } });
     },
   },
@@ -44,14 +46,18 @@ p {
   padding: 0;
   margin: 0;
 }
+.info {
+  min-height: 300px;
+}
+
 .list {
   width: 97%;
-  padding: 15px;
+  padding: 0px 0px 0 70px;
   background-color: #fff;
   border-radius: 15px;
   margin: 0 5px 5px 5px;
 }
-.list .time p {
+.list .time {
   padding: 5px 0;
 }
 .list .ispass {

+ 10 - 3
src/router/index.js

@@ -70,12 +70,19 @@ const routes = [
     meta: { title: '填写答案', isleftarrow: true },
     component: () => import('../views/question/question.vue'),
   },
+  // 班主任查看班级问卷调查
+  {
+    path: '/question/teaProgress',
+    meta: { title: '问卷调查-班级问卷', isleftarrow: true },
+    component: () => import('../views/question/teaProgress.vue'),
+  },
   // 班主任查看班级问卷调查答题进度
   {
-    path: '/question/progress',
-    meta: { title: '问卷调查-问卷进度', isleftarrow: true },
-    component: () => import('../views/question/progress.vue'),
+    path: '/question/classProgress',
+    meta: { title: '问卷调查-班级问卷答题进度', isleftarrow: true },
+    component: () => import('../views/question/classProgress.vue'),
   },
+
   // 个人信息
   {
     path: '/user/index',

+ 2 - 0
src/store/index.js

@@ -6,6 +6,7 @@ import group from '@frame/store/group';
 import question from '@frame/store/question';
 import questionAnswer from '@frame/store/question-answer';
 import questionnaire from '@frame/store/questionnaire';
+import completion from '@frame/store/question-completion';
 import director from '@frame/store/director';
 import student from '@frame/store/student';
 import lesson from '@frame/store/lesson';
@@ -46,5 +47,6 @@ export default new Vuex.Store({
     subject,
     task,
     dept,
+    completion,
   },
 });

+ 83 - 4
src/views/class/achieve.vue

@@ -8,16 +8,22 @@
         </el-col>
         <el-col :span="24" class="main">
           <achieves
+            @clickDialog="opensave"
+            @submit="onsave"
             :peaceAchieveList="peaceAchieveList"
             :showPicker="showPicker"
             :peaceScore="peaceScore"
             @showBtn="showBtn"
             @onConfirm="onConfirm"
             :achieveList="achieveList"
+            @submitss="onsist"
             :show="show"
             :form="form"
             :deptList="deptList"
             :lesson="lesson"
+            :lesslist="lesslist"
+            :names="names"
+            :score="score"
           ></achieves>
         </el-col>
       </el-col>
@@ -33,6 +39,7 @@ 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');
 
 export default {
   name: 'achieve',
@@ -47,8 +54,11 @@ export default {
     peaceScore: '',
     studid: '',
     lesson: [],
+    lesslist: [],
+    names: '',
+    score: '',
     deptList: [],
-    achieveList: {},
+    achieveList: [],
     show: false,
     form: {},
     title: '',
@@ -57,9 +67,11 @@ export default {
     navShow: true,
     // 修改
     stuid: '',
+    taskid: '',
   }),
   created() {
     this.search();
+    this.searchinfo();
   },
   computed: {
     ...mapState(['user']),
@@ -77,14 +89,14 @@ export default {
   methods: {
     ...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
     ...mapClass({ classinfo: 'fetch', classlist: 'query' }),
-    ...mapLesson({ lessoninfo: 'fetch', classlist: 'query' }),
-    ...mapUploadtask({ uploadtaskinfo: 'fetch', uploadtasklist: 'query' }),
+    ...mapLesson({ lessoninfo: 'fetch', lessonlist: 'query' }),
+    ...mapUploadtask({ uploadtaskinfo: 'fetch', uploadtasklist: 'query', uploadtaskupdate: 'update' }),
+    ...mapSubject({ subjectinfo: 'fetch', subjectlist: 'query' }),
     // 平时成绩学生名单查询+作业成绩学生名单查询
     async search() {
       let classid = this.user.classid;
       const res = await this.list({ classid });
       this.$set(this, `peaceAchieveList`, res.data);
-      this.$set(this, `achieveList`, res.data);
     },
     // 学委上作业分+存储学生id
     clickAchieve({ id }) {
@@ -116,6 +128,73 @@ export default {
       this.showPicker = false;
       this.search();
     },
+    //  作业成绩列表
+    async searchinfo({ ...info } = {}) {
+      let classid = this.user.classid;
+      const result = await this.uploadtasklist({ classid });
+      const res = await this.list({ classid });
+      for (const accc of res.data) {
+        console.log(accc.id);
+        var arr = result.data.filter(item => item.studentid === accc.id);
+        // console.log(arr);
+      }
+      let lessons = [];
+      let stus = [];
+      for (const val of result.data) {
+        const lessonInfo = await this.subjectinfo(val.lessonid);
+        val.subName = lessonInfo.data.name;
+        const stuInfo = await this.fet(val.studentid);
+        val.stuName = stuInfo.data.name;
+        //创建学生名字相关数组
+        let stu = [{ stuname: stuInfo.data.name, id: val.studentid }];
+        //合并数组
+        stus = [...stu, ...stus];
+
+        //去掉重复数组对象
+        var appArray = _.uniqWith(stus, _.isEqual);
+        //合并数组
+        let lesson = [{ name: lessonInfo.data.name, id: val.studentid }];
+        lessons = [...lesson, ...lessons];
+        // console.log(lessons);
+        this.$set(this, `achieveList`, appArray);
+        // this.$set(this, `lesson`, lessons);
+      }
+    },
+    //为了获取当前点击学生id和当前学生上传的作业
+    async onsist({ id }) {
+      let classid = this.user.classid;
+      const result = await this.uploadtasklist({ classid });
+      const res = await this.list({ classid });
+      for (const accc of res.data) {
+        var arr = result.data.filter(item => item.studentid === accc.id);
+      }
+      let lessons = [];
+      for (const val of result.data) {
+        const lessonInfo = await this.subjectinfo(val.lessonid);
+        val.subName = lessonInfo.data.name;
+        const stuInfo = await this.fet(val.studentid);
+        val.stuName = stuInfo.data.name;
+        let lesson = [{ name: lessonInfo.data.name, id: val.studentid, taskid: val.id, score: val.score }];
+        //合并数组
+        lessons = [...lesson, ...lessons];
+        //过滤掉与当前不同的学生id
+        var arr = lessons.filter(item => item.id === id);
+      }
+      this.$set(this, `lesson`, arr);
+    },
+    async opensave({ id, name, score }) {
+      this.show = true;
+      console.log(id, name, score);
+      this.$set(this, `names`, name);
+      this.$set(this.form, `score`, score);
+      this.$set(this, `taskid`, id);
+    },
+    async onsave(form) {
+      console.log(this.form);
+      this.form.id = this.taskid;
+      let res = await this.uploadtaskupdate(this.form);
+      this.show = false;
+    },
   },
 };
 </script>

+ 23 - 5
src/views/question/progress.vue

@@ -1,12 +1,12 @@
 <template>
-  <div id="progress">
+  <div id="classProgress">
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          问卷调查
+          <classProgressList :progressInfo="progressInfo"></classProgressList>
         </el-col>
       </el-col>
     </el-row>
@@ -15,15 +15,19 @@
 
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
-import teaLeaveList from '@/layout/user/teaLeaveList.vue';
+import classProgressList from '@/layout/question/classProgress.vue';
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: completion } = createNamespacedHelpers('completion');
+import _ from 'lodash';
 export default {
-  name: 'progress',
+  name: 'classProgress',
   props: {},
   components: {
     NavBar, //头部导航
+    classProgressList, //班级问卷进度
   },
   data: () => ({
+    progressInfo: {},
     title: '',
     isleftarrow: '',
     navShow: true,
@@ -32,6 +36,12 @@ export default {
     this.searchInfo();
   },
   computed: {
+    questionnaireid() {
+      return this.$route.query.questionnaireid;
+    },
+    classid() {
+      return this.$route.query.classid;
+    },
     ...mapState(['user']),
   },
   mounted() {
@@ -44,7 +54,15 @@ export default {
       this.isleftarrow = to.meta.isleftarrow;
     },
   },
-  methods: {},
+  methods: {
+    ...completion({ getCompletion: 'query' }),
+    async searchInfo() {
+      const termFetch = await this.getCompletion({ type: '2', typeid: this.classid, questionnaireid: this.questionnaireid });
+      if (this.$checkRes(termFetch)) {
+        this.$set(this, `progressInfo`, termFetch);
+      }
+    },
+  },
 };
 </script>
 

+ 98 - 0
src/views/question/teaProgress.vue

@@ -0,0 +1,98 @@
+<template>
+  <div id="teaProgress">
+    <el-row>
+      <el-col :span="24" class="style">
+        <el-col :span="24" class="top">
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
+        </el-col>
+        <el-col :span="24" class="main">
+          <quesProgress :quesProgress="quesProgress"></quesProgress>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import NavBar from '@/layout/common/topInfo.vue';
+import quesProgress from '@/layout/question/quesProgress.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
+const { mapActions: termquest } = createNamespacedHelpers('termquest');
+import _ from 'lodash';
+export default {
+  name: 'teaProgress',
+  props: {},
+  components: {
+    NavBar, //头部导航
+    quesProgress, //班级问卷进度
+  },
+  data: () => ({
+    classInfo: {},
+    quest: [],
+    quesProgress: [],
+    title: '',
+    isleftarrow: '',
+    navShow: true,
+  }),
+  created() {
+    this.searchInfo();
+  },
+  computed: {
+    id() {
+      return this.$route.query.classid;
+    },
+    ...mapState(['user']),
+  },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
+  methods: {
+    ...classes({ classFectch: 'fetch' }),
+    ...questionnaire({ getQuestionnaireList: 'query' }),
+    ...termquest({ getTermQuestList: 'query' }),
+    // 查询班级信息,全部问卷,当前期问卷
+    async searchInfo() {
+      // 班级信息
+      let classInfo = await this.classFectch(this.id);
+      if (this.$checkRes(classInfo)) {
+        this.$set(this, `classInfo`, classInfo.data);
+      }
+      //查询所有问卷
+      const quest = await this.getQuestionnaireList();
+      if (this.$checkRes(quest)) {
+        this.$set(this, `quest`, quest.data);
+      }
+      //查询这期的所有问卷,id=>数据
+      const res = await this.getTermQuestList({ termid: this.classInfo.termid });
+      let { questionnaireid, termid, ...othrers } = res.data[0];
+      let newArr = this.quest.filter(q => (_.find(questionnaireid, sq => sq === q.id) ? q : ''));
+      this.$set(this, `quesProgress`, newArr);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.style {
+  width: 100%;
+  min-height: 667px;
+  position: relative;
+  background-color: #f9fafc;
+}
+.top {
+  height: 46px;
+  overflow: hidden;
+}
+.main {
+  min-height: 570px;
+}
+</style>

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

@@ -8,7 +8,7 @@
         <el-col :span="24" class="main">
           <el-col :span="24" class="leaveBtn"> </el-col>
           <el-col :span="24" class="leaveList">
-            <workList v-if="!loading" :workLists="workLists"></workList>
+            <workList :workLists="workLists" :display="display"></workList>
           </el-col>
           <el-col :span="24" class="foot">
             <footInfo></footInfo>
@@ -24,7 +24,11 @@ import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import workList from '@/layout/user/workList.vue';
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapClass } = createNamespacedHelpers('classes');
+const { mapActions: mapLesson } = createNamespacedHelpers('lesson');
 const { mapActions: mapTask } = createNamespacedHelpers('task');
+const { mapActions: mapSubject } = createNamespacedHelpers('subject');
+
 export default {
   name: 'homework',
   props: {},
@@ -34,9 +38,8 @@ export default {
     footInfo,
   },
   data: () => ({
-    loading: true,
     workLists: [],
-    show: false,
+    display: '',
     navShow: true,
     title: '',
     isleftarrow: '',
@@ -59,11 +62,30 @@ export default {
   },
   methods: {
     ...mapTask({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
+    ...mapClass({ classinfo: 'fetch', classquery: 'query' }),
+    ...mapLesson({ lessonList: 'query', lessonadd: 'create', lessonfet: 'fetch', lessonupdates: 'update' }),
+
+    ...mapSubject({ subjectList: 'query', subjectListadd: 'create', subjectListfet: 'fetch', subjectListpdates: 'update' }),
+
     async search() {
-      const res = await this.list();
-      console.log(res.data);
-      this.$set(this, `workLists`, res.data);
-      this.loading = false;
+      let classid = this.user.classid;
+      const ress = await this.classinfo(classid);
+      console.log(ress.data.lessonid);
+      let lessonid = ress.data.lessonid;
+      const res = await this.subjectList({ lessonid });
+      console.log(res);
+
+      const resout = await this.list();
+      for (const val of resout.data) {
+        // console.log(result.data.lessons);
+        // var crr = result.data.lessons.filter(item => item.subid);
+        this.$set(this, `workLists`, res.data);
+        var arr = res.data.filter(item => item.name === val.name);
+        console.log(arr);
+        for (const att of arr) {
+          att.display = 'second';
+        }
+      }
     },
   },
 };
@@ -87,4 +109,8 @@ export default {
   text-align: center;
   padding: 15px 0;
 }
+.leaveList {
+  position: relative;
+  background-color: #f9fafc;
+}
 </style>