Compare commits
9 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
88e94d97e7 | 4 months ago |
|
|
ab76ebf447 | 4 months ago |
|
|
200026a01b | 4 months ago |
|
|
c2819895b0 | 4 months ago |
|
|
ab03f1d770 | 4 months ago |
|
|
f19e25dc85 | 4 months ago |
|
|
c4ecc92366 | 4 months ago |
|
|
36cadee867 | 4 months ago |
|
|
1b54d5b199 | 4 months ago |
@ -1,8 +0,0 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="GoogleStyle" />
|
||||
</state>
|
||||
</component>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,6 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="corretto-1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="19.0" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/MyMathQuiz_UI.iml" filepath="$PROJECT_DIR$/MyMathQuiz_UI.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="72b0954a-217b-4c2e-9f54-fc09e16134d2" name="更改" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<<<<<<< HEAD
|
||||
<change beforePath="$PROJECT_DIR$/src/account/Account.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/account/Account.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/account/AccountService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/account/AccountService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/account/SimpleAccountService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/account/SimpleAccountService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/Launcher.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/Launcher.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/MainApp.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/MainApp.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/model/Question.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/model/Question.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/model/User.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/model/User.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/persistence/FileSaver.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/persistence/FileSaver.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/persistence/JsonUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/persistence/JsonUtils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/persistence/QuestionChecker.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/persistence/QuestionChecker.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/HighQuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/HighQuestionGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/MiddleQuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/MiddleQuestionGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/PrimaryQuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/PrimaryQuestionGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/Question.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/Question.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/QuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/QuestionGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/IQuizService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/IQuizService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/IUserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/IUserService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/QuizServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/QuizServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/UserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/UserServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/ChangePasswordController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/ChangePasswordController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/LoginViewController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/LoginViewController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/MainMenuViewController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/MainMenuViewController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/QuizViewController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/QuizViewController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/RegisterViewController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/RegisterViewController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/ScoreViewController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/ScoreViewController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/ChangePasswordView.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/ChangePasswordView.fxml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/LoginView.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/LoginView.fxml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/MainMenuView.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/MainMenuView.fxml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/QuizView.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/QuizView.fxml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/RegisterView.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/RegisterView.fxml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/RootLayout.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/RootLayout.fxml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/ScoreView.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/com/student/mathquiz/view/ScoreView.fxml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/persistence/FileSaver.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/persistence/FileSaver.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/persistence/QuestionChecker.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/persistence/QuestionChecker.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/question/HighQuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/question/HighQuestionGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/question/MiddleQuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/question/MiddleQuestionGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/question/PrimaryQuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/question/PrimaryQuestionGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/question/Question.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/question/Question.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/question/QuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/question/QuestionGenerator.java" afterDir="false" />
|
||||
=======
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/MainApp.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/MainApp.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/PrimaryQuestionGenerator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/question/PrimaryQuestionGenerator.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/IUserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/IUserService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/UserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/service/UserServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/LoginViewController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/student/mathquiz/view/LoginViewController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_data/users.json" beforeDir="false" afterPath="$PROJECT_DIR$/user_data/users.json" afterDir="false" />
|
||||
>>>>>>> develop
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"customColor": "",
|
||||
"associatedIndex": 0
|
||||
}</component>
|
||||
<component name="ProjectId" id="33xNvNV8fXz57AI79RP4IvSV0wL" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<<<<<<< HEAD
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Maven.mathquiz [clean].executor": "Run",
|
||||
"Maven.mathquiz [compile].executor": "Run",
|
||||
"Maven.mathquiz [org.openjfx:javafx-maven-plugin:0.0.8:run].executor": "Run",
|
||||
"Maven.mathquiz [package].executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Users/lyq20/OneDrive/桌面/Finally/MathQuiz",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.sourceCode.Java",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
=======
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Maven.mathquiz [clean].executor": "Run",
|
||||
"Maven.mathquiz [compile].executor": "Run",
|
||||
"Maven.mathquiz [org.openjfx:javafx-maven-plugin:0.0.8:run].executor": "Run",
|
||||
"Maven.mathquiz [package].executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "develop",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Users/lyq20/OneDrive/桌面/Finally/MathQuiz",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
>>>>>>> develop
|
||||
}
|
||||
}</component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-jdk-9823dce3aa75-28b599e66164-intellij.indexing.shared.core-IU-242.23339.11" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-5c90d61e3bab-JavaScript-IU-242.23339.11" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="默认任务">
|
||||
<changelist id="72b0954a-217b-4c2e-9f54-fc09e16134d2" name="更改" comment="" />
|
||||
<created>1760254993744</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1760254993744</updated>
|
||||
<workItem from="1760254996651" duration="1905000" />
|
||||
<workItem from="1760258236771" duration="2172000" />
|
||||
<workItem from="1760260471312" duration="41000" />
|
||||
<workItem from="1760269808557" duration="303000" />
|
||||
<workItem from="1760270394012" duration="2320000" />
|
||||
<workItem from="1760274631654" duration="784000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,69 @@
|
||||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.student</groupId>
|
||||
<artifactId>mathquiz</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.8</version>
|
||||
<configuration>
|
||||
<mainClass>${main.class}</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer>
|
||||
<mainClass>${main.class}</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>module-info.class</exclude>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<javafx.version>17.0.2</javafx.version>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<main.class>com.student.mathquiz.Launcher</main.class>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
</properties>
|
||||
</project>
|
||||
@ -0,0 +1,20 @@
|
||||
1. 73 * 12 = ?
|
||||
|
||||
2. 576 / 64 = ?
|
||||
|
||||
3. 27 + 49 - 29 = ?
|
||||
|
||||
4. 57 / 19 = ?
|
||||
|
||||
5. 94 * 82 = ?
|
||||
|
||||
6. 152 / 19 - 7 = ?
|
||||
|
||||
7. 305 / 61 = ?
|
||||
|
||||
8. 85 + 12 * 77 = ?
|
||||
|
||||
9. 38 * 49 = ?
|
||||
|
||||
10. 540 / 60 = ?
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
1. 34 - 18 = ?
|
||||
|
||||
2. 192 / 96 * 14 = ?
|
||||
|
||||
3. 89 + 52 - 4 = ?
|
||||
|
||||
4. 85 - 75 = ?
|
||||
|
||||
5. 41 - 460 / 46 = ?
|
||||
|
||||
6. 15 + 2 + 95 = ?
|
||||
|
||||
7. 89 * 99 = ?
|
||||
|
||||
8. 51 - 22 = ?
|
||||
|
||||
9. 25 * 43 * 2 = ?
|
||||
|
||||
10. 99 - 5 - 18 = ?
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
1. 94 * 92 = ?
|
||||
|
||||
2. 85 + 28 * 3 = ?
|
||||
|
||||
3. 5 - 1 * 81 = ?
|
||||
|
||||
4. 315 / 45 * 70 = ?
|
||||
|
||||
5. 57 - 5 - 60 = ?
|
||||
|
||||
6. 488 / 61 = ?
|
||||
|
||||
7. 94 * 91 * 12 = ?
|
||||
|
||||
8. 88 + 59 * 4 = ?
|
||||
|
||||
9. 62 * 79 = ?
|
||||
|
||||
10. 92 + 61 + 27 = ?
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
1. sqrt(9) / 3 = ?
|
||||
|
||||
2. sqrt(81) + 5 = ?
|
||||
|
||||
3. sqrt(36) + 3 = ?
|
||||
|
||||
4. 2^2 + 6 = ?
|
||||
|
||||
5. sqrt(25) * 3 = ?
|
||||
|
||||
6. 2^2 / 2 = ?
|
||||
|
||||
7. sqrt(4) / 2 = ?
|
||||
|
||||
8. sqrt(36) + 9 = ?
|
||||
|
||||
9. 3^2 / 1 = ?
|
||||
|
||||
10. sqrt(4) * 10 = ?
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
1. sqrt(16) / 4 = ?
|
||||
|
||||
2. sqrt(25) / 1 = ?
|
||||
|
||||
3. sqrt(100) * 10 = ?
|
||||
|
||||
4. sqrt(9) / 1 = ?
|
||||
|
||||
5. sqrt(49) - 6 = ?
|
||||
|
||||
6. 16^2 / 4 = ?
|
||||
|
||||
7. sqrt(36) + 7 = ?
|
||||
|
||||
8. 12^2 + 10 = ?
|
||||
|
||||
9. 15^2 + 4 = ?
|
||||
|
||||
10. 15^2 + 9 = ?
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
1. 47 + 77 * 28 = ?
|
||||
|
||||
2. 11 - 20 / 5 = ?
|
||||
|
||||
3. 56 + 27 = ?
|
||||
|
||||
4. 8 - 22 - 74 = ?
|
||||
|
||||
5. 54 * 92 + 10 = ?
|
||||
|
||||
6. 10 * 83 = ?
|
||||
|
||||
7. 87 + 58 = ?
|
||||
|
||||
8. 388 / 97 = ?
|
||||
|
||||
9. 10 + 100 * 42 = ?
|
||||
|
||||
10. 56 + 32 = ?
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
1. sqrt(36) / 2 = ?
|
||||
|
||||
2. sqrt(9) + 5 = ?
|
||||
|
||||
3. sqrt(9) * 4 = ?
|
||||
|
||||
4. 11^2 - 10 = ?
|
||||
|
||||
5. 9^2 + 10 = ?
|
||||
|
||||
6. 18^2 / 3 = ?
|
||||
|
||||
7. sqrt(1) * 8 = ?
|
||||
|
||||
8. 9^2 * 1 = ?
|
||||
|
||||
9. 4^2 * 4 = ?
|
||||
|
||||
10. sqrt(225) / 5 = ?
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
1. tan(45°) = ?
|
||||
|
||||
2. sin(30°) = ?
|
||||
|
||||
3. sin(45°) = ?
|
||||
|
||||
4. sin(60°) = ?
|
||||
|
||||
5. cos(30°) = ?
|
||||
|
||||
6. cos(60°) = ?
|
||||
|
||||
7. tan(60°) = ?
|
||||
|
||||
8. cos(45°) = ?
|
||||
|
||||
9. tan(30°) = ?
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
1. 14^2 - 7 = ?
|
||||
|
||||
2. 7^2 + 1 = ?
|
||||
|
||||
3. sqrt(16) + 7 = ?
|
||||
|
||||
4. 12^2 * 9 = ?
|
||||
|
||||
5. sqrt(16) - 2 = ?
|
||||
|
||||
6. sqrt(1) / 1 = ?
|
||||
|
||||
7. 8^2 * 8 = ?
|
||||
|
||||
8. 19^2 - 7 = ?
|
||||
|
||||
9. 12^2 / 3 = ?
|
||||
|
||||
10. 17^2 + 1 = ?
|
||||
|
||||
@ -1,30 +1,31 @@
|
||||
package account;
|
||||
|
||||
public class Account {
|
||||
private String userName;
|
||||
private String password;
|
||||
private String userType;
|
||||
|
||||
public Account(String userName, String password,String userType) {
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
private String userName;
|
||||
private String password;
|
||||
private String userType;
|
||||
|
||||
public Account(String userName, String password, String userType) {
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package account;
|
||||
|
||||
public interface AccountService {
|
||||
Account login(String username, String password);
|
||||
|
||||
Account login(String username, String password);
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.student.mathquiz.constant;
|
||||
|
||||
public enum UserType {
|
||||
PRIMARY("小学"),
|
||||
JUNIOR("初中"),
|
||||
SENIOR("高中");
|
||||
|
||||
private final String displayName;
|
||||
|
||||
UserType(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public static UserType fromDisplayName(String displayName) {
|
||||
for (UserType type : UserType.values()) {
|
||||
if (type.displayName.equalsIgnoreCase(displayName)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.student.mathquiz.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Question {
|
||||
|
||||
private String content;
|
||||
private List<String> options;
|
||||
private int correctAnswerIndex;
|
||||
|
||||
public Question(String content, List<String> options, int correctAnswerIndex) {
|
||||
this.content = content;
|
||||
this.options = options;
|
||||
this.correctAnswerIndex = correctAnswerIndex;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public List<String> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public int getCorrectAnswerIndex() {
|
||||
return correctAnswerIndex;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.student.mathquiz.model;
|
||||
|
||||
import com.student.mathquiz.constant.UserType;
|
||||
|
||||
public class User {
|
||||
|
||||
// ★★★ 1. 新增 username 字段 ★★★
|
||||
private String username;
|
||||
private String email;
|
||||
private String encryptedPwd;
|
||||
private UserType userType;
|
||||
|
||||
public User() {
|
||||
} // Gson需要无参构造
|
||||
|
||||
// ★★★ 2. 修改构造函数,加入 username ★★★
|
||||
public User(String username, String email, String encryptedPwd, UserType userType) {
|
||||
this.username = username;
|
||||
this.email = email;
|
||||
this.encryptedPwd = encryptedPwd;
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
// ★★★ 3. 新增 username 的 Getter 和 Setter ★★★
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
// --- 下面的代码保持不变 ---
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getEncryptedPwd() {
|
||||
return encryptedPwd;
|
||||
}
|
||||
|
||||
public void setEncryptedPwd(String encryptedPwd) {
|
||||
this.encryptedPwd = encryptedPwd;
|
||||
}
|
||||
|
||||
public UserType getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(UserType userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.student.mathquiz.persistence;
|
||||
|
||||
import com.student.mathquiz.question.Question;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
public class FileSaver {
|
||||
|
||||
public static void saveQuestions(String username, List<Question> questions) {
|
||||
File dir = new File(username);
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
String filename = LocalDateTime.now().format(
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm-ss")) + ".txt";
|
||||
|
||||
try (FileWriter writer = new FileWriter(new File(dir, filename))) {
|
||||
for (int i = 0; i < questions.size(); i++) {
|
||||
writer.write((i + 1) + ". " + questions.get(i).getContent() + "\n\n");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("题目已生成并保存!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.student.mathquiz.persistence;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class JsonUtils {
|
||||
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
public static <T> T readFromJson(String filePath, Type type) {
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
try (Reader reader = new FileReader(file)) {
|
||||
return GSON.fromJson(reader, type);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> void writeToJson(String filePath, T data) {
|
||||
File file = new File(filePath);
|
||||
File parentDir = file.getParentFile();
|
||||
if (parentDir != null && !parentDir.exists()) {
|
||||
parentDir.mkdirs();
|
||||
}
|
||||
try (Writer writer = new FileWriter(file)) {
|
||||
GSON.toJson(data, writer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.student.mathquiz.persistence;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class QuestionChecker {
|
||||
|
||||
public static boolean isDuplicate(String username, String question) {
|
||||
File dir = new File(username);
|
||||
if (!dir.exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String target = question.trim();
|
||||
|
||||
for (File file : files) {
|
||||
if (file.isFile() && file.getName().endsWith(".txt")) {
|
||||
try (Scanner scanner = new Scanner(file)) {
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine().trim();
|
||||
if (line.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
int dotIndex = line.indexOf('.');
|
||||
if (dotIndex != -1) {
|
||||
String storedQuestion = line.substring(dotIndex + 1).trim();
|
||||
if (storedQuestion.equals(target)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.student.mathquiz.question;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class MiddleQuestionGenerator implements QuestionGenerator {
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
private static final char[] OPERATORS = {'+', '-', '*', '/'};
|
||||
private static final String[] SPECIAL_OPS = {"^2", "sqrt"};
|
||||
|
||||
@Override
|
||||
public Question generateQuestion() {
|
||||
return generateSpecialQuestion();
|
||||
}
|
||||
|
||||
private Question generateSpecialQuestion() {
|
||||
String specialOp = SPECIAL_OPS[RANDOM.nextInt(SPECIAL_OPS.length)];
|
||||
String content;
|
||||
String correctAnswer;
|
||||
|
||||
if ("^2".equals(specialOp)) {
|
||||
int num1 = RANDOM.nextInt(20) + 1;
|
||||
int num2 = RANDOM.nextInt(10) + 1;
|
||||
char op = OPERATORS[RANDOM.nextInt(OPERATORS.length)];
|
||||
if (op == '/') {
|
||||
num2 = RANDOM.nextInt(5) + 1;
|
||||
num1 = num2 * (RANDOM.nextInt(10) + 1);
|
||||
}
|
||||
content = num1 + "^2 " + op + " " + num2 + " = ?";
|
||||
int correctNum = calculateNormalAnswer(num1 * num1, num2, op);
|
||||
correctAnswer = String.valueOf(correctNum);
|
||||
} else { // sqrt
|
||||
int num1 = (int) Math.pow(RANDOM.nextInt(10) + 1, 2);
|
||||
int num2 = RANDOM.nextInt(10) + 1;
|
||||
char op = OPERATORS[RANDOM.nextInt(OPERATORS.length)];
|
||||
if (op == '/') {
|
||||
num2 = RANDOM.nextInt(5) + 1;
|
||||
num1 = (int) Math.pow(num2 * (RANDOM.nextInt(5) + 1), 2);
|
||||
}
|
||||
content = "sqrt(" + num1 + ") " + op + " " + num2 + " = ?";
|
||||
int correctNum = calculateNormalAnswer((int) Math.sqrt(num1), num2, op);
|
||||
correctAnswer = String.valueOf(correctNum);
|
||||
}
|
||||
|
||||
List<String> options = generateOptions(correctAnswer);
|
||||
int correctIndex = shuffleOptions(options, correctAnswer);
|
||||
return new Question(content, correctAnswer, options, correctIndex);
|
||||
}
|
||||
|
||||
private int calculateNormalAnswer(int num1, int num2, char op) {
|
||||
switch (op) {
|
||||
case '+':
|
||||
return num1 + num2;
|
||||
case '-':
|
||||
return num1 - num2;
|
||||
case '*':
|
||||
return num1 * num2;
|
||||
case '/':
|
||||
return num1 / num2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 在 MiddleQuestionGenerator.java 中
|
||||
private List<String> generateOptions(String correctAnswer) {
|
||||
Set<String> options = new HashSet<>();
|
||||
options.add(correctAnswer);
|
||||
int correctNum = Integer.parseInt(correctAnswer);
|
||||
|
||||
while (options.size() < 4) {
|
||||
int offset = RANDOM.nextInt(20) + 1;
|
||||
int wrongNum = (RANDOM.nextBoolean()) ? correctNum + offset : correctNum - offset;
|
||||
|
||||
if (wrongNum > 0 && wrongNum != correctNum) {
|
||||
options.add(String.valueOf(wrongNum));
|
||||
} else {
|
||||
options.add(String.valueOf(correctNum + options.size() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
List<String> result = new ArrayList<>(options);
|
||||
return result;
|
||||
}
|
||||
|
||||
private int shuffleOptions(List<String> options, String correctAnswer) {
|
||||
Collections.shuffle(options);
|
||||
return options.indexOf(correctAnswer);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.student.mathquiz.question;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Question {
|
||||
|
||||
private String content;
|
||||
private String correctAnswer;
|
||||
private List<String> options;
|
||||
private int correctAnswerIndex;
|
||||
|
||||
public Question(String content, String correctAnswer, List<String> options,
|
||||
int correctAnswerIndex) {
|
||||
this.content = content;
|
||||
this.correctAnswer = correctAnswer;
|
||||
this.options = options;
|
||||
this.correctAnswerIndex = correctAnswerIndex;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public List<String> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public int getCorrectAnswerIndex() {
|
||||
return correctAnswerIndex;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.student.mathquiz.question;
|
||||
|
||||
import com.student.mathquiz.constant.UserType;
|
||||
|
||||
public interface QuestionGenerator {
|
||||
|
||||
Question generateQuestion();
|
||||
|
||||
static QuestionGenerator getGeneratorByUserType(UserType userType) {
|
||||
switch (userType) {
|
||||
case PRIMARY:
|
||||
return new PrimaryQuestionGenerator();
|
||||
case JUNIOR:
|
||||
return new MiddleQuestionGenerator();
|
||||
case SENIOR:
|
||||
return new HighQuestionGenerator();
|
||||
default:
|
||||
throw new IllegalArgumentException("不支持的用户类型:" + userType.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.student.mathquiz.service;
|
||||
|
||||
import com.student.mathquiz.model.Question;
|
||||
|
||||
public interface IQuizService {
|
||||
|
||||
void generateQuiz(String level, int count, String userEmail);
|
||||
|
||||
Question getCurrentQuestion();
|
||||
|
||||
boolean isLastQuestion();
|
||||
|
||||
void submitAnswer(int selectedOptionIndex);
|
||||
|
||||
int calculateScore();
|
||||
|
||||
int getTotalQuestionCount();
|
||||
|
||||
int getCurrentQuestionIndex();
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.student.mathquiz.service;
|
||||
|
||||
import com.student.mathquiz.model.User; // ★★★ 确保导入了这个类 ★★★
|
||||
|
||||
public interface IUserService {
|
||||
|
||||
boolean sendVerificationCode(String email);
|
||||
<<<<<<< HEAD
|
||||
|
||||
// ★★★ 修改 register 方法,加入 username 参数 ★★★
|
||||
String register(String username, String email, String code, String password,
|
||||
String confirmPassword);
|
||||
|
||||
// ★★★ 修改 login 方法,参数从 email 改为 identifier (标识符) ★★★
|
||||
boolean login(String identifier, String password);
|
||||
=======
|
||||
String register(String username, String email, String code, String password, String confirmPassword);
|
||||
|
||||
// ★★★ 修改这里的返回类型 ★★★
|
||||
User login(String identifier, String password);
|
||||
>>>>>>> develop
|
||||
|
||||
String changePassword(String email, String oldPassword, String newPassword1, String newPassword2);
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.student.mathquiz.view;
|
||||
|
||||
import com.student.mathquiz.MainApp;
|
||||
import com.student.mathquiz.service.IUserService;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
|
||||
public class ChangePasswordController {
|
||||
|
||||
@FXML
|
||||
private PasswordField oldPasswordField;
|
||||
@FXML
|
||||
private PasswordField newPasswordField1;
|
||||
@FXML
|
||||
private PasswordField newPasswordField2;
|
||||
@FXML
|
||||
private Label statusLabel;
|
||||
|
||||
private MainApp mainApp;
|
||||
private IUserService userService;
|
||||
|
||||
public void setMainApp(MainApp mainApp) {
|
||||
this.mainApp = mainApp;
|
||||
this.userService = mainApp.getUserService();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleConfirmChange() {
|
||||
String oldPass = oldPasswordField.getText();
|
||||
String newPass1 = newPasswordField1.getText();
|
||||
String newPass2 = newPasswordField2.getText();
|
||||
|
||||
// ★★★ 调用后端的修改密码服务 ★★★
|
||||
String result = userService.changePassword(mainApp.getCurrentUserEmail(), oldPass, newPass1,
|
||||
newPass2);
|
||||
|
||||
if (result == null) { // null 代表成功
|
||||
statusLabel.setText("密码修改成功!请重新登录。");
|
||||
// 延迟2秒后自动跳转到登录界面
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
Platform.runLater(mainApp::showLoginView);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
// 显示后端返回的错误信息
|
||||
statusLabel.setText(result);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleBackToMenu() {
|
||||
mainApp.showMainMenuView();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.student.mathquiz.view;
|
||||
|
||||
import com.student.mathquiz.MainApp;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TextInputDialog;
|
||||
import java.util.Optional;
|
||||
|
||||
public class MainMenuViewController {
|
||||
|
||||
private MainApp mainApp;
|
||||
|
||||
public void setMainApp(MainApp mainApp) {
|
||||
this.mainApp = mainApp;
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handlePrimary() {
|
||||
showQuizWithOptions("小学");
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleMiddle() {
|
||||
showQuizWithOptions("初中");
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleHigh() {
|
||||
showQuizWithOptions("高中");
|
||||
}
|
||||
|
||||
// ★★★ 新增的方法在这里!★★★
|
||||
@FXML
|
||||
private void handleChangePassword() {
|
||||
mainApp.showChangePasswordView();
|
||||
}
|
||||
|
||||
// ★★★ 新增的方法在这里!★★★
|
||||
@FXML
|
||||
private void handleLogout() {
|
||||
mainApp.showLoginView();
|
||||
}
|
||||
|
||||
private void showQuizWithOptions(String level) {
|
||||
TextInputDialog dialog = new TextInputDialog("10");
|
||||
dialog.setTitle("设置题目数量");
|
||||
dialog.setHeaderText("您选择了 " + level + " 难度");
|
||||
dialog.setContentText("请输入需要生成的题目数量:");
|
||||
|
||||
Optional<String> result = dialog.showAndWait();
|
||||
result.ifPresent(countStr -> {
|
||||
try {
|
||||
int count = Integer.parseInt(countStr);
|
||||
if (count > 0 && count <= 50) {
|
||||
mainApp.showQuizView(level, count);
|
||||
} else {
|
||||
// You can add an Alert here for invalid input
|
||||
System.out.println("题目数量输入无效");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
System.out.println("输入的不是数字");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package com.student.mathquiz.view;
|
||||
|
||||
import com.student.mathquiz.MainApp;
|
||||
import com.student.mathquiz.model.Question;
|
||||
import com.student.mathquiz.service.IQuizService;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class QuizViewController {
|
||||
|
||||
@FXML
|
||||
private Label questionNumberLabel;
|
||||
@FXML
|
||||
private Label questionTextLabel;
|
||||
@FXML
|
||||
private RadioButton option1;
|
||||
@FXML
|
||||
private RadioButton option2;
|
||||
@FXML
|
||||
private RadioButton option3;
|
||||
@FXML
|
||||
private RadioButton option4;
|
||||
@FXML
|
||||
private ToggleGroup optionsGroup;
|
||||
@FXML
|
||||
private Button submitButton;
|
||||
@FXML
|
||||
private Label feedbackLabel;
|
||||
|
||||
private MainApp mainApp;
|
||||
private IQuizService quizService;
|
||||
private List<RadioButton> radioButtons;
|
||||
|
||||
public void setMainApp(MainApp mainApp) {
|
||||
this.mainApp = mainApp;
|
||||
this.quizService = mainApp.getQuizService();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void initialize() {
|
||||
radioButtons = Arrays.asList(option1, option2, option3, option4);
|
||||
}
|
||||
|
||||
public void startQuiz() {
|
||||
loadQuestion();
|
||||
}
|
||||
|
||||
private void loadQuestion() {
|
||||
Question currentQuestion = quizService.getCurrentQuestion();
|
||||
if (currentQuestion == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
questionNumberLabel.setText(
|
||||
String.format("第 %d/%d 题", quizService.getCurrentQuestionIndex() + 1,
|
||||
quizService.getTotalQuestionCount()));
|
||||
questionTextLabel.setText(currentQuestion.getContent());
|
||||
|
||||
List<String> options = currentQuestion.getOptions();
|
||||
for (int i = 0; i < radioButtons.size(); i++) {
|
||||
if (i < options.size()) {
|
||||
radioButtons.get(i).setText(options.get(i));
|
||||
radioButtons.get(i).setVisible(true);
|
||||
} else {
|
||||
radioButtons.get(i).setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
feedbackLabel.setText("");
|
||||
if (optionsGroup.getSelectedToggle() != null) {
|
||||
optionsGroup.getSelectedToggle().setSelected(false);
|
||||
}
|
||||
|
||||
submitButton.setText(quizService.isLastQuestion() ? "提交并查看分数" : "下一题");
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleSubmitAnswer() {
|
||||
RadioButton selectedToggle = (RadioButton) optionsGroup.getSelectedToggle();
|
||||
if (selectedToggle == null) {
|
||||
feedbackLabel.setText("请选择一个答案!");
|
||||
return;
|
||||
}
|
||||
|
||||
int selectedIndex = radioButtons.indexOf(selectedToggle);
|
||||
boolean isLast = quizService.isLastQuestion();
|
||||
|
||||
quizService.submitAnswer(selectedIndex);
|
||||
|
||||
if (isLast) {
|
||||
int score = quizService.calculateScore();
|
||||
mainApp.showScoreView(score);
|
||||
} else {
|
||||
loadQuestion();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.student.mathquiz.view;
|
||||
|
||||
import com.student.mathquiz.MainApp;
|
||||
import com.student.mathquiz.service.IUserService;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
public class RegisterViewController {
|
||||
|
||||
// ★★★ 1. 新增 usernameField 的引用 ★★★
|
||||
@FXML
|
||||
private TextField usernameField;
|
||||
@FXML
|
||||
private TextField emailField;
|
||||
@FXML
|
||||
private TextField codeField;
|
||||
@FXML
|
||||
private PasswordField passwordField1;
|
||||
@FXML
|
||||
private PasswordField passwordField2;
|
||||
@FXML
|
||||
private Label statusLabel;
|
||||
|
||||
private MainApp mainApp;
|
||||
private IUserService userService;
|
||||
|
||||
public void setMainApp(MainApp mainApp) {
|
||||
this.mainApp = mainApp;
|
||||
this.userService = mainApp.getUserService();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleSendCode() {
|
||||
String email = emailField.getText();
|
||||
statusLabel.setText("正在发送验证码...");
|
||||
new Thread(() -> {
|
||||
boolean success = userService.sendVerificationCode(email);
|
||||
Platform.runLater(() -> {
|
||||
statusLabel.setText(success ? "验证码已发送,请查收!" : "发送失败,请检查邮箱地址!");
|
||||
});
|
||||
}).start();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleRegister() {
|
||||
// ★★★ 2. 获取用户名 ★★★
|
||||
String username = usernameField.getText();
|
||||
String email = emailField.getText();
|
||||
String code = codeField.getText();
|
||||
String pass1 = passwordField1.getText();
|
||||
String pass2 = passwordField2.getText();
|
||||
|
||||
// ★★★ 3. 调用新的 register 方法 ★★★
|
||||
String result = userService.register(username, email, code, pass1, pass2);
|
||||
|
||||
if (result == null) {
|
||||
statusLabel.setText("注册成功!即将跳转到登录页...");
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(1500);
|
||||
Platform.runLater(mainApp::showLoginView);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
statusLabel.setText(result);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleGoToLogin() {
|
||||
mainApp.showLoginView();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.student.mathquiz.view;
|
||||
|
||||
import com.student.mathquiz.MainApp;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
public class ScoreViewController {
|
||||
|
||||
@FXML
|
||||
private Label scoreLabel;
|
||||
private MainApp mainApp;
|
||||
|
||||
public void setMainApp(MainApp mainApp) {
|
||||
this.mainApp = mainApp;
|
||||
}
|
||||
|
||||
public void setScore(int score) {
|
||||
scoreLabel.setText("你的分数是: " + score);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleTryAgain() {
|
||||
mainApp.showMainMenuView();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void handleExit() {
|
||||
Platform.exit();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<?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.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<VBox alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="15.0"
|
||||
xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.student.mathquiz.view.ChangePasswordController">
|
||||
<children>
|
||||
<Label text="修改密码">
|
||||
<font>
|
||||
<Font name="System Bold" size="24.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<PasswordField fx:id="oldPasswordField" prefWidth="250.0" promptText="请输入旧密码"/>
|
||||
<PasswordField fx:id="newPasswordField1" prefWidth="250.0"
|
||||
promptText="请输入新密码 (6-10位,含大小写字母和数字)"/>
|
||||
<PasswordField fx:id="newPasswordField2" prefWidth="250.0" promptText="请再次输入新密码"/>
|
||||
<Button onAction="#handleConfirmChange" text="确认修改"/>
|
||||
<Button onAction="#handleBackToMenu" text="返回主菜单"
|
||||
style="-fx-background-color: transparent; -fx-underline: true;"/>
|
||||
<Label fx:id="statusLabel" textFill="RED" wrapText="true">
|
||||
<VBox.margin>
|
||||
<Insets top="10.0"/>
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
</children>
|
||||
</VBox>
|
||||
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.PasswordField?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<VBox alignment="CENTER" prefHeight="400.0" prefWidth="600.0" spacing="20.0"
|
||||
xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.student.mathquiz.view.LoginViewController">
|
||||
<children>
|
||||
<Label text="用户登录">
|
||||
<font>
|
||||
<Font size="24.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
|
||||
<!-- ★★★ 修改这里的提示文字 ★★★ -->
|
||||
<TextField fx:id="emailField" promptText="邮箱 / 用户名" maxWidth="300"/>
|
||||
|
||||
<PasswordField fx:id="passwordField" promptText="密码" maxWidth="300"/>
|
||||
<Button onAction="#handleLogin" text="登录" prefWidth="100"/>
|
||||
<Button onAction="#handleGoToRegister"
|
||||
style="-fx-background-color: transparent; -fx-border-color: transparent; -fx-underline: true; -fx-cursor: hand;"
|
||||
text="还没有账户?去注册"/>
|
||||
<Label fx:id="statusLabel" textFill="RED"/>
|
||||
</children>
|
||||
</VBox>
|
||||
@ -0,0 +1,32 @@
|
||||
<?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" prefHeight="400.0" prefWidth="600.0" spacing="20.0"
|
||||
xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.student.mathquiz.view.MainMenuViewController">
|
||||
<children>
|
||||
<Label text="请选择难度">
|
||||
<font>
|
||||
<Font size="24.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Button onAction="#handlePrimary" prefWidth="120.0" text="小学"/>
|
||||
<Button onAction="#handleMiddle" prefWidth="120.0" text="初中"/>
|
||||
<Button onAction="#handleHigh" prefWidth="120.0" text="高中"/>
|
||||
|
||||
<!-- ★★★ 新增的按钮在这里! ★★★ -->
|
||||
<Button onAction="#handleChangePassword" prefWidth="120.0" text="修改密码">
|
||||
<VBox.margin>
|
||||
<Insets top="20.0"/>
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
<Button onAction="#handleLogout" prefWidth="120.0" text="退出登录"
|
||||
style="-fx-background-color: #f0f0f0;"/>
|
||||
|
||||
</children>
|
||||
</VBox>
|
||||
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?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" prefHeight="400.0" prefWidth="600.0" spacing="15.0"
|
||||
xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.student.mathquiz.view.RegisterViewController">
|
||||
<children>
|
||||
<Label text="用户注册">
|
||||
<font>
|
||||
<Font size="24.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
|
||||
<!-- ★★★ 新增的用户名字段 ★★★ -->
|
||||
<TextField fx:id="usernameField" promptText="用户名" maxWidth="300"/>
|
||||
|
||||
<HBox alignment="CENTER" maxWidth="300" spacing="10">
|
||||
<children>
|
||||
<TextField fx:id="emailField" promptText="邮箱" HBox.hgrow="ALWAYS"/>
|
||||
<Button onAction="#handleSendCode" text="发送验证码"/>
|
||||
</children>
|
||||
</HBox>
|
||||
<TextField fx:id="codeField" promptText="验证码" maxWidth="300"/>
|
||||
<PasswordField fx:id="passwordField1" promptText="设置密码 (6-10位,含大小写字母和数字)"
|
||||
maxWidth="300"/>
|
||||
<PasswordField fx:id="passwordField2" promptText="确认密码" maxWidth="300"/>
|
||||
<Button onAction="#handleRegister" text="注册" prefWidth="100"/>
|
||||
<Button onAction="#handleGoToLogin"
|
||||
style="-fx-background-color: transparent; -fx-border-color: transparent; -fx-underline: true; -fx-cursor: hand;"
|
||||
text="已有账户?去登录"/>
|
||||
<Label fx:id="statusLabel" textFill="RED" wrapText="true"/>
|
||||
</children>
|
||||
</VBox>
|
||||
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<BorderPane xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1"/>
|
||||
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.student.mathquiz.view.ScoreViewController">
|
||||
<VBox alignment="CENTER" layoutX="200.0" layoutY="100.0" prefHeight="200.0" prefWidth="200.0"
|
||||
spacing="20.0">
|
||||
<Label text="测试完成!">
|
||||
<font>
|
||||
<Font name="System Bold" size="24.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="scoreLabel" text="你的分数是: 100">
|
||||
<font>
|
||||
<Font size="18.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Button onAction="#handleTryAgain" text="再做一组"/>
|
||||
<Button onAction="#handleExit" text="退出程序"/>
|
||||
</VBox>
|
||||
</AnchorPane>
|
||||
@ -1,20 +1,21 @@
|
||||
package question;
|
||||
|
||||
public class Question {
|
||||
private String question;
|
||||
private String answer;
|
||||
|
||||
public Question(String question, String answer) {
|
||||
this.question = question;
|
||||
this.answer = answer;
|
||||
}
|
||||
private String question;
|
||||
private String answer;
|
||||
|
||||
public String getQuestion() {
|
||||
return question;
|
||||
}
|
||||
public Question(String question, String answer) {
|
||||
this.question = question;
|
||||
this.answer = answer;
|
||||
}
|
||||
|
||||
public String getAnswer() {
|
||||
return answer;
|
||||
}
|
||||
public String getQuestion() {
|
||||
return question;
|
||||
}
|
||||
|
||||
public String getAnswer() {
|
||||
return answer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package question;
|
||||
|
||||
public interface QuestionGenerator {
|
||||
Question generateQuestion();
|
||||
|
||||
Question generateQuestion();
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"username": "清清",
|
||||
"email": "lyqqqq1214@163.com",
|
||||
"encryptedPwd": "MTIzNDU2bEw\u003d",
|
||||
"userType": "PRIMARY"
|
||||
}
|
||||
]
|
||||
Loading…
Reference in new issue