From ad3380c9799a4e0fb3d827e9a70fcb70a09cc4c0 Mon Sep 17 00:00:00 2001 From: wangchunxiang Date: Thu, 11 Dec 2025 17:47:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E6=B7=BB=E5=8A=A0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=8C=89=E9=92=AE=E5=B9=B6=E4=BC=98=E5=8C=96=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=B8=83=E5=B1=80=20-=20=E5=9C=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=93=E5=8F=96=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=8C=89=E9=92=AE=20-=20=E5=AE=9E=E7=8E=B0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=B8=8A=E4=B8=80=E5=9C=BA=E6=99=AF=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20-=20=E9=87=8D=E6=96=B0=E7=BB=84=E7=BB=87=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=8C=BA=E5=9F=9F=E5=B8=83=E5=B1=80=20-=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=8C=89=E9=92=AE=E6=A0=B7=E5=BC=8F=E5=92=8C=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E6=95=88=E6=9E=9C=20-=20=E8=B0=83=E6=95=B4=E4=B8=BB?= =?UTF-8?q?=E5=AE=B9=E5=99=A8=E7=BB=84=E4=BB=B6=E6=8E=92=E5=88=97=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=20-=20=E5=A2=9E=E5=8A=A0=E5=B9=B3=E5=8F=B0=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=A1=B5=E9=9D=A2=E7=9A=84=E4=BB=A3=E7=A0=81=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fantaibao/page/DataCrawlView.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/fantaibao/page/DataCrawlView.java b/src/main/java/com/fantaibao/page/DataCrawlView.java index 3b3d724..8aafcbd 100644 --- a/src/main/java/com/fantaibao/page/DataCrawlView.java +++ b/src/main/java/com/fantaibao/page/DataCrawlView.java @@ -16,8 +16,12 @@ public class DataCrawlView { private DatePicker startDatePicker; private DatePicker endDatePicker; private Button crawlButton; + private Stage primaryStage; + private Scene previousScene; public DataCrawlView(Stage primaryStage) { + this.primaryStage = primaryStage; + this.previousScene = primaryStage.getScene(); initialize(primaryStage); } @@ -81,6 +85,28 @@ public class DataCrawlView { formPane.add(endDateLabel, 0, 2); formPane.add(endDatePicker, 1, 2); + // 按钮区域 + HBox buttonBox = new HBox(); + buttonBox.setAlignment(Pos.CENTER); + buttonBox.setSpacing(20); + + // 返回按钮 + Button backButton = new Button("返回"); + backButton.setStyle("-fx-background-color: #cccccc; -fx-text-fill: #333333; " + + "-fx-font-size: 16px; -fx-font-weight: bold; -fx-padding: 12px 36px; " + + "-fx-border-radius: 30px; -fx-background-radius: 30px; " + + "-fx-effect: dropshadow(gaussian, rgba(0,0,0,0.2), 10, 0, 0, 0);"); + backButton.setCursor(javafx.scene.Cursor.HAND); + backButton.setOnMouseEntered(e -> backButton.setStyle("-fx-background-color: #bbbbbb; " + + "-fx-text-fill: #333333; -fx-font-size: 16px; -fx-font-weight: bold; " + + "-fx-padding: 12px 36px; -fx-border-radius: 30px; -fx-background-radius: 30px; " + + "-fx-effect: dropshadow(gaussian, rgba(0,0,0,0.3), 15, 0, 0, 0);")); + backButton.setOnMouseExited(e -> backButton.setStyle("-fx-background-color: #cccccc; " + + "-fx-text-fill: #333333; -fx-font-size: 16px; -fx-font-weight: bold; " + + "-fx-padding: 12px 36px; -fx-border-radius: 30px; -fx-background-radius: 30px; " + + "-fx-effect: dropshadow(gaussian, rgba(0,0,0,0.2), 10, 0, 0, 0);")); + backButton.setOnAction(e -> handleBackAction()); + // 开始抓取按钮 crawlButton = new Button("开始抓取"); crawlButton.setStyle("-fx-background-color: #4CAF50; -fx-text-fill: white; " + @@ -100,8 +126,11 @@ public class DataCrawlView { // 为按钮添加点击事件 crawlButton.setOnAction(e -> handleCrawlAction()); + // 添加按钮到按钮区域 + buttonBox.getChildren().addAll(backButton, crawlButton); + // 将组件添加到主容器 - root.getChildren().addAll(titleLabel, formPane, crawlButton); + root.getChildren().addAll(titleLabel, formPane, buttonBox); // 设置场景并显示窗口 Scene scene = new Scene(root, 500, 450); @@ -141,6 +170,14 @@ public class DataCrawlView { "数据抓取任务已启动!"); } + private void handleBackAction() { + if (previousScene != null) { + primaryStage.setScene(previousScene); + } else { + new PlatformSelectionView(primaryStage); + } + } + private void showAlert(Alert.AlertType alertType, String title, String content) { Alert alert = new Alert(alertType); alert.setTitle(title);