Пример #1
0
def create_course():
    print('\033[32m创建课程\033[0m')
    while 1:
        schools = admin_api.get_schools()
        while 1:
            print('-' * 30)
            for k, v in enumerate(schools):
                print('%-4s %-10s' % (k, v))
            print('-' * 30)
            choice = input('请选择校区编号 >>: ').strip()
            if not choice.isdigit():
                print('编号必须是数字!')
                continue
            choice = int(choice)
            if choice <= 0 or choice > len(schools):
                print('编号超出范围!')
                continue
            school_name = schools[choice]
            break
        name = input('请输入课程名称 >>: ').strip()
        price = input('请输入课程价格 >>: ').strip()
        cycle = input('请输入课程周期 >>: ').strip()
        flag, msg = admin_api.create_school(name, price, cycle, school_name)
        print(msg)
        if flag:
            return
Пример #2
0
def create_teacher():
    print('\033[32m创建老师\033[0m')
    while 1:
        name = input('请输入老师名字 >>: ').strip()
        if name == 'q': break
        flag, msg = admin_api.create_school(name)
        print(msg)
        if flag:
            return
Пример #3
0
def create_school():
    print('\033[32m创建学校\033[0m')
    while 1:
        name = input('请输入学校名称 >>: ').strip()
        if name == 'q': break
        addr = input('请输入学校地址 >>: ').strip()
        flag, msg = admin_api.create_school(name, addr)
        print(msg)
        if flag:
            return
Пример #4
0
def create_school():
    print('\033[32m创建学校\033[0m')
    while True:
        name = input('请输入学校名 >>: ').strip()
        addr = input('请输入学校地址 >>: ').strip()
        flag, msg = admin_api.create_school(name, addr)
        if flag:
            print(msg)
            return
        else:
            print(msg)
Пример #5
0
def create_school():
    print('\033[32m创建学校\033[0m')
    while True:
        name = input('请输入学校名称 >>: ').strip()
        if name == 'q': break
        address = input('请输入学校地址 >>: ').strip()
        flag, msg = admin_api.create_school(CURRENT_USER, name, address)
        if flag:
            print('\033[32m%s\033[0m' % msg)
            return
        else:
            print('\033[31m%s\033[0m' % msg)
Пример #6
0
def create_school():
    common.show_green('创建学校')
    while True:
        name = common.input_string('学校名称')
        if name == 'q': break
        address = common.input_string('学校地址')
        if address == 'q': break
        flag, msg = admin_api.create_school(CURRENT_USER, name, address)
        if not flag:
            common.show_red(msg)
            continue
        common.show_green(msg)
        return
Пример #7
0
def create_school():
    print('\033[32m创建学校\033[0m')
    while True:
        name = common.input_string('学校名称')
        if name == 'q':
            break
        address = common.input_string('学校地址')
        if address == 'q':
            break
        flag, msg = admin_api.create_school(CURRENT_USER, name, address)
        if flag:
            print('\033[32m%s\033[0m' % msg)
            return
        else:
            print('\033[31m%s\033[0m' % msg)