1 #1

Merged
hnu202304060319 merged 14 commits from fanwen_branch into develop 5 months ago

@ -1,2 +0,0 @@
# partner_program

@ -0,0 +1,169 @@
# JavaFX FXML 界面说明文档
## 项目概述
本项目是一个 **教育类应用程序** 的 **JavaFX 用户界面**,包含 **用户认证、学习系统和考试功能** 等多个模块。
---
## 界面文件列表
### 1. 用户认证模块
#### 1.1 `login.fxml` — 登录界面
- **控制器:** `LoginController`
- **主要功能:** 用户登录
- **界面元素:**
- 用户名/邮箱输入框
- 密码输入框
- 登录、注册、忘记密码、清空按钮
- 状态提示标签
- **特色:** 支持用户名或邮箱登录
---
#### 1.2 `register.fxml` — 注册界面
- **控制器:** `RegisterController`
- **主要功能:** 新用户注册
- **界面元素:**
- 邮箱输入框
- 验证码输入与验证功能
- 发送注册码按钮
- 返回登录和清空按钮
- **流程:** 邮箱验证 → 设置账户信息
---
#### 1.3 `set_password.fxml` — 设置密码界面
- **控制器:** `SetPasswordController`
- **主要功能:** 完成注册流程,设置用户名和密码
- **界面元素:**
- 用户名输入框2-20位
- 密码和确认密码输入框
- 完成注册按钮
---
#### 1.4 `forgot_password.fxml` — 忘记密码界面
- **控制器:** `ForgotPasswordController`
- **主要功能:** 密码重置
- **界面元素:**
- 验证码输入框
- 新密码和确认密码输入框
- 发送验证码和重置密码按钮
---
### 2. 用户中心模块
#### 2.1 `dashboard.fxml` — 用户中心主界面
- **控制器:** `DashboardController`
- **主要功能:** 功能导航
- **界面元素:**
- 欢迎信息标签
- 进入学习系统按钮
- 修改密码按钮
- 退出登录按钮
- **设计:** 采用卡片式按钮布局
---
#### 2.2 `change_password.fxml` — 修改密码界面
- **控制器:** `ChangePasswordController`
- **主要功能:** 登录用户修改密码
- **界面元素:**
- 原密码、新密码、确认密码输入框
- 密码规则提示6-10位含大小写和数字
- 确认修改、清空、返回按钮
---
### 3. 学习系统模块
#### 3.1 `grade_selection.fxml` — 学段选择界面
- **控制器:** `GradeSelectionController`
- **主要功能:** 选择学习阶段
- **界面元素:**
- 小学、初中、高中选择按钮
- 退出登录和返回用户中心按钮
- **颜色编码:** 不同学段使用不同主题色
---
### 4. 考试系统模块
#### 4.1 `exam.fxml` — 考试界面
- **控制器:** `ExamController`
- **主要功能:** 在线答题
- **界面元素:**
- 进度指示器与题目编号
- 题目内容显示区域
- 单选按钮选项A / B / C / D
- 上一题、下一题、提交试卷按钮
- **交互:** 支持题目导航与进度跟踪
---
#### 4.2 `score.fxml` — 成绩显示界面
- **控制器:** `ScoreController`
- **主要功能:** 显示考试结果
- **界面元素:**
- 得分显示(大字体突出)
- 评价标签
- 继续做题和退出登录按钮
---
## 设计特点
### 统一的视觉风格
- **主色调:** `#3498db`(蓝色)
- **成功色:** `#2ecc71`(绿色)
- **警告色:** `#e74c3c`(红色)
- **文字色:** `#2c3e50`(深蓝灰)
---
## 技术规格
### FXML 特性
- 使用 JavaFX 标准控件
- 统一命名规范(`fx:id` 前缀)
- 内联样式定义
- 控制器绑定
---
### 兼容性
- 支持 **JavaFX 8** 及以上版本
- 标准 **FXML 1.0** 格式
- 统一编码:`UTF-8`
---
## 使用流程
### 新用户流程
1. 注册
2. 邮箱验证
3. 设置账户信息
4. 登录
### 现有用户流程
1. 登录
2. 进入用户中心
3. 选择功能
### 学习流程
1. 选择学段
2. 参加考试
3. 查看成绩
### 账户管理
- 修改密码
- 退出登录
---

