将登录页面和平台选择页面的窗口标题统一修改为“中差评采集工具”,以更准确地反映应用功能。 feat(core): 注释掉 Playwright Cookie 示例代码 暂时注释掉 DesktopApplication 中的 runPlaywrightCookieExample 方法及相关调用,便于后续调试或移除。 feat(module): 添加缺失的模块依赖并调整导出配置 在 module-info.java 中添加对 spring.core 和 java.desktop 的依赖,并优化 exports 配置,确保模块系统正确导入与导出。feat(build): 更新 JavaFX Maven 插件配置将主类更新为 DesktopApplication,并自定义 jlink 打包名称及运行时参数,增强打包灵活性与模块支持。
97 lines
3.2 KiB
Java
97 lines
3.2 KiB
Java
package com.fantaibao.page;
|
|
|
|
import javafx.geometry.Insets;
|
|
import javafx.geometry.Pos;
|
|
import javafx.scene.Scene;
|
|
import javafx.scene.control.Button;
|
|
import javafx.scene.control.Label;
|
|
import javafx.scene.image.Image;
|
|
import javafx.scene.image.ImageView;
|
|
import javafx.scene.layout.HBox;
|
|
import javafx.scene.layout.VBox;
|
|
import javafx.stage.Stage;
|
|
|
|
public class PlatformSelectionView {
|
|
|
|
private Stage primaryStage;
|
|
|
|
public PlatformSelectionView(Stage primaryStage) {
|
|
this.primaryStage = primaryStage;
|
|
initialize();
|
|
}
|
|
|
|
private void initialize() {
|
|
// 设置窗口标题
|
|
primaryStage.setTitle("中差评采集工具");
|
|
|
|
// 主容器
|
|
VBox root = new VBox();
|
|
root.setAlignment(Pos.CENTER);
|
|
root.setSpacing(20);
|
|
root.setPadding(new Insets(40));
|
|
|
|
// 标题
|
|
Label titleLabel = new Label("请选择爬虫平台");
|
|
titleLabel.setStyle("-fx-font-size: 18px; -fx-font-weight: bold;");
|
|
|
|
// 描述信息
|
|
Label infoLabel = new Label("连接您的电商平台,智能化采集商品数据");
|
|
infoLabel.setStyle("-fx-font-size: 14px;");
|
|
|
|
// 平台选项容器
|
|
HBox platformOptions = new HBox();
|
|
platformOptions.setAlignment(Pos.CENTER);
|
|
platformOptions.setSpacing(20);
|
|
|
|
// 美团开店宝选项
|
|
VBox meituanOption = createPlatformOption(
|
|
"美团开店宝",
|
|
"https://placehold.co/64x64?text=MT&bg=FFD700&fg=333",
|
|
"采集店铺数据、获取商品信息",
|
|
"#FFD700"
|
|
);
|
|
|
|
// 抖音来客选项
|
|
VBox douyinOption = createPlatformOption(
|
|
"抖音来客",
|
|
"https://placehold.co/64x64?text=DY&bg=4A90E2&fg=FFF",
|
|
"获取直播数据、用户评论、商品指标",
|
|
"#4A90E2"
|
|
);
|
|
|
|
platformOptions.getChildren().addAll(meituanOption, douyinOption);
|
|
|
|
// 添加组件到主容器
|
|
root.getChildren().addAll(titleLabel, infoLabel, platformOptions);
|
|
|
|
// 设置场景并显示窗口
|
|
Scene scene = new Scene(root, 800, 600);
|
|
primaryStage.setScene(scene);
|
|
primaryStage.show();
|
|
}
|
|
|
|
private VBox createPlatformOption(String title, String imageUrl, String description, String buttonColor) {
|
|
VBox option = new VBox();
|
|
option.setAlignment(Pos.CENTER);
|
|
option.setSpacing(10);
|
|
option.setPadding(new Insets(20));
|
|
option.setStyle("-fx-background-color: white; -fx-border-radius: 8px; -fx-padding: 20px;");
|
|
|
|
ImageView imageView = new ImageView(new Image(imageUrl));
|
|
imageView.setFitWidth(64);
|
|
imageView.setFitHeight(64);
|
|
|
|
Label titleLabel = new Label(title);
|
|
titleLabel.setStyle("-fx-font-size: 16px; -fx-font-weight: bold;");
|
|
|
|
Label descLabel = new Label(description);
|
|
descLabel.setStyle("-fx-font-size: 12px;");
|
|
|
|
Button connectButton = new Button("立即连接");
|
|
connectButton.setStyle("-fx-background-color: " + buttonColor + "; -fx-text-fill: white; -fx-padding: 10px 20px; -fx-border-radius: 4px;");
|
|
|
|
option.getChildren().addAll(imageView, titleLabel, descLabel, connectButton);
|
|
|
|
return option;
|
|
}
|
|
} |