dusenyao 3 years ago
parent
commit
4073a736d1
1 changed files with 18 additions and 4 deletions
  1. 18 4
      src/views/teacher/create_course/step_table/CourseInfo.vue

+ 18 - 4
src/views/teacher/create_course/step_table/CourseInfo.vue

@@ -59,8 +59,8 @@
           <el-date-picker v-model="form.end_date" type="date" value-format="yyyy-MM-dd" />
           <el-date-picker v-model="form.end_date" type="date" value-format="yyyy-MM-dd" />
         </el-form-item>
         </el-form-item>
 
 
-        <el-form-item :label="$t('Key254')">
-          <el-input v-model="form.student_count_max" class="student-count" @input="changeStudent" />
+        <el-form-item :label="$t('Key254')" prop="student_count_max">
+          <el-input v-model="form.student_count_max" class="student-count" maxlength="3" @input="changeStudent" />
           <el-checkbox v-model="form.is_auto_close">
           <el-checkbox v-model="form.is_auto_close">
             {{ $t('Key266') }}
             {{ $t('Key266') }}
           </el-checkbox>
           </el-checkbox>
@@ -139,6 +139,14 @@ export default {
         callback();
         callback();
       }
       }
     };
     };
+    const validateCountMax = (rule, value, callback) => {
+      if (value < 1 || value > 999) {
+        callback(new Error('学生数量最小为1,最大为999'));
+      } else {
+        callback();
+      }
+    };
+
     const query = this.$route.query;
     const query = this.$route.query;
 
 
     return {
     return {
@@ -155,7 +163,7 @@ export default {
         teacher_id_list: [],
         teacher_id_list: [],
         begin_date: '',
         begin_date: '',
         end_date: '',
         end_date: '',
-        student_count_max: '',
+        student_count_max: 1,
         is_auto_close: false,
         is_auto_close: false,
         student_enter_control_type: 0,
         student_enter_control_type: 0,
         price: '0.00',
         price: '0.00',
@@ -163,7 +171,8 @@ export default {
         is_enable_XYZP: false
         is_enable_XYZP: false
       },
       },
       formRules: {
       formRules: {
-        name: { trigger: 'blur', validator: validateName }
+        name: { trigger: 'blur', validator: validateName },
+        student_count_max: { trigger: 'blur', validator: validateCountMax }
       },
       },
       orgList: [],
       orgList: [],
       user_list: [],
       user_list: [],
@@ -180,6 +189,11 @@ export default {
     if (this.is_use_template) {
     if (this.is_use_template) {
       this.getCourseInfo_ContainCSItem(this.template_id);
       this.getCourseInfo_ContainCSItem(this.template_id);
     }
     }
+    // 创建课程时,默认授课教师是自己
+    if (!this.id && !this.is_template) {
+      this.form.teacher_id_list.push(this.$store.state.user.user_code);
+      this.getUserList();
+    }
   },
   },
   methods: {
   methods: {
     nextStep() {
     nextStep() {