Browse Source

单课时时长:大于零的整数

skyblued 2 years ago
parent
commit
4059bc40f1
1 changed files with 6 additions and 13 deletions
  1. 6 13
      src/teacher/piano-room/class-arrangement/index.tsx

+ 6 - 13
src/teacher/piano-room/class-arrangement/index.tsx

@@ -21,6 +21,7 @@ import ColHeader from '@/components/col-header'
 import ColPopup from '@/components/col-popup'
 import SelectStudents, { IStudent } from './select-students'
 import CourseSchedule from './course-schedule'
+import { checkNumberInteger } from '@/helpers/toolsValidate'
 const fieldProps = {
   'is-link': true,
   readonly: true,
@@ -216,6 +217,10 @@ export default defineComponent({
         Toast('请填写单课时时长')
         return
       }
+      if (checkNumberInteger(String(params.singleClssTime)) || params.singleClssTime < 0) {
+        Toast('课时时长为正整数')
+        return
+      }
       if (!params.date) {
         Toast('请选择开始日期')
         return
@@ -333,19 +338,7 @@ export default defineComponent({
               type="number"
               label="单课时时长"
               placeholder="请输入课程时长"
-              modelValue={params.singleClssTime}
-              onUpdate:modelValue={t => {
-                if (Math.abs(t) > 60) {
-                  Toast('时长不能大于60分钟')
-                  return
-                }
-                if (Math.abs(t) === 0) {
-                  Toast('时长不能小于1分钟')
-                  return
-                }
-                params.singleClssTime = Math.abs(t)
-              }}
-              // v-model={params.singleClssTime}
+              v-model={params.singleClssTime}
               v-slots={{
                 'right-icon': () => <div>分钟</div>
               }}