reloaded 5 年之前
父节点
当前提交
c22c4a00dd
共有 2 个文件被更改,包括 43 次插入5 次删除
  1. 27 0
      config/menu-config.js
  2. 16 5
      layout/admin/navBar/default-select.vue

+ 27 - 0
config/menu-config.js

@@ -59,6 +59,33 @@ const teacher = [
     name: '查看计划', //上报名单
     module: 'teacher',
   },
+  {
+    path: '',
+    name: '班级管理',
+    module: 'teacher',
+    children: [
+      {
+        path: '/lesson/index',
+        name: '课程信息',
+        module: 'teacher',
+      },
+      {
+        path: '/task/index',
+        name: '作业管理',
+        module: 'teacher',
+      },
+      {
+        path: '/class/index',
+        name: '班级信息',
+        module: 'teacher',
+      },
+      {
+        path: '/class/classStuList',
+        name: '学生名单',
+        module: 'teacher',
+      },
+    ],
+  },
 ];
 export const menu = [
   {

+ 16 - 5
layout/admin/navBar/default-select.vue

@@ -30,7 +30,7 @@
             </el-select>
           </el-tooltip>
         </span>
-        <span v-if="user.type == 1">
+        <span v-if="user.type == 1 || user.type == 3">
           <el-tooltip content="选择要查看的班级" effect="dark" placement="bottom">
             <el-select v-model="options.classid" placeholder="选择要查看的班级" size="mini" @change="setVuexOpt()">
               <el-option v-for="(i, index) in classList" :key="index" :label="i.name" :value="i._id"></el-option>
@@ -52,6 +52,7 @@ const { mapActions: trainBatch } = createNamespacedHelpers('trainBatch');
 const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
 const { mapActions: setting } = createNamespacedHelpers('setting');
 const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: lesson } = createNamespacedHelpers('lesson');
 export default {
   name: 'default-select',
   props: {},
@@ -70,7 +71,7 @@ export default {
     // this.$set(this, `options`, _.cloneDeep(this.defaultOption));
     this.search({ type: 'planYear' });
     this.checkOption();
-    if (this.user.type == 1) this.getClassOption();
+    if (this.user.type == 1 || this.user.type == 3) this.getClassOption();
     this.loading = false;
   },
   methods: {
@@ -79,6 +80,7 @@ export default {
     ...trainplan({ getplan: 'query' }),
     ...setting({ sFetch: 'fetch', sUpdate: 'update' }),
     ...classes({ getClassList: 'query' }), //仅供班主任使用
+    ...lesson({ teaclass: 'teaclass' }), //仅供老师使用
     async search({ type, ...info }) {
       let res = await _.get(this, `get${type}`)({ ...info });
       if (this.$checkRes(res)) {
@@ -118,7 +120,7 @@ export default {
     toCheckUserType() {
       this.setVuexOpt();
       this.options.classid = undefined;
-      if (this.user.type == 1) this.getClassOption();
+      if (this.user.type == 1 || this.user.type == 3) this.getClassOption();
     },
     setVuexOpt() {
       this.changeOpt(this.options);
@@ -142,9 +144,18 @@ export default {
     //班主任使用,默认班级
     async getClassOption() {
       let termid = _.get(this.defaultOption, 'termid');
+      let planid = _.get(this.defaultOption, 'planid');
       if (!termid) return;
-      let res = await this.getClassList({ termid: this.defaultOption.termid, headteacherid: this.user.userid });
-      if (this.$checkRes(res)) this.$set(this, `classList`, res.data);
+      let res;
+      if (this.user.type == 1) {
+        res = await this.getClassList({ termid: this.defaultOption.termid, headteacherid: this.user.userid });
+        if (this.$checkRes(res)) this.$set(this, `classList`, res.data);
+      }
+      if (this.user.type == 3) {
+        res = await this.teaclass({ planid: planid, teaid: this.user.userid });
+        const elm = res.data.filter(item => item.termid == termid);
+        this.$set(this, `classList`, elm);
+      }
     },
   },
   watch: {