|
|
|
|
@ -24,6 +24,15 @@ public class SysFunc {
|
|
|
|
|
static final String PURPLE = "\u001B[35m";
|
|
|
|
|
static final String CYAN = "\u001B[36m";
|
|
|
|
|
static final String BOLD = "\u001B[1m";
|
|
|
|
|
// 清屏代码
|
|
|
|
|
static final String CLEAR_SCREEN = "\033[H\033[2J";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 清屏方法
|
|
|
|
|
public static void clearScreen() {
|
|
|
|
|
System.out.print(CLEAR_SCREEN);
|
|
|
|
|
System.out.flush();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void init(){
|
|
|
|
|
// 用户预加载
|
|
|
|
|
@ -45,6 +54,7 @@ public class SysFunc {
|
|
|
|
|
|
|
|
|
|
// 登陆界面
|
|
|
|
|
public static Teacher login(Scanner scanner) {
|
|
|
|
|
clearScreen();
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
System.out.println(BOLD + CYAN + "=== 数学题目生成系统 ===" + RESET);
|
|
|
|
|
System.out.println(BOLD + CYAN + "请登录您的账户" + RESET);
|
|
|
|
|
@ -65,7 +75,6 @@ public class SysFunc {
|
|
|
|
|
if (t.name.equals(cur_name) && t.password.equals(cur_password)) {
|
|
|
|
|
teacher = t;
|
|
|
|
|
flag = true;
|
|
|
|
|
System.out.println(GREEN + "当前选择为" + teacher.getType() + "出题");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -78,18 +87,19 @@ public class SysFunc {
|
|
|
|
|
|
|
|
|
|
// 切换类型界面
|
|
|
|
|
public static void ShiftType(Scanner scanner) {
|
|
|
|
|
System.out.println(GREEN + "当前选择为" + teacher.getType() + "出题");
|
|
|
|
|
int type = SysFunc.typeMap.get(SysFunc.teacher.getType());
|
|
|
|
|
System.out.println(BOLD + PURPLE + "=== 是否切换出题类型(y/n) ===" + RESET);
|
|
|
|
|
System.out.print(BOLD + BLUE + "> " + RESET);
|
|
|
|
|
|
|
|
|
|
String choice = scanner.nextLine();
|
|
|
|
|
if (choice.equals("y")) {
|
|
|
|
|
System.out.println(BOLD + YELLOW + "请输入指令: 切换** (支持小学,初中,高中难度): " + RESET);
|
|
|
|
|
System.out.println(BOLD + YELLOW + "请输入指令: 切换为** (支持小学,初中,高中难度): " + RESET);
|
|
|
|
|
while (true) {
|
|
|
|
|
System.out.print(BOLD + BLUE + "> " + RESET);
|
|
|
|
|
String choice_type = scanner.nextLine();
|
|
|
|
|
if (choice_type.substring(0, 2).equals("切换") && typeMap.containsKey(choice_type.substring(2))) {
|
|
|
|
|
type = typeMap.get(choice_type.substring(2));
|
|
|
|
|
if (choice_type.length() >= 5 && choice_type.substring(0, 3).equals("切换为") && typeMap.containsKey(choice_type.substring(3))) {
|
|
|
|
|
type = typeMap.get(choice_type.substring(3));
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
teacher = new PrimaryTea(teacher.name, teacher.password, teacher.path);
|
|
|
|
|
} else if (type == 2) {
|
|
|
|
|
@ -100,14 +110,14 @@ public class SysFunc {
|
|
|
|
|
System.out.println(GREEN + "准备生成" + teacher.getType() + "数学题目,请输入生成题目数量(输入-1将退出当前用户,重新登录):");
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println(RED + RESET + "请输入小学、初中和高中三个选项中的一个");
|
|
|
|
|
System.out.println(RED + RESET + "请输入小学、初中和高中三个选项中的一个 (切换为**)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (choice.equals("n")) {
|
|
|
|
|
System.out.println(GREEN + "请继续输入题目数量:");
|
|
|
|
|
System.out.println(GREEN + "准备生成" + teacher.getType() + "数学题目,请输入生成题目数量(输入-1将退出当前用户,重新登录):");
|
|
|
|
|
} else {
|
|
|
|
|
System.out.println(RED + RESET + "无效输入,已为您设置默认类型:" + teacher.getType());
|
|
|
|
|
System.out.println(GREEN + "请输入题目数量:");
|
|
|
|
|
System.out.println(GREEN + "准备生成" + teacher.getType() + "数学题目,请输入生成题目数量(输入-1将退出当前用户,重新登录):");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|