|
|
|
|
@ -38,7 +38,7 @@ public class SysFunc {
|
|
|
|
|
System.out.println("-------请登录您的账户-------");
|
|
|
|
|
System.out.println(" 请输入: 用户名 密码 ");
|
|
|
|
|
String cur = scanner.nextLine();
|
|
|
|
|
if(cur.indexOf(" ") == -1){
|
|
|
|
|
if (cur.indexOf(" ") == -1) {
|
|
|
|
|
System.out.println("请输入用户名和密码,中间用空格隔开");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
@ -46,18 +46,18 @@ public class SysFunc {
|
|
|
|
|
String cur_password = cur.substring(cur.indexOf(" ") + 1);
|
|
|
|
|
|
|
|
|
|
// 匹配已有帐户
|
|
|
|
|
for(Teacher t : teachers){
|
|
|
|
|
if(t.name.equals(cur_name) && t.password.equals(cur_password)){
|
|
|
|
|
for (Teacher t : teachers) {
|
|
|
|
|
if (t.name.equals(cur_name) && t.password.equals(cur_password)) {
|
|
|
|
|
teacher = t;
|
|
|
|
|
flag = true;
|
|
|
|
|
System.out.println("当前选择为" + teacher.getType() + "出题");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!flag){
|
|
|
|
|
System.out.println("请输入正确的用户名、密码");
|
|
|
|
|
}
|
|
|
|
|
if (!flag) {
|
|
|
|
|
System.out.println("请输入正确的用户名、密码");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return teacher;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -66,30 +66,26 @@ public class SysFunc {
|
|
|
|
|
int type = SysFunc.typeMap.get(SysFunc.teacher.getType());
|
|
|
|
|
System.out.println("-------是否切换出题类型(y/n)-------");
|
|
|
|
|
String choice = scanner.nextLine();
|
|
|
|
|
if(choice.equals("y")){
|
|
|
|
|
if (choice.equals("y")) {
|
|
|
|
|
System.out.println("请输入类型:");
|
|
|
|
|
while(true){
|
|
|
|
|
while (true) {
|
|
|
|
|
String choice_type = scanner.nextLine();
|
|
|
|
|
if(choice_type.substring(0,2).equals("切换") && typeMap.containsKey(choice_type.substring(2))){
|
|
|
|
|
if (choice_type.substring(0, 2).equals("切换") && typeMap.containsKey(choice_type.substring(2))) {
|
|
|
|
|
type = typeMap.get(choice_type.substring(2));
|
|
|
|
|
if(type == 1){
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
teacher = new PrimaryTea(teacher.name, teacher.password, teacher.path);
|
|
|
|
|
}
|
|
|
|
|
else if(type == 2){
|
|
|
|
|
} else if (type == 2) {
|
|
|
|
|
teacher = new JuniorTea(teacher.name, teacher.password, teacher.path);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
} else {
|
|
|
|
|
teacher = new SeniorTea(teacher.name, teacher.password, teacher.path);
|
|
|
|
|
}
|
|
|
|
|
System.out.println("准备生成" + teacher.getType() + "数学题目,请输入生成题目数量(输入-1将退出当前用户,重新登录):");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println("请输入小学、初中和高中三个选项中的一个");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(choice.equals("n")){
|
|
|
|
|
} else if (choice.equals("n")) {
|
|
|
|
|
System.out.println("请继续输入题目数量:");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -98,23 +94,22 @@ public class SysFunc {
|
|
|
|
|
// 出题界面
|
|
|
|
|
public static void Operate(Scanner scanner){
|
|
|
|
|
boolean logout = false;
|
|
|
|
|
while(!logout){
|
|
|
|
|
while (!logout) {
|
|
|
|
|
SysFunc.ShiftType(scanner);
|
|
|
|
|
int num = scanner.nextInt();
|
|
|
|
|
scanner.nextLine();
|
|
|
|
|
while(true){
|
|
|
|
|
if(num == -1) {
|
|
|
|
|
while (true) {
|
|
|
|
|
if (num == -1) {
|
|
|
|
|
// 返回登录界面
|
|
|
|
|
System.out.println("已退出登录");
|
|
|
|
|
logout = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(num >= LEAST_NUM && num <= MAX_NUM) {
|
|
|
|
|
if (num >= LEAST_NUM && num <= MAX_NUM) {
|
|
|
|
|
String filepath = teacher.GenerateEX(num);
|
|
|
|
|
System.out.println("题目生成成功,已保存至" + filepath);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println("题目数量应在10-30之间,请重新输入");
|
|
|
|
|
num = scanner.nextInt();
|
|
|
|
|
}
|
|
|
|
|
|