From dfa97f0a4ab5499de409ae08ebd8ca79b2b56d08 Mon Sep 17 00:00:00 2001 From: wangchunxiang <526328077@qq.com> Date: Tue, 14 Oct 2025 17:24:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(config):=20=E6=9B=B4=E6=96=B0=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E7=BD=91=E7=BB=9C=E5=9C=B0=E5=9D=80=E4=B8=BA=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E7=8E=AF=E5=A2=83=E5=9C=B0=E5=9D=80=E5=B0=86=20Global?= =?UTF-8?q?Config=20=E4=B8=AD=E7=9A=84=E5=9F=BA=E7=A1=80=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=BB=8E=E6=9C=AC=E5=9C=B0=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=9B=BF=E6=8D=A2=E4=B8=BA=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=9C=B0=E5=9D=80=EF=BC=8C=20=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E4=BC=98=E5=8C=96=20LoginView=20=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=B8=83=E5=B1=80=EF=BC=8C=E4=BD=BF=E6=A0=87=E7=AD=BE=E4=B8=8E?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E5=B7=A6=E5=AF=B9=E9=BD=90=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E8=B0=83=E6=95=B4=E7=BB=84=E4=BB=B6=E9=97=B4=E8=B7=9D?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fantaibao/config/GlobalConfig.java | 3 ++- .../java/com/fantaibao/page/LoginView.java | 25 +++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/fantaibao/config/GlobalConfig.java b/src/main/java/com/fantaibao/config/GlobalConfig.java index a930ad8..511a8e6 100644 --- a/src/main/java/com/fantaibao/config/GlobalConfig.java +++ b/src/main/java/com/fantaibao/config/GlobalConfig.java @@ -11,7 +11,8 @@ public class GlobalConfig { /** * 基础网络地址 */ - public static final String BASE_NET_URL = "http://127.0.0.1:9606"; + //public static final String BASE_NET_URL = "http://127.0.0.1:9606"; + public static final String BASE_NET_URL = "http://139.155.27.186:9607"; /** * 登录接口地址 diff --git a/src/main/java/com/fantaibao/page/LoginView.java b/src/main/java/com/fantaibao/page/LoginView.java index 6ea54b9..f5fa76e 100644 --- a/src/main/java/com/fantaibao/page/LoginView.java +++ b/src/main/java/com/fantaibao/page/LoginView.java @@ -65,18 +65,18 @@ public class LoginView { ProgressIndicator progressIndicator = new ProgressIndicator(); progressIndicator.setPrefSize(30, 30); progressIndicator.setVisible(false); - + // 添加登录按钮事件处理 loginButton.setOnAction(e -> { // 获取用户输入的账号和密码 String account = accountField.getText(); String password = passwordField.getText(); - + // 显示加载指示器,禁用登录按钮 progressIndicator.setVisible(true); loginButton.setDisable(true); loginButton.setText("登录中..."); - + // 在新线程中执行登录操作 new Thread(() -> { try { @@ -92,7 +92,7 @@ public class LoginView { progressIndicator.setVisible(false); loginButton.setDisable(false); loginButton.setText("登 录"); - + if (jsonResultObject.getInteger("code") != 200) { // 显示错误提示弹窗 Alert alert = new Alert(Alert.AlertType.ERROR); @@ -124,7 +124,7 @@ public class LoginView { progressIndicator.setVisible(false); loginButton.setDisable(false); loginButton.setText("登 录"); - + // 显示错误提示弹窗 Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("登录失败"); @@ -138,10 +138,21 @@ public class LoginView { } }).start(); }); + + // 创建标签容器,使文本标签与输入框左对齐 + Label accountLabel = new Label("账号:"); + accountLabel.setPrefWidth(400); + accountLabel.setStyle("-fx-alignment: center-left;"); + + Label passwordLabel = new Label("密码:"); + passwordLabel.setPrefWidth(400); + passwordLabel.setStyle("-fx-alignment: center-left;"); // 添加组件到主容器 - root.getChildren().addAll(titleLabel, infoLabel, new Label("账号"), accountField, - new Label("密码"), passwordField, loginButton, progressIndicator); + root.getChildren().addAll(titleLabel, infoLabel, accountLabel, accountField, + passwordLabel, passwordField, + new Label(""), // 添加一个空标签以增加间距 + loginButton, progressIndicator); // 设置场景并显示窗口 Scene scene = new Scene(root, 400, 600);