def choose_school(): while True: school_list = check_school(False) if not school_list: return choice = common.input_integer('请为课程选择学校') if choice == 'q': return choice if choice < 0 or choice > len(school_list): print('\033[31m学校编号非法!\033[0m') continue choice = int(choice) return school_list[choice]
def choose_upload_video(): upload_video_list = common.get_upload_video_list() if not upload_video_list: common.show_red('当前无可上传视频!') return while True: common.show_info(*upload_video_list) choice = common.input_integer('请选择上传视频编号') if choice == 'q': return if choice < 0 or choice > len(upload_video_list): common.show_red('选择编号非法!') continue return upload_video_list[choice]
def choose_teach_course(): print('\033[32m选择教授课程\033[0m') while True: course = check_course(False) choice = common.input_integer('请选择课程编号') if choice < 0 or choice > len(course): print('\033[31m课程编号非法!\033[0m') continue flag, msg = teacher_api.choose_teach_course(CURRENT_USER, course[choice]) if flag: print('\033[32m%s\033[0m' % msg) return else: print('\033[31m%s\033[0m' % msg)
def choose_student_course(name): while True: flag, course_list = teacher_api.get_student_course(name) if not flag: print('\033[31m%s\033[0m' % course_list) return print('-' * 30) for i, name in enumerate(course_list): print('%-4s %-10s' % (i, name)) print('-' * 30) choice = common.input_integer('请选择课程编号') if choice < 0 or choice > len(course): print('\033[31m课程编号非法!\033[0m') continue return course_list[choice]
def set_student_score(): common.show_green('修改学生成绩') while True: name = common.input_string('学生名字') if name == 'q': break course = common.input_string('学习课程') if course == 'q': break score = common.input_integer('课程成绩', is_float=True) if score == 'q': break flag, msg = teacher_api.set_student_score(CURRENT_USER, name, course, score) if not flag: common.show_red(msg) continue common.show_green(msg) return
def choose_course(): print('\033[32m选择课程\033[0m') while True: course = check_course(False) if not course: return choice = common.input_integer('请选择课程编号') if choice == 'q': break if choice < 0 or choice > len(course): print('\033[31m课程编号非法!\033[0m') continue flag, msg = student_api.choose_course(CURRENT_USER, course[choice]) if flag: print('\033[32m%s\033[0m' % msg) return else: print('\033[31m%s\033[0m' % msg)
def check_course_student(): print('\033[32m查看课程学员\033[0m') while True: course = check_teach_course(False) if not course: return print('-' * 30) choice = common.input_integer('请选择课程编号') if choice < 0 or choice > len(course): print('\033[31m课程编号非法!\033[0m') continue student_list = teacher_api.get_course_student(course[choice]) if not student_list: print('\033[31m课程学员列表为空!\033[0m') return print('-' * 30) for i, name in enumerate(student_list): print('%-4s %-10s' % (i, name)) print('-' * 30) return
def get_online_video(): params = { 'api': 'get_online_video', 'session_id': COOKIES['session_id'], 'data_size': None, 'is_file': False, 'role': 'admin' } online_video_list = client.send_data(params) if not online_video_list: common.show_red('当前没有在线视频!') return while True: common.show_info(*online_video_list) choice = common.input_integer('请选择在线视频编号') if choice == 'q': return if choice < 0 or choice > len(online_video_list): common.show_red('选择编号非法!') continue return online_video_list[choice]