diff --git a/src/functions/course_add.ts b/src/functions/course_add.ts index 4f302cc..397008d 100644 --- a/src/functions/course_add.ts +++ b/src/functions/course_add.ts @@ -140,14 +140,24 @@ function searchAdd(course_list: Course[]) { export function push_to_table(mode: Number, item: any) { if (mode == 1) { console.log(item); - if ( - item.className == "" || - item.classRoom == "" || - item.weekDay == "星期" || - item.start == "始堂" || - item.end == "終堂" - ) { - alert("錯誤"); + if (item.className === undefined) { + alert("請輸入課程名稱"); + return false; + } + else if (item.classRoom === undefined) { + alert("請輸入教室"); + return false; + } + else if (item.weekDay == "星期") { + alert("請選擇星期"); + return false; + } + else if (item.start == "始堂") { + alert("請選擇開始時間"); + return false; + } + else if (item.end == "終堂") { + alert("請選擇結束時間"); return false; } let check = courseAdd(