@ -0,0 +1,5 @@
smtp.host=smtp.qq.com
smtp.port=587
smtp.username=1677625723@qq.com
smtp.password=hytetajyjlyscbbe
smtp.from=1677625723@qq.com

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.myapp.controller.ChangePasswordController"
prefWidth="500" prefHeight="400"
style="-fx-padding: 20;">
<children>
<Label layoutX="20" layoutY="20" text="修改密码" style="-fx-font-size: 18; -fx-font-weight: bold;"/>
<Label fx:id="userLabel" layoutX="20" layoutY="60" text="用户"
style="-fx-font-size: 14; -fx-text-fill: #666;" prefWidth="460"/>
<Label layoutX="20" layoutY="100" text="原密码:" style="-fx-font-size: 14;"/>
<PasswordField fx:id="oldPwd" layoutX="120" layoutY="96" prefWidth="320"
promptText="请输入原密码"/>
<Label layoutX="20" layoutY="140" text="新密码:" style="-fx-font-size: 14;"/>
<PasswordField fx:id="newPwd" layoutX="120" layoutY="136" prefWidth="320"
promptText="请输入新密码6-10位含大小写和数字"/>
<Label layoutX="20" layoutY="180" text="确认密码:" style="-fx-font-size: 14;"/>
<PasswordField fx:id="newPwdConfirm" layoutX="120" layoutY="176" prefWidth="320"
promptText="请再次输入新密码"/>
<Label fx:id="statusLabel" layoutX="20" layoutY="220" prefWidth="460"
style="-fx-font-size: 12; -fx-wrap-text: true;"/>
<HBox layoutX="120" layoutY="260" spacing="20">
<Button fx:id="changeBtn" text="确认修改" onAction="#onChangePassword"
prefWidth="100" style="-fx-font-size: 14; -fx-background-color: #3498db; -fx-text-fill: white;"/>
<Button fx:id="clearBtn" text="清空" onAction="#onClear"
prefWidth="100" style="-fx-font-size: 14;"/>
<Button fx:id="backBtn" text="返回" onAction="#onBack"
prefWidth="100" style="-fx-font-size: 14;"/>
</HBox>
<!-- 密码规则提示 -->
<Label layoutX="20" layoutY="320" prefWidth="460"
text="密码规则6-10位必须包含大写字母、小写字母和数字"
style="-fx-font-size: 11; -fx-text-fill: gray; -fx-wrap-text: true;"/>
</children>
</AnchorPane>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.myapp.controller.DashboardController"
prefWidth="500" prefHeight="400"
style="-fx-padding: 20;">
<children>
<Label layoutX="20" layoutY="20" text="用户中心" style="-fx-font-size: 24; -fx-font-weight: bold;"/>
<Label fx:id="welcomeLabel" layoutX="20" layoutY="70" text="欢迎用户"
style="-fx-font-size: 16; -fx-text-fill: #2c3e50;" prefWidth="460"/>
<Label layoutX="20" layoutY="120" text="请选择功能:" style="-fx-font-size: 14; -fx-font-weight: bold;"/>
<VBox layoutX="150" layoutY="150" spacing="30" alignment="CENTER">
<Button fx:id="studyBtn" text="进入学习系统" onAction="#onStudy"
prefWidth="200" prefHeight="50" style="-fx-font-size: 16; -fx-background-color: #3498db; -fx-text-fill: white;"/>
<Button fx:id="changePasswordBtn" text="修改密码" onAction="#onChangePassword"
prefWidth="200" prefHeight="50" style="-fx-font-size: 16; -fx-background-color: #2ecc71; -fx-text-fill: white;"/>
<Button fx:id="logoutBtn" text="退出登录" onAction="#onLogout"
prefWidth="200" prefHeight="50" style="-fx-font-size: 16; -fx-background-color: #e74c3c; -fx-text-fill: white;"/>
</VBox>
</children>
</AnchorPane>

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.myapp.controller.ExamController"
prefWidth="600" prefHeight="500"
style="-fx-padding: 20;">
<children>
<!-- 顶部信息区域 -->
<VBox spacing="10" layoutX="20" layoutY="20" prefWidth="560">
<Label fx:id="questionNumberLabel" text="第 1 题 / 共 10 题"
style="-fx-font-size: 16; -fx-font-weight: bold;"/>
<ProgressIndicator fx:id="progressIndicator" prefWidth="560" prefHeight="20"/>
</VBox>
<!-- 题目区域 -->
<VBox spacing="20" layoutX="20" layoutY="80" prefWidth="560">
<Label fx:id="questionTextLabel" text="题目内容"
style="-fx-font-size: 14; -fx-wrap-text: true;"
prefWidth="560" prefHeight="60"/>
<!-- 选项区域 -->
<VBox spacing="15" prefWidth="560">
<HBox spacing="10" alignment="CENTER_LEFT">
<RadioButton fx:id="optionARadio"/>
<Label fx:id="optionALabel" text="选项A" style="-fx-font-size: 14;"/>
</HBox>
<HBox spacing="10" alignment="CENTER_LEFT">
<RadioButton fx:id="optionBRadio"/>
<Label fx:id="optionBLabel" text="选项B" style="-fx-font-size: 14;"/>
</HBox>
<HBox spacing="10" alignment="CENTER_LEFT">
<RadioButton fx:id="optionCRadio"/>
<Label fx:id="optionCLabel" text="选项C" style="-fx-font-size: 14;"/>
</HBox>
<HBox spacing="10" alignment="CENTER_LEFT">
<RadioButton fx:id="optionDRadio"/>
<Label fx:id="optionDLabel" text="选项D" style="-fx-font-size: 14;"/>
</HBox>
</VBox>
</VBox>
<!-- 按钮区域 -->
<HBox spacing="20" layoutX="20" layoutY="350" prefWidth="560" alignment="CENTER">
<Button fx:id="previousBtn" text="上一题" onAction="#onPreviousQuestion"
prefWidth="100" prefHeight="40" style="-fx-font-size: 14;"/>
<Button fx:id="nextBtn" text="下一题" onAction="#onNextQuestion"
prefWidth="100" prefHeight="40" style="-fx-font-size: 14; -fx-background-color: #3498db; -fx-text-fill: white;"/>
<Button fx:id="submitBtn" text="提交试卷" onAction="#onSubmitExam"
prefWidth="100" prefHeight="40" style="-fx-font-size: 14; -fx-background-color: #e74c3c; -fx-text-fill: white;"/>
</HBox>
</children>
</AnchorPane>

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.myapp.controller.ForgotPasswordController"
prefWidth="500" prefHeight="400">
<children>
<Label layoutX="20" layoutY="20" text="忘记密码"/>
<Label fx:id="emailLabel" layoutX="20" layoutY="60" text="重置密码"/>
<Label layoutX="20" layoutY="100" text="验证码:"/>
<TextField fx:id="codeField" layoutX="100" layoutY="96" prefWidth="200"/>
<Button fx:id="sendCodeBtn" text="发送验证码" layoutX="320" layoutY="96" onAction="#onSendCode"/>
<Label layoutX="20" layoutY="140" text="新密码:"/>
<PasswordField fx:id="newPasswordField" layoutX="100" layoutY="136" prefWidth="320"/>
<Label layoutX="20" layoutY="180" text="确认密码:"/>
<PasswordField fx:id="confirmPasswordField" layoutX="100" layoutY="176" prefWidth="320"/>
<Label fx:id="statusLabel" layoutX="20" layoutY="220" prefWidth="460"/>
<Button fx:id="resetPasswordBtn" text="重置密码" layoutX="100" layoutY="260" onAction="#onResetPassword"/>
<Button fx:id="backToLoginBtn" text="返回登录" layoutX="220" layoutY="260" onAction="#onBackToLogin"/>
</children>
</AnchorPane>

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.myapp.controller.GradeSelectionController"
prefWidth="500" prefHeight="400"
style="-fx-padding: 20;">
<children>
<Label layoutX="20" layoutY="20" text="学习系统" style="-fx-font-size: 24; -fx-font-weight: bold;"/>
<Label fx:id="welcomeLabel" layoutX="20" layoutY="70" text="欢迎用户"
style="-fx-font-size: 16; -fx-text-fill: #2c3e50;" prefWidth="460"/>
<Label layoutX="20" layoutY="120" text="请选择学段:" style="-fx-font-size: 14; -fx-font-weight: bold;"/>
<VBox layoutX="150" layoutY="150" spacing="20" alignment="CENTER">
<Button fx:id="primarySchoolBtn" text="小学" onAction="#onPrimarySchoolSelected"
prefWidth="200" prefHeight="50" style="-fx-font-size: 16; -fx-background-color: #3498db; -fx-text-fill: white;"/>
<Button fx:id="middleSchoolBtn" text="初中" onAction="#onMiddleSchoolSelected"
prefWidth="200" prefHeight="50" style="-fx-font-size: 16; -fx-background-color: #2ecc71; -fx-text-fill: white;"/>
<Button fx:id="highSchoolBtn" text="高中" onAction="#onHighSchoolSelected"
prefWidth="200" prefHeight="50" style="-fx-font-size: 16; -fx-background-color: #e74c3c; -fx-text-fill: white;"/>
</VBox>
<Button fx:id="backToLoginBtn" text="退出登录" layoutX="20" layoutY="320"
onAction="#onBackToLogin" prefWidth="100" style="-fx-font-size: 12;"/>
<!-- 在 grade_selection.fxml 中添加返回按钮 -->
<Button fx:id="backToDashboardBtn" text="返回用户中心" layoutX="20" layoutY="320"
onAction="#onBackToDashboard" prefWidth="120" style="-fx-font-size: 12;"/>
</children>
</AnchorPane>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.myapp.controller.LoginController"
prefWidth="400" prefHeight="320"
style="-fx-padding: 20;">
<children>
<Label layoutX="20" layoutY="20" text="用户登录" style="-fx-font-size: 18; -fx-font-weight: bold;"/>
<Label layoutX="20" layoutY="60" text="用户名/邮箱:" style="-fx-font-size: 14;"/> <!-- 修改标签 -->
<TextField fx:id="identifierField" layoutX="120" layoutY="56" prefWidth="260"
style="-fx-font-size: 14;" promptText="请输入用户名或邮箱"/> <!-- 修改提示文本 -->
<Label layoutX="20" layoutY="100" text="密码:" style="-fx-font-size: 14;"/>
<PasswordField fx:id="passwordField" layoutX="120" layoutY="96" prefWidth="260"
style="-fx-font-size: 14;" promptText="请输入密码"/>
<HBox layoutX="120" layoutY="140" spacing="15">
<Button fx:id="loginBtn" text="登录" onAction="#onLogin"
prefWidth="70" style="-fx-font-size: 14;"/>
<Button fx:id="registerBtn" text="注册" onAction="#onRegister"
prefWidth="70" style="-fx-font-size: 14;"/>
<Button fx:id="forgotPasswordBtn" text="忘记密码" onAction="#onForgotPassword"
prefWidth="80" style="-fx-font-size: 14;"/>
<Button text="清空" onAction="#onClear"
prefWidth="70" style="-fx-font-size: 14;"/>
</HBox>
<Label fx:id="statusLabel" layoutX="20" layoutY="190" prefWidth="360"
style="-fx-font-size: 12; -fx-wrap-text: true;"/>
<!-- 提示信息 -->
<Label layoutX="20" layoutY="230" prefWidth="360"
text="提示:可以使用用户名或邮箱登录,忘记密码可通过邮箱重置"
style="-fx-font-size: 11; -fx-text-fill: gray; -fx-wrap-text: true;"/>
</children>
</AnchorPane>

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:controller="com.example.myapp.controller.RegisterController"
prefWidth="450" prefHeight="300"
style="-fx-padding: 20;">
<children>
<Label layoutX="20" layoutY="20" text="用户注册" style="-fx-font-size: 18; -fx-font-weight: bold;"/>
<Label layoutX="20" layoutY="60" text="邮箱:" style="-fx-font-size: 14;"/>
<TextField fx:id="emailField" layoutX="100" layoutY="56" prefWidth="240"
style="-fx-font-size: 14;" promptText="请输入邮箱地址"/>
<Button fx:id="sendCodeBtn" text="发送注册码" layoutX="350" layoutY="56"
onAction="#onSendCode" prefWidth="80" style="-fx-font-size: 12;"/>
<Label layoutX="20" layoutY="100" text="输入注册码:" style="-fx-font-size: 14;"/>
<TextField fx:id="codeField" layoutX="100" layoutY="96" prefWidth="160"
style="-fx-font-size: 14;" promptText="请输入6位验证码"/>
<Button fx:id="verifyBtn" text="验证" layoutX="270" layoutY="96"
onAction="#onVerify" prefWidth="60" style="-fx-font-size: 12;"/>
<Label fx:id="statusLabel" layoutX="20" layoutY="140" prefWidth="410"
style="-fx-font-size: 12; -fx-wrap-text: true;"/>
<HBox layoutX="100" layoutY="180" spacing="20">
<Button text="返回登录" onAction="#onBackToLogin"
prefWidth="80" style="-fx-font-size: 12;"/>
<Button text="清空" onAction="#onClear"
prefWidth="80" style="-fx-font-size: 12;"/>
</HBox>
<!-- 注册说明 -->
<Label layoutX="20" layoutY="230" prefWidth="410"
text="说明:每个邮箱只能注册一次,如果忘记密码请在登录后修改密码"
style="-fx-font-size: 11; -fx-text-fill: gray; -fx-wrap-text: true;"/>
</children>
</AnchorPane>

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.myapp.controller.ScoreController"
prefWidth="400" prefHeight="300"
style="-fx-padding: 20;">
<children>
<Label layoutX="20" layoutY="20" text="考试结果"
style="-fx-font-size: 24; -fx-font-weight: bold;"/>
<VBox spacing="30" layoutX="100" layoutY="80" alignment="CENTER">
<Label fx:id="scoreLabel" text="得分: 0 分"
style="-fx-font-size: 32; -fx-font-weight: bold; -fx-text-fill: #2c3e50;"/>
<Label fx:id="commentLabel" text="评价"
style="-fx-font-size: 18; -fx-font-weight: bold;"/>
<HBox spacing="20" alignment="CENTER">
<Button fx:id="continueBtn" text="继续做题" onAction="#onContinue"
prefWidth="100" prefHeight="40" style="-fx-font-size: 14; -fx-background-color: #3498db; -fx-text-fill: white;"/>
<Button fx:id="exitBtn" text="退出登录" onAction="#onExit"
prefWidth="100" prefHeight="40" style="-fx-font-size: 14;"/>
</HBox>
</VBox>
</children>
</AnchorPane>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:controller="com.example.myapp.controller.SetPasswordController" prefWidth="420" prefHeight="280">
<children>
<Label fx:id="emailLabel" layoutX="20" layoutY="20" text="设置账号信息" prefWidth="380"/>
<Label layoutX="20" layoutY="60" text="用户名:"/>
<TextField fx:id="usernameField" layoutX="120" layoutY="56" prefWidth="260" promptText="请输入2-20位用户名"/>
<Label layoutX="20" layoutY="100" text="密码:"/>
<PasswordField fx:id="pwdField" layoutX="120" layoutY="96" prefWidth="260" promptText="请输入密码"/>
<Label layoutX="20" layoutY="140" text="确认密码:"/>
<PasswordField fx:id="pwdConfirmField" layoutX="120" layoutY="136" prefWidth="260" promptText="请再次输入密码"/>
<Button fx:id="setBtn" text="完成注册" layoutX="120" layoutY="180" onAction="#onSetPassword" prefWidth="120"/>
<Label fx:id="statusLabel" layoutX="20" layoutY="220" prefWidth="380"/>
<!-- 提示信息 -->
<Label layoutX="20" layoutY="250" prefWidth="380"
text="提示:用户名用于登录,设置后不可更改"
style="-fx-font-size: 11; -fx-text-fill: gray;"/>
</children>
</AnchorPane>
Loading…
Cancel
Save