feat(playwright): 添加浏览器配置类并集成Playwright

新增BrowserConfig配置类,用于创建和管理Playwright实例。
移除DesktopApplication中冗余的UI示例代码和旧版PlaywrightService。
添加FtbCrawlNetBase接口及其实现类FtbCrawlNetMt,用于执行Cookie拦截逻辑。更新PlatformSelectionView以支持美团平台的连接功能,并通过SpringContext获取爬虫服务。
调整module-info.java以开放和导出新增模块包路径,确保Spring能够正确注入依赖。
```
This commit is contained in:
wangchunxiang
2025-10-13 16:57:52 +08:00
parent a5fcb54815
commit 9fa2e10049
8 changed files with 170 additions and 209 deletions

View File

@@ -1,5 +1,7 @@
package com.fantaibao.page;
import com.fantaibao.base.FtbCrawlNetBase;
import com.fantaibao.config.SpringContext;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
@@ -35,7 +37,7 @@ public class PlatformSelectionView {
titleLabel.setStyle("-fx-font-size: 18px; -fx-font-weight: bold;");
// 描述信息
Label infoLabel = new Label("连接您的电商平台,智能化采集商品数据");
Label infoLabel = new Label("连接您的电商平台,智能化采集中差评数据");
infoLabel.setStyle("-fx-font-size: 14px;");
// 平台选项容器
@@ -44,18 +46,16 @@ public class PlatformSelectionView {
platformOptions.setSpacing(20);
// 美团开店宝选项
VBox meituanOption = createPlatformOption(
VBox meituanOption = createPlatformMtOption(
"美团开店宝",
"https://placehold.co/64x64?text=MT&bg=FFD700&fg=333",
"采集店铺数据、获取商品信息",
"#FFD700"
);
// 抖音来客选项
VBox douyinOption = createPlatformOption(
VBox douyinOption = createPlatformDyOption(
"抖音来客",
"https://placehold.co/64x64?text=DY&bg=4A90E2&fg=FFF",
"获取直播数据、用户评论、商品指标",
"#4A90E2"
);
@@ -70,7 +70,7 @@ public class PlatformSelectionView {
primaryStage.show();
}
private VBox createPlatformOption(String title, String imageUrl, String description, String buttonColor) {
private VBox createPlatformMtOption(String title, String imageUrl, String buttonColor) {
VBox option = new VBox();
option.setAlignment(Pos.CENTER);
option.setSpacing(10);
@@ -84,14 +84,41 @@ public class PlatformSelectionView {
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);
connectButton.setOnAction(event -> {
FtbCrawlNetBase ftbCrawlNetMt = SpringContext.getBean("ftbCrawlNetMt");
ftbCrawlNetMt.executeCookieIntercept();
});
option.getChildren().addAll(imageView, titleLabel, connectButton);
return option;
}
private VBox createPlatformDyOption(String title, String imageUrl, 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;");
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, connectButton);
return option;
}
}