mo 5 years ago
parent
commit
7a487a9936
2 changed files with 48 additions and 41 deletions
  1. 1 1
      src/utils/vueFilter.js
  2. 47 40
      src/views/teamDetail/components/resetClass.vue

+ 1 - 1
src/utils/vueFilter.js

@@ -340,7 +340,7 @@ Vue.filter('classType', value => {
     DEMO: '试听',
     SNAP: "临时班",
     PRACTICE: '网管课',
-    HIGH_ONLINE: '基础技能班(线上)'
+    HIGH_ONLINE: '乐团网管课'
   }
   return template[value]
 })

+ 47 - 40
src/views/teamDetail/components/resetClass.vue

@@ -354,9 +354,10 @@
           </el-select>
         </el-form-item>
         <el-form-item label="预计招生人数"
-                      prop="expectStudentNum"
-                      v-if="activeType=='HIGH_ONLINE'">
+                      v-if="isNewClass"
+                      prop="expectStudentNum">
           <el-input type="number"
+                    :disabled="activeType=='HIGH_ONLINE'"
                     @mousewheel.native.prevent
                     v-model="teacherForm.expectStudentNum"></el-input>
         </el-form-item>
@@ -1131,7 +1132,11 @@ export default {
     },
     // 删除学生 调整
     removeStudent (item) {
-      // removeStudents({ classGroupId:}).then(res => {
+      // 这里做判断如果是线上基础技能班 学生人数不能少于3人
+      if (this.activeType == 'HIGH_ONLINE' && this.activeListStudent.length <= 3) {
+        this.$message.error('乐团网管课不能小于3人')
+        return
+      }
       removeStudents({
         classGroupId: this.activeClass,
         userId: item.userId
@@ -1169,44 +1174,44 @@ export default {
         this.$message.error("至少添加一名学员");
         return;
       }
-      // if (this.activeType == 'HIGH_ONLINE') {
+      if (this.activeType == 'HIGH_ONLINE') {
 
-      //   superFindClassGroups({ classGroupId: this.activeClass }).then(res => {
-      //     if (res.code == 200) {
-      //       let maxNum = res.data.rows[0].expectStudentNum;
-      //       if (arr.length + this.activeListStudent.length > maxNum) {
-      //         this.$message.error('超过预计招生人数');
-      //         return;
-      //       } else if (this.activeListStudent.length > 5 || this.activeListStudent.length < 3) {
-      //         this.$message.error('线上技能班必须为3-5人');
-      //         return;
-      //       } else {
-      //         addStudents({
-      //           classGroupId: this.activeClass,
-      //           userIdsStr: arr.join(",")
-      //         }).then(res => {
-      //           if (res.code == 200) {
-      //             this.studentVisible = false;
-      //             this.$message.success("添加成功");
-      //             this.getList();
-      //             return
-      //           }
-      //         });
-      //       }
-      //     }
-      //   })
-      // } else {
-      addStudents({
-        classGroupId: this.activeClass,
-        userIdsStr: arr.join(",")
-      }).then(res => {
-        if (res.code == 200) {
-          this.studentVisible = false;
-          this.$message.success("添加成功");
-          this.getList();
-        }
-      });
-      // }
+        superFindClassGroups({ classGroupId: this.activeClass }).then(res => {
+          if (res.code == 200) {
+            let maxNum = res.data.rows[0].expectStudentNum;
+            if (arr.length + this.activeListStudent.length > maxNum) {
+              this.$message.error('超过预计招生人数');
+              return;
+            } else if (this.activeListStudent.length > 5 || this.activeListStudent.length < 3) {
+              this.$message.error('线上技能班必须为3-5人');
+              return;
+            } else {
+              addStudents({
+                classGroupId: this.activeClass,
+                userIdsStr: arr.join(",")
+              }).then(res => {
+                if (res.code == 200) {
+                  this.studentVisible = false;
+                  this.$message.success("添加成功");
+                  this.getList();
+                  return
+                }
+              });
+            }
+          }
+        })
+      } else {
+        addStudents({
+          classGroupId: this.activeClass,
+          userIdsStr: arr.join(",")
+        }).then(res => {
+          if (res.code == 200) {
+            this.studentVisible = false;
+            this.$message.success("添加成功");
+            this.getList();
+          }
+        });
+      }
     },
     SelectionMix (val) {
       this.activeSingleLists = val;
@@ -1259,10 +1264,12 @@ export default {
         return;
       }
       if (this.activeType == 'HIGH_ONLINE') {
+
         if (this.activeListStudent.length > 5 || this.activeListStudent.length < 3) {
           this.$message.error("线上技能班必须为3-5人");
           return;
         }
+        this.teacherForm.expectStudentNum = this.activeListStudent.length;
 
       }
       this.infoVisible = true;