@ -0,0 +1,11 @@
|
||||
.idea/
|
||||
out/
|
||||
.vscode/
|
||||
bin/
|
||||
questions/
|
||||
generated_papers/
|
||||
target/
|
||||
users.json
|
||||
legal/
|
||||
lib/
|
||||
config.properties
|
||||
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.mathgenerator</groupId>
|
||||
<artifactId>MathGenerator</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<javafx.version>21.0.8</javafx.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-email</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mozilla</groupId>
|
||||
<artifactId>rhino-engine</artifactId>
|
||||
<version>1.7.14</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.mathgenerator.MainApplication</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
package com.mathgenerator;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MainApplication extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
// 启动时加载登录界面
|
||||
Parent root = FXMLLoader.load(getClass().getResource("/com/mathgenerator/view/LoginView.fxml"));
|
||||
primaryStage.setTitle("中小学数学学习软件");
|
||||
primaryStage.setScene(new Scene(root));
|
||||
primaryStage.setResizable(false);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.mathgenerator.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 选择题数据模型。
|
||||
* @param questionText 题干
|
||||
* @param options 四个选项的列表
|
||||
* @param correctOptionIndex 正确答案在列表中的索引 (0-3)
|
||||
*/
|
||||
public record ChoiceQuestion(String questionText, List<String> options, int correctOptionIndex) {
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.mathgenerator.service;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public class EmailConfig {
|
||||
private static final Properties properties = new Properties();
|
||||
|
||||
static {
|
||||
try (InputStream input = new FileInputStream("config.properties")) {
|
||||
properties.load(input);
|
||||
} catch (IOException ex) {
|
||||
System.err.println("错误:无法加载 config.properties 文件!请确保该文件在项目根目录中。");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getHost() {
|
||||
return properties.getProperty("smtp.host");
|
||||
}
|
||||
|
||||
public static int getPort() {
|
||||
return Integer.parseInt(properties.getProperty("smtp.port"));
|
||||
}
|
||||
|
||||
public static String getUsername() {
|
||||
return properties.getProperty("smtp.username");
|
||||
}
|
||||
|
||||
public static String getPassword() {
|
||||
return properties.getProperty("smtp.password");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<VBox alignment="TOP_CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="500.0" spacing="20.0" style="-fx-background-color: #f4f4f4;" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.mathgenerator.controller.MainMenuController">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
||||
</padding>
|
||||
<children>
|
||||
<Label fx:id="welcomeLabel" text="欢迎, [用户名]!">
|
||||
<font>
|
||||
<Font name="System Bold" size="28.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<VBox alignment="CENTER" spacing="15.0" VBox.vgrow="ALWAYS">
|
||||
<children>
|
||||
<Label text="请选择题目难度">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Button fx:id="primaryButton" mnemonicParsing="false" onAction="#handlePrimaryAction" prefHeight="50.0" prefWidth="200.0" text="小学" />
|
||||
<Button fx:id="juniorHighButton" mnemonicParsing="false" onAction="#handleJuniorHighAction" prefHeight="50.0" prefWidth="200.0" text="初中" />
|
||||
<Button fx:id="seniorHighButton" mnemonicParsing="false" onAction="#handleSeniorHighAction" prefHeight="50.0" prefWidth="200.0" text="高中" />
|
||||
<HBox alignment="CENTER" spacing="10.0">
|
||||
<children>
|
||||
<Label text="题目数量:" />
|
||||
<TextField fx:id="questionCountField" prefWidth="80.0" text="10" />
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets top="20.0" />
|
||||
</VBox.margin>
|
||||
</HBox>
|
||||
<Label fx:id="statusLabel" textFill="RED" />
|
||||
</children>
|
||||
</VBox>
|
||||
<HBox alignment="CENTER_RIGHT" spacing="10.0">
|
||||
<children>
|
||||
<Button fx:id="changePasswordButton" mnemonicParsing="false" onAction="#handleChangePasswordAction" text="修改密码" />
|
||||
<Button fx:id="logoutButton" mnemonicParsing="false" onAction="#handleLogoutAction" style="-fx-background-color: #dc3545;" text="退出登录" textFill="WHITE" />
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ProgressBar?>
|
||||
<?import javafx.scene.control.RadioButton?>
|
||||
<?import javafx.scene.control.ToggleGroup?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<VBox alignment="TOP_CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="600.0" spacing="20.0" style="-fx-background-color: #f4f4f4;" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.mathgenerator.controller.QuizController">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
||||
</padding>
|
||||
<children>
|
||||
<Label fx:id="questionNumberLabel" text="第 1 / 10 题">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<ProgressBar fx:id="progressBar" prefWidth="560.0" progress="0.1" />
|
||||
<Label fx:id="questionTextLabel" style="-fx-font-weight: bold;" text="题目内容: 1 + 1 = ?" wrapText="true">
|
||||
<font>
|
||||
<Font size="24.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets top="20.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<VBox fx:id="optionsVBox" alignment="CENTER_LEFT" spacing="15.0">
|
||||
<children>
|
||||
<RadioButton fx:id="option1" mnemonicParsing="false" text="选项1">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="optionsGroup" />
|
||||
</toggleGroup>
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="option2" mnemonicParsing="false" text="选项2" toggleGroup="$optionsGroup">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="option3" mnemonicParsing="false" text="选项3" toggleGroup="$optionsGroup">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="option4" mnemonicParsing="false" text="选项4" toggleGroup="$optionsGroup">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</RadioButton>
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets left="50.0" top="20.0" />
|
||||
</VBox.margin>
|
||||
</VBox>
|
||||
<Button fx:id="submitButton" mnemonicParsing="false" onAction="#handleSubmitButtonAction" prefHeight="40.0" prefWidth="150.0" text="提交答案">
|
||||
<VBox.margin>
|
||||
<Insets top="30.0" />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
<Label fx:id="statusLabel" textFill="RED" />
|
||||
</children>
|
||||
</VBox>
|
||||
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.PasswordField?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="450.0" spacing="15.0" style="-fx-background-color: #f4f4f4;" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.mathgenerator.controller.RegisterController">
|
||||
<children>
|
||||
<Label text="新用户注册">
|
||||
<font>
|
||||
<Font name="System Bold" size="24.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<TextField fx:id="usernameField" maxWidth="300.0" promptText="用户名" />
|
||||
<TextField fx:id="emailField" maxWidth="300.0" promptText="邮箱地址" />
|
||||
<HBox alignment="CENTER" maxWidth="300.0" spacing="10.0">
|
||||
<children>
|
||||
<TextField fx:id="verificationCodeField" promptText="邮箱验证码" HBox.hgrow="ALWAYS" />
|
||||
<Button fx:id="sendCodeButton" mnemonicParsing="false" onAction="#handleSendCodeAction" text="发送验证码" />
|
||||
</children>
|
||||
</HBox>
|
||||
<PasswordField fx:id="passwordField" maxWidth="300.0" promptText="设置密码 (6-10位, 含大小写字母和数字)" />
|
||||
<PasswordField fx:id="confirmPasswordField" maxWidth="300.0" promptText="确认密码" />
|
||||
<Button fx:id="registerButton" mnemonicParsing="false" onAction="#handleRegisterAction" prefWidth="120.0" text="确认注册" />
|
||||
<Button fx:id="backToLoginButton" mnemonicParsing="false" onAction="#handleBackToLoginAction" style="-fx-background-color: #6c757d;" text="返回登录" textFill="WHITE" />
|
||||
<Label fx:id="statusLabel" textFill="RED" wrapText="true">
|
||||
<VBox.margin>
|
||||
<Insets top="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<VBox alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="500.0" spacing="25.0" style="-fx-background-color: #f4f4f4;" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.mathgenerator.controller.ScoreController">
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
||||
</padding>
|
||||
<children>
|
||||
<Label text="答题完成!">
|
||||
<font>
|
||||
<Font name="System Bold" size="36.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<VBox alignment="CENTER" spacing="10.0">
|
||||
<children>
|
||||
<Label text="您的最终得分是:">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="scoreLabel" text="100.00" textFill="#007bff">
|
||||
<font>
|
||||
<Font name="System Bold" size="64.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</VBox>
|
||||
<Label fx:id="resultMessageLabel" text="太棒了!你答对了所有题目!" />
|
||||
<VBox alignment="CENTER" spacing="15.0">
|
||||
<VBox.margin>
|
||||
<Insets top="20.0" />
|
||||
</VBox.margin>
|
||||
<children>
|
||||
<Button fx:id="tryAgainButton" mnemonicParsing="false" onAction="#handleTryAgainAction" prefWidth="150.0" text="再做一组" />
|
||||
<Button fx:id="logoutButton" mnemonicParsing="false" onAction="#handleLogoutAction" style="-fx-background-color: #6c757d;" text="退出登录" textFill="WHITE" />
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</VBox>
|
||||
Loading…
Reference in new issue