def Main(stuId): allcourse = get_all_course(stuId) if allcourse == 0: print("获取失败") else: index = 1 for i in allcourse: print(f"【{index}】{i['courseName']}\t{i['mainTeacherName']}") index += 1 course_index = int(input("请输入数字序号:")) - 1 openClassId = allcourse[course_index]['openClassId'] courseOpenId = allcourse[course_index]['courseOpenId'] homeworklist = get_homework_list(stuId, openClassId, courseOpenId) if homeworklist == 0: print("获取失败") else: index = 1 for i in homeworklist: print(f'【{index}】{i["title"]}\t{i["stuHomeworkState"]}') index += 1 homework_index = int(input("请输入数字序号:")) - 1 homeworkId = homeworklist[homework_index]['homeworkId'] homeworkTermTimeId = homeworklist[homework_index]['homeworkTermTimeId'] grades = get_homework_grade(openClassId, homeworkId, stuId, homeworkTermTimeId) index = 1 for i in grades: print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}") index += 1 target = int(input("请输入要修改的序号:")) - 1 homeworkStuId = grades[target]['homeworkStuId'] getScore = int(input("请输入目标分数(整数):")) Teaid = input("请输入教师ID(获取方法见www.lanol.cn):") re_grade(Teaid, homeworkStuId, getScore)
def main(stuId): time = input("请输入结束时间(格式2020-5-21):") teaid = input("请输入教师ID(获取方法:www.lanol.cn):") allcourse = get_all_course(stuId) if allcourse == 0: print("获取失败") else: index = 1 for i in allcourse: print(f"【{index}】{i['courseName']}\t{i['mainTeacherName']}") index += 1 course_index = int(input("请输入数字序号:")) - 1 openClassId = allcourse[course_index]['openClassId'] courseOpenId = allcourse[course_index]['courseOpenId'] homeworklist = get_homework_list(stuId, openClassId, courseOpenId) if homeworklist == 0: print("获取失败") else: index = 1 for i in homeworklist: print(f'【{index}】{i["title"]}\t{i["stuHomeworkState"]}') index += 1 homework_index = int(input("请输入数字序号:")) - 1 homeworkId = homeworklist[homework_index]['homeworkId'] retime(time, teaid, homeworkId, courseOpenId, openClassId)
def main(stuId): allcourse = get_all_course(stuId) openClassId = allcourse['openClassId'] courseOpenId = allcourse['courseOpenId'] homeworklist = get_homework_list(stuId, openClassId, courseOpenId) if homeworklist == 0: print("获取失败") else: homeworkTermTimeId = homeworklist['homeworkTermTimeId'] homeworkId = homeworklist['homeworkId'] grades = get_homework_grade(openClassId, homeworkId, stuId, homeworkTermTimeId) if grades != 0: index = 1 for i in grades: print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}") index += 1 target = int(input("请输入要修改的序号:")) - 1 homeworkStuId = grades[target]['homeworkStuId'] else: input("回车键后退出") teaId = input("请输入教师ID") url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/rejectHomework' data = { 'homeworkStuId': homeworkStuId, 'teaId': teaId, } result = requests.post(url=url, data=data).json() print(result['msg']) sele = input("【1】返回首页\n【2】返回上级\n请选择:") if sele == 2: main(stuId) else: from Main import main as menu menu()
def Main(stuId): print("注意:改分只可以改非题库作业,需要老师批阅的") allcourse = get_all_course(stuId) openClassId = allcourse['openClassId'] courseOpenId = allcourse['courseOpenId'] homeworklist = get_homework_list(stuId, openClassId, courseOpenId) if homeworklist == 0: print("获取失败") else: homeworkTermTimeId = homeworklist['homeworkTermTimeId'] homeworkId = homeworklist['homeworkId'] grades = get_homework_grade(openClassId, homeworkId, stuId, homeworkTermTimeId) if grades != 0: index = 1 for i in grades: print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}") index += 1 target = int(input("请输入要修改的序号:")) - 1 if target > len(grades): print("请输入正确的序号") target = int(input("请输入要修改的序号:")) - 1 homeworkStuId = grades[target]['homeworkStuId'] getScore = int(input("请输入目标分数(整数):")) result = re_grade(homeworkStuId, getScore) print(result) input("回车后返回首页!") from Main import main as menu menu() else: Main(stuId) input("回车后返回首页!") from Main import main as menu menu()
def Main(stuId): allcourse = get_all_course(stuId) openClassId = allcourse['openClassId'] courseOpenId = allcourse['courseOpenId'] homeworklist = get_homework_list(stuId, openClassId, courseOpenId) if homeworklist == 0: print("获取失败") else: homeworkTermTimeId = homeworklist['homeworkTermTimeId'] homeworkId = homeworklist['homeworkId'] grades = get_homework_grade(openClassId, homeworkId, stuId, homeworkTermTimeId) if grades != 0: index = 1 for i in grades: print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}") index += 1 target = int(input("请输入要修改的序号:")) - 1 homeworkStuId = grades[target]['homeworkStuId'] getScore = int(input("请输入目标分数(整数):")) result = re_grade(homeworkStuId, getScore) print(result) input("回车键后退出") else: input("回车键后退出")
def main(stuId): allcourse = get_all_course(stuId) openClassId = allcourse['openClassId'] courseOpenId = allcourse['courseOpenId'] time = input("请输入结束时间(格式2020-5-21):") teaid = getteaid(openClassId, courseOpenId) homeworklist = get_homework_list(stuId, openClassId, courseOpenId) homeworkId = homeworklist['homeworkId'] retime(time, teaid, homeworkId, courseOpenId, openClassId)
def main(stuid): info = get_all_course(stuid) homrwork_list = get_homework_list(stuid, info['openClassId'], info['courseOpenId']) homeworkId = homrwork_list['homeworkId'] url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/previewHomework' data = { 'homeWorkId': homeworkId } #html = requests.post(url=url, data=data).json()['data'] html = requests.post(url=url, data=data).text html = html.replace(' ', '') html = re.sub('<.*?>', "", html) Rinse(json.loads(html)['data'])
def main(stuid): info = get_all_course(stuid) homrwork_list = get_homework_list(stuid, info['openClassId'], info['courseOpenId']) homeworkId = homrwork_list['homeworkId'] url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/previewHomework' data = {'homeWorkId': homeworkId} html = requests.post(url=url, data=data).json()['data'] title = html['title'] with open(f'{title}.txt', 'w', encoding='utf8') as f: for i in html['questions']: Qusetion_title = i["title"] Qusetion_title = Qusetion_title.replace('<p>', '').replace( '</p>', '').replace('</span>', '').replace('<br/>', '').replace(' ', '') Qusetion_title = re.sub('<.*?>', "", Qusetion_title) f.write(f'{int(i["sortOrder"]) + 1},{Qusetion_title}\n') try: selects = json.loads(i['dataJson']) for j in selects: tihuan = { '0': 'A', '1': 'B', '2': 'C', '3': 'D', '4': 'E', '5': 'F', } select = tihuan[str(j['SortOrder'])] content = j["Content"] content = content.replace(' ', '') f.write(f'{select},{content}\n') answer = i["answer"].replace('0', 'A').replace( '1', 'B').replace('2', 'C').replace('3', 'D').replace( '4', 'E').replace('5', 'F').replace('6', 'G').replace( '7', 'H').replace('8', 'I') f.write(f'Answer:{answer}\n') except: answer = i["answer"].replace('0', 'A').replace( '1', 'B').replace('2', 'C').replace('3', 'D').replace( '4', 'E').replace('5', 'F').replace('6', 'G').replace( '7', 'H').replace('8', 'I') f.write(f'Answer:{answer}\n') input("作业答案已生成在软件目录下。请回车退出")
def main(stuid): info = get_all_course(stuid) homrwork_list = get_homework_list(stuid, info['openClassId'], info['courseOpenId']) homeworkId = homrwork_list['homeworkId'] url = 'https://zjyapp.icve.com.cn/newmobileapi/homework/previewHomework' data = {'homeWorkId': homeworkId} html = requests.post(url=url, data=data).text html = html.replace(' ', '').replace('</span>', '').replace( '</p>', '').replace('</font>', '').replace('<strong>', '').replace( '</strong>', '').replace('<b>', '').replace('</b>', '').replace( '<div>', '').replace('</div>', '').replace('<br>', '').replace('<br/>', '') html = re.sub('<p.*?>', "", html) html = re.sub('<span.*?>', "", html) html = re.sub('<font.*?>', "", html) Rinse(json.loads(html)['data'])
def Main(stuId): allcourse = get_all_course(stuId) openClassId = allcourse['openClassId'] courseOpenId = allcourse['courseOpenId'] homeworklist = get_homework_list(stuId, openClassId, courseOpenId) if homeworklist == 0: print("获取失败") else: homeworkTermTimeId = homeworklist['homeworkTermTimeId'] homeworkId = homeworklist['homeworkId'] grades = get_homework_grade(openClassId, homeworkId, stuId, homeworkTermTimeId) if grades != 0: index = 1 for i in grades: print(f"【{index}】时间:{i['dateCreated']}\t分数{i['getScore']}") index += 1 target = int(input("请输入要修改的序号:")) - 1 homeworkStuId = grades[target]['homeworkStuId'] getScore = int(input("请输入目标分数(整数):")) result = re_grade(homeworkStuId, getScore) print(result) sele = input("【1】返回首页\n【2】返回上级") if sele == 2: Main(stuId) else: from Main import main as menu menu() else: Main(stuId) sele = input("【1】返回首页\n【2】返回上级\n请选择:") if sele == 2: Main(stuId) else: from Main import main as menu menu()