diff --git a/.gradle/6.4.1/executionHistory/executionHistory.bin b/.gradle/6.4.1/executionHistory/executionHistory.bin index b5bc979..6ddca68 100644 Binary files a/.gradle/6.4.1/executionHistory/executionHistory.bin and b/.gradle/6.4.1/executionHistory/executionHistory.bin differ diff --git a/.gradle/6.4.1/executionHistory/executionHistory.lock b/.gradle/6.4.1/executionHistory/executionHistory.lock index ac42924..bc158fa 100644 Binary files a/.gradle/6.4.1/executionHistory/executionHistory.lock and b/.gradle/6.4.1/executionHistory/executionHistory.lock differ diff --git a/.gradle/6.4.1/fileHashes/fileHashes.bin b/.gradle/6.4.1/fileHashes/fileHashes.bin index 62f5832..a4ef855 100644 Binary files a/.gradle/6.4.1/fileHashes/fileHashes.bin and b/.gradle/6.4.1/fileHashes/fileHashes.bin differ diff --git a/.gradle/6.4.1/fileHashes/fileHashes.lock b/.gradle/6.4.1/fileHashes/fileHashes.lock index 2275e6d..f1ec1aa 100644 Binary files a/.gradle/6.4.1/fileHashes/fileHashes.lock and b/.gradle/6.4.1/fileHashes/fileHashes.lock differ diff --git a/.gradle/6.4.1/fileHashes/resourceHashesCache.bin b/.gradle/6.4.1/fileHashes/resourceHashesCache.bin index 80ff8d4..2725889 100644 Binary files a/.gradle/6.4.1/fileHashes/resourceHashesCache.bin and b/.gradle/6.4.1/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/6.4.1/javaCompile/javaCompile.lock b/.gradle/6.4.1/javaCompile/javaCompile.lock index 64b772b..7ab13cb 100644 Binary files a/.gradle/6.4.1/javaCompile/javaCompile.lock and b/.gradle/6.4.1/javaCompile/javaCompile.lock differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 78ba1fa..32eec5b 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index 18ece09..0998626 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/client/src/main/java/com/epri/fx/client/AppStartup.java b/client/src/main/java/com/epri/fx/client/AppStartup.java index 19b8318..f0ec4cb 100644 --- a/client/src/main/java/com/epri/fx/client/AppStartup.java +++ b/client/src/main/java/com/epri/fx/client/AppStartup.java @@ -2,6 +2,7 @@ package com.epri.fx.client; import com.epri.fx.client.gui.uicomponents.control.LFXDecorator; import com.epri.fx.client.gui.uicomponents.login.LoginController; +import com.epri.fx.client.gui.uicomponents.login.LoginControllerNew; import com.epri.fx.client.store.ApplicatonStore; import com.jfoenix.assets.JFoenixResources; import com.jfoenix.svg.SVGGlyph; @@ -69,7 +70,7 @@ public class AppStartup extends Application { ApplicationContext.getInstance().register(stage, Stage.class); - Flow flow = new Flow(LoginController.class); + Flow flow = new Flow(LoginControllerNew.class); FlowHandler flowHandler = flow.createHandler(); StackPane rootPane = flowHandler.start(new AnimatedFlowContainer(Duration.millis(320), ContainerAnimations.SWIPE_LEFT)); @@ -87,7 +88,7 @@ public class AppStartup extends Application { stage.show(); - scene.getStylesheets().addAll(JFoenixResources.load("/css/app-fonts.css").toExternalForm(),AppStartup.class.getResource("/css/app.css").toExternalForm()); + scene.getStylesheets().addAll(JFoenixResources.load("/css/app-fonts.css").toExternalForm(),AppStartup.class.getResource("/css/app.css").toExternalForm(),AppStartup.class.getResource("/css/login.css").toExternalForm()); } diff --git a/client/src/main/java/com/epri/fx/client/gui/uicomponents/login/LoginControllerNew.java b/client/src/main/java/com/epri/fx/client/gui/uicomponents/login/LoginControllerNew.java new file mode 100644 index 0000000..e088407 --- /dev/null +++ b/client/src/main/java/com/epri/fx/client/gui/uicomponents/login/LoginControllerNew.java @@ -0,0 +1,478 @@ +package com.epri.fx.client.gui.uicomponents.login; + +import com.epri.fx.client.bean.MenuVoCell; +import com.epri.fx.client.gui.uicomponents.main.MainController; +import com.epri.fx.client.request.Request; +import com.epri.fx.client.request.feign.admin.MenuFeign; +import com.epri.fx.client.request.feign.login.LoginFeign; +import com.epri.fx.client.store.ApplicatonStore; +import com.epri.fx.client.utils.AlertUtil; +import com.epri.fx.client.websocket.Session; +import com.epri.fx.server.util.EncryptUtil; +import com.epri.fx.server.util.user.JwtAuthenticationRequest; +import com.epri.fx.server.vo.FrontUser; +import com.epri.fx.server.vo.MenuVO; +import com.epri.fx.server.vo.PermissionInfo; +import com.jfoenix.controls.JFXButton; +import com.jfoenix.controls.JFXPasswordField; +import com.jfoenix.controls.JFXProgressBar; +import com.jfoenix.controls.JFXTextField; +import com.jfoenix.svg.SVGGlyph; +import com.jfoenix.svg.SVGGlyphLoader; +import io.datafx.controller.ViewController; +import io.datafx.controller.flow.FlowException; +import io.datafx.controller.flow.action.ActionMethod; +import io.datafx.controller.flow.action.ActionTrigger; +import io.datafx.controller.flow.context.ActionHandler; +import io.datafx.controller.flow.context.FXMLViewFlowContext; +import io.datafx.controller.flow.context.FlowActionHandler; +import io.datafx.controller.flow.context.ViewFlowContext; +import io.datafx.controller.util.VetoException; +import io.datafx.core.concurrent.ProcessChain; +import javafx.animation.*; +import javafx.beans.binding.Bindings; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.event.Event; +import javafx.event.EventHandler; +import javafx.fxml.FXML; +import javafx.scene.control.Hyperlink; +import javafx.scene.control.Label; +import javafx.scene.effect.PerspectiveTransform; +import javafx.scene.image.ImageView; +import javafx.scene.input.KeyCode; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.StackPane; +import javafx.util.Duration; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.inject.Inject; +import java.io.File; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @description: + * @className: ConversationItemPresenter + * @author: liwen + * @date: 2019-09-25 16:51 + */ +@ViewController("/fxml/login/Untitled.fxml") +public class LoginControllerNew { + + @FXML + private StackPane rootPane; + @FXML + private Pane imagePane; + + @FXML + private StackPane centerPane; + + //正面视图 + @FXML + public HBox loginPane; + //反面视图 + @FXML + public HBox registeredPane; + @FXML + public Hyperlink registeredLink; + @FXML + public Hyperlink loginLink; + @FXML + private Label errorLabel; + @FXML + private Label userIcon; + @FXML + private Label pwdIcon; + @FXML + private Label reuserIcon; + @FXML + private Label repwdIcon; + @FXML + private Label repwd2Icon; + @FXML + private JFXProgressBar lodingBar; + @FXML + private JFXTextField userNameTextField; + @FXML + private JFXPasswordField passWordTextField; + //翻转角度 + private DoubleProperty angleProperty = new SimpleDoubleProperty(Math.PI / 2); + //正面翻转特效 + private PerspectiveTransform frontEffect = new PerspectiveTransform(); + //反面翻转特效 + private PerspectiveTransform backEffect = new PerspectiveTransform(); + private Timeline frontTimeLine = new Timeline(); + private Timeline backTimeLine = new Timeline(); + + @ActionHandler + private FlowActionHandler actionHandler; + + private SequentialTransition sequentialTransition = new SequentialTransition(); + + private DoubleProperty imageWidth = new SimpleDoubleProperty(); + private DoubleProperty imageHeiht = new SimpleDoubleProperty(); + + + @Inject + private Session session; + + @FXML + @ActionTrigger("login") + private JFXButton loginBut; + + @FXMLViewFlowContext + private ViewFlowContext flowContext; + + @PostConstruct + public void init() { + + try { + SVGGlyph userSvg = SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".user-name"); + SVGGlyph pwdSvg = SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".password"); + SVGGlyph reuserSvg = SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".user-name"); + SVGGlyph repwdSvg = SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".password"); + SVGGlyph repwd2Svg = SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".querenmima"); + userSvg.setId("login-svg-glyph"); + pwdSvg.setId("login-svg-glyph"); + reuserSvg.setId("login-svg-glyph"); + repwdSvg.setId("login-svg-glyph"); + repwd2Svg.setId("login-svg-glyph"); + + userIcon.setGraphic(userSvg); + pwdIcon.setGraphic(pwdSvg); + reuserIcon.setGraphic(reuserSvg); + repwdIcon.setGraphic(repwdSvg); + repwd2Icon.setGraphic(repwd2Svg); + } catch (Exception e) { + e.printStackTrace(); + } + + imagePane.widthProperty().addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, Number oldValue, Number newValue) { + imageWidth.setValue(newValue); + } + }); + imagePane.heightProperty().addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, Number oldValue, Number newValue) { + imageHeiht.setValue(newValue); + } + }); + + registeredPane.visibleProperty().bind( + Bindings.when(angleProperty.lessThan(0)).then(true).otherwise(false)); + loginPane.visibleProperty().bind(registeredPane.visibleProperty().not()); + + initAnimation(); + loadingImage(); + initAction(); + + } + + private void initAnimation() { + FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), centerPane); + fadeTransition.setFromValue(0f); + fadeTransition.setToValue(1f); + + TranslateTransition translateTransition = new TranslateTransition(Duration.millis(500), centerPane); + translateTransition.setInterpolator(Interpolator.EASE_BOTH); + translateTransition.setFromY(400); + translateTransition.setToY(centerPane.getLayoutY()); + + ParallelTransition parallelTransition = new ParallelTransition(); + parallelTransition.setDelay(Duration.millis(1500)); + parallelTransition.getChildren().addAll( + fadeTransition, + translateTransition + ); + parallelTransition.setCycleCount(1); + parallelTransition.play(); + + + KeyFrame frame1 = new KeyFrame(Duration.ZERO, new KeyValue(angleProperty, + Math.PI / 2, Interpolator.LINEAR)); + KeyFrame frame2 = new KeyFrame(Duration.seconds(0.5), + new EventHandler() { + @Override + public void handle(Event event) { + loginPane.setEffect(null); + registeredPane.setEffect(null); + } + + }, new KeyValue(angleProperty, -Math.PI / 2, Interpolator.LINEAR)); + + KeyFrame frame3 = new KeyFrame(Duration.seconds(0.5), new EventHandler() { + @Override + public void handle(Event event) { + loginPane.setEffect(null); + registeredPane.setEffect(null); + } + + }, new KeyValue(angleProperty, + Math.PI / 2, Interpolator.LINEAR)); + KeyFrame frame4 = new KeyFrame(Duration.ZERO, new KeyValue(angleProperty, -Math.PI / 2, Interpolator.LINEAR)); + + + frontTimeLine.getKeyFrames().addAll(frame1, frame2); + backTimeLine.getKeyFrames().addAll(frame4, frame3); + } + + private void setPT(PerspectiveTransform pt, double t) { + double width = 650; + double height = 450; + double radius = width / 2; + double back = height / 10; + pt.setUlx(radius - Math.sin(t) * radius); + pt.setUly(0 - Math.cos(t) * back); + pt.setUrx(radius + Math.sin(t) * radius); + pt.setUry(0 + Math.cos(t) * back); + pt.setLrx(radius + Math.sin(t) * radius); + pt.setLry(height - Math.cos(t) * back); + pt.setLlx(radius - Math.sin(t) * radius); + pt.setLly(height + Math.cos(t) * back); + } + + private void loadingImage() { + + ImageView logBack = new ImageView("/images/loginBack.jpg"); + logBack.fitHeightProperty().bind(imageHeiht); + logBack.fitWidthProperty().bind(imageWidth); + imagePane.getChildren().add(new Label("", logBack)); + + List files = Arrays.asList(new File(this.getClass().getResource("/images/login/").getPath()).listFiles()); + + sequentialTransition.setAutoReverse(true); + sequentialTransition.setCycleCount(Timeline.INDEFINITE); + + ProcessChain.create().addPublishingTask(() -> imagePane.getChildren(), p -> { + for (int i = 0; i < files.size(); i++) { + + File file = files.get(i); + if (!file.isDirectory()) { + String url = "/images/login/" + file.getName(); + ImageView imageView = new ImageView(url); + imageView.fitHeightProperty().bind(imageHeiht); + imageView.fitWidthProperty().bind(imageWidth); + Label label = new Label("", imageView); + + label.setOpacity(0d); + FadeTransition fadeT = new FadeTransition(Duration.millis(500), label); + fadeT.setDelay(Duration.millis(1500)); + fadeT.setFromValue(0f); + fadeT.setToValue(1f); + fadeT.setCycleCount(1); + sequentialTransition.getChildren().add(fadeT); + + p.publish(label); + + } + + } + }).withFinal(() -> sequentialTransition.play()).run(); + + } + + private void initAction() { + errorLabel.visibleProperty().bind(errorLabel.textProperty().isNotEmpty()); + errorLabel.managedProperty().bind(errorLabel.visibleProperty()); + + lodingBar.visibleProperty().bind(centerPane.disableProperty()); + lodingBar.managedProperty().bind(lodingBar.visibleProperty()); + + userNameTextField.focusedProperty().addListener((o, oldVal, newVal) -> { + if (!newVal) { + userNameTextField.validate(); + } + }); + passWordTextField.focusedProperty().addListener((o, oldVal, newVal) -> { + if (!newVal) { + passWordTextField.validate(); + } + }); + + loginBut.disableProperty().bind(Bindings.or( + userNameTextField.textProperty().isEqualTo(""), + passWordTextField.textProperty().isEqualTo(""))); + + rootPane.setOnKeyPressed(event -> { + if (event.getCode() == KeyCode.ENTER) { + if (loginBut.isDisable() == false) { + login(); + } + } + + }); + angleProperty.addListener((observable, oldValue, newValue) -> { + setPT(frontEffect, angleProperty.get()); + setPT(backEffect, angleProperty.get() - Math.PI); + }); + registeredLink.setOnAction(event -> { + loginPane.setEffect(frontEffect); + registeredPane.setEffect(backEffect); + frontTimeLine.play(); + }); + loginLink.setOnAction(event -> { + loginPane.setEffect(frontEffect); + registeredPane.setEffect(backEffect); + backTimeLine.play(); + }); + } + + + /** + * @Description:登录 + * @param: [] + * @return: void + * @auther: liwen + * @date: 2020/11/6 9:56 上午 + */ + @ActionMethod("login") + private void login() { + + JwtAuthenticationRequest jwtAuthenticationRequest = new JwtAuthenticationRequest(); + jwtAuthenticationRequest.setUsername(userNameTextField.getText()); + jwtAuthenticationRequest.setPassword(EncryptUtil.getInstance().Base64Encode(passWordTextField.getText())); + ProcessChain.create() + .addRunnableInPlatformThread(() -> { + centerPane.setDisable(true); + loginBut.setText("正在登录..."); + }) + .addSupplierInExecutor(() -> Request.connector(LoginFeign.class).login(jwtAuthenticationRequest)) + .addConsumerInPlatformThread(rel -> { + + if (rel.getStatus() == 200) { + errorLabel.setText(""); + ApplicatonStore.setToken(rel.getData()); + loadApplicatonStore(); + } else { + lodingBar.requestFocus(); + errorLabel.setText(rel.getMessage()); + } + + }) + .onException(e -> { + e.printStackTrace(); + errorLabel.setText("无法连接服务器,请检查服务器是否启动。"); + lodingBar.requestFocus(); + }) + .withFinal(() -> { + centerPane.setDisable(false); + loginBut.setText("登录"); + }).run(); + + + } + + public void loadApplicatonStore() { + ProcessChain.create() + .addRunnableInPlatformThread(() -> { + try { + actionHandler.navigate(LoadingController.class); + } catch (Exception e) { + throw new RuntimeException(e); + } + ApplicatonStore.setName(""); + ApplicatonStore.getAllMenu().clear(); + ApplicatonStore.getMenus().clear(); + ApplicatonStore.getElements().clear(); + ApplicatonStore.getPermissionMenus().clear(); + ApplicatonStore.getRoles().clear(); + }) + .addSupplierInExecutor(() -> Request.connector(MenuFeign.class).getMenuAll()) + .addConsumerInPlatformThread(rel -> ApplicatonStore.getAllMenu().addAll(rel)) + .addSupplierInExecutor(() -> + Request.connector(LoginFeign.class).getInfo(ApplicatonStore.getToken()) + ) + .addConsumerInPlatformThread(rel -> { + if (rel.getStatus() == 200) { + FrontUser frontUser = rel.getData(); + ApplicatonStore.setName(frontUser.name); + ApplicatonStore.getMenus().addAll(frontUser.getMenus()); + ApplicatonStore.getRoles().addAll(frontUser.getRoles()); + ApplicatonStore.getElements().addAll(frontUser.getElements()); + ApplicatonStore.setIntroduction(frontUser.getDescription()); + + for (PermissionInfo permissionInfo : frontUser.getElements()) { + ApplicatonStore.getFeatureMap().put(permissionInfo.getCode(), permissionInfo.getName()); + } + + + } else { + AlertUtil.show(rel); + } + }) + .addSupplierInExecutor(() -> + Request.connector(LoginFeign.class).getMenus(ApplicatonStore.getToken()) + ) + .addConsumerInPlatformThread(rel -> { + ApplicatonStore.getPermissionMenus().addAll(rel); + + }) + .addSupplierInExecutor(() -> { + + List allMenuList = ApplicatonStore.getAllMenu(); + Map> allMap = allMenuList.stream().collect(Collectors.groupingBy(MenuVO::getParentId)); + MenuVO rootMenu = allMenuList.stream().min(Comparator.comparing(MenuVO::getParentId)).get(); + + + List permissionInfoList = ApplicatonStore.getPermissionMenus(); + Map> permissionInfoMap = permissionInfoList.stream().collect(Collectors.groupingBy(MenuVO::getParentId)); + Map> permissonTitleMap = permissionInfoList.stream().collect(Collectors.groupingBy(MenuVO::getTitle)); + + for (MenuVO menu : allMap.get(rootMenu.getId())) { + + List childrenMenus = permissionInfoMap.get(menu.getId()); + + List partMenus = permissonTitleMap.get(menu.getTitle()); + if (childrenMenus == null && partMenus == null) { + + continue; + } + + MenuVoCell menuVoCell = new MenuVoCell(menu, childrenMenus); + + ApplicatonStore.getMenuVoCells().add(menuVoCell); + + } + return 0; + + }) + .addConsumerInPlatformThread(rel -> { + + try { + actionHandler.navigate(MainController.class); + } catch (Exception e) { + throw new RuntimeException(e); + } + }) + .onException(e -> { + e.printStackTrace(); + try { + actionHandler.navigate(LoginController.class); + } catch (VetoException vetoException) { + vetoException.printStackTrace(); + } catch (FlowException flowException) { + flowException.printStackTrace(); + } + }) + .run(); + } + + @PreDestroy + private void destroy() { + sequentialTransition.stop(); + } + + +} + + diff --git a/client/src/main/resources/css/app.css b/client/src/main/resources/css/app.css index c5b531e..cc4092d 100644 --- a/client/src/main/resources/css/app.css +++ b/client/src/main/resources/css/app.css @@ -38,7 +38,7 @@ .card-pane { -fx-background-color: -fx-card-base; -fx-padding: 10; - -fx-background-radius: 14; + -fx-background-radius: 14px; -fx-border-color: #313D4F; -fx-border-width: 1px; -fx-border-radius: 14px; @@ -50,11 +50,11 @@ * text和label * * * *******************************************************************************/ -.text, .label { + .label { -fx-text-fill: -fx-text-color; -fx-font-family: "Microsoft YaHei"; -fx-font-weight: 100; - -fx-font-size: -fx-font-base14; + -fx-font-size: 14px; } /******************************************************************************* @@ -218,7 +218,7 @@ .lfx-decorator .lfx-decorator-title-container .lfx-decorator-text { -fx-fill: -fx-text-color; - -fx-font-size: 16; + -fx-font-size: 16px; } .lfx-decorator .lfx-decorator-title-container .jfx-svg-glyph { @@ -574,7 +574,7 @@ -fx-font-family: "Microsoft YaHei"; -fx-font-weight: BOLD; -fx-text-fill: -fx-text-color; - -fx-font-size: -fx-font-base16; + -fx-font-size: 16px; } /**TableView列头展示隐藏列按钮*/ @@ -705,7 +705,7 @@ } .jfx-text-field > .input-line, -.jfx-password-fieldxt-field > .input-line, +.jfx-password-field > .input-line, .jfx-text-area > .input-line, .jfx-combo-box > .input-line { -fx-background-color: -jfx-unfocus-color; @@ -714,27 +714,14 @@ } .jfx-text-field > .input-focused-line, -.jfx-password-fieldxt-field > .input-focused-line, +.jfx-password-field > .input-focused-line, .jfx-text-area > .input-focused-line, -.jfx-tejfx-combo-box > .input-focused-line { +.jfx-combo-box > .input-focused-line { -fx-background-color: -jfx-focus-color; -fx-pref-height: 1px; } -.login-text { - -fx-background-color: transparent; - -fx-font-family: "Microsoft YaHei"; - -fx-font-weight: 100; - -fx-text-fill: -fx-light-text-color; - -fx-prompt-text-fill: #70665e; - -fx-alignment: top-left; - -jfx-focus-color: #70665e; - -jfx-unfocus-color: -fx-light-text-color; -} -#login-glyph-icon { - -fx-fill: #70665e; -} /******************************************************************************* diff --git a/client/src/main/resources/css/login.css b/client/src/main/resources/css/login.css index e69de29..3c480c6 100644 --- a/client/src/main/resources/css/login.css +++ b/client/src/main/resources/css/login.css @@ -0,0 +1,57 @@ +/******************************************************************************* + * * + * login * + * * + ******************************************************************************/ + +#login-title { + -fx-font-family: "Microsoft YaHei"; + -fx-text-fill: #3e3e3e; + -fx-font-size: 30px; + +} + +#login-error-label { + -fx-font-family: "Microsoft YaHei"; + -fx-text-fill: #f56363; + -fx-font-size: 14px; + +} + +#login-welcome-title { + -fx-font-family: "Microsoft YaHei"; + -fx-font-weight: 100; + -fx-text-fill: #ffffff; + -fx-font-size: 45px; +} + +#login-prompt { + -fx-font-family: "Microsoft YaHei"; + -fx-font-weight: 100; + -fx-text-fill: #7a7a7a; + -fx-font-size: 12px; +} + +#login-welcome-text { + -fx-font-family: "Microsoft YaHei"; + -fx-font-weight: 100; + -fx-text-fill: #ffffff; + -fx-font-size: 20px; +} + +#login-text-field { + -fx-background-color: transparent; + -fx-font-family: "Microsoft YaHei"; + -fx-font-weight: 100; + -fx-font-size: 18px; + -fx-text-fill: -fx-light-text-color; + -fx-prompt-text-fill: #70665e; + -fx-alignment: top-left; + -jfx-focus-color: #0355a7; + -jfx-unfocus-color: -fx-light-text-color; +} + +#login-svg-glyph{ + -jfx-size: 20px; + -fx-background-color: #70665e; +} \ No newline at end of file diff --git a/client/src/main/resources/fonts/icon_font/iconfont.svg b/client/src/main/resources/fonts/icon_font/iconfont.svg index 1d6b54d..723670c 100644 --- a/client/src/main/resources/fonts/icon_font/iconfont.svg +++ b/client/src/main/resources/fonts/icon_font/iconfont.svg @@ -20,6 +20,15 @@ Created by iconfont /> + + + + + + + + + diff --git a/client/src/main/resources/fxml/login/Untitled.fxml b/client/src/main/resources/fxml/login/Untitled.fxml new file mode 100644 index 0000000..49255fb --- /dev/null +++ b/client/src/main/resources/fxml/login/Untitled.fxml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/src/main/resources/images/folder/loding.png b/client/src/main/resources/images/folder/loding.png index 9c7c3ad..7b6fc05 100644 Binary files a/client/src/main/resources/images/folder/loding.png and b/client/src/main/resources/images/folder/loding.png differ diff --git a/client/src/main/resources/images/folder/loding1.png b/client/src/main/resources/images/folder/loding1.png new file mode 100644 index 0000000..9c7c3ad Binary files /dev/null and b/client/src/main/resources/images/folder/loding1.png differ diff --git a/client/src/test/java/TestFx.java b/client/src/test/java/TestFx.java index 9decf89..b1b7a78 100644 --- a/client/src/test/java/TestFx.java +++ b/client/src/test/java/TestFx.java @@ -5,74 +5,139 @@ * @date: 2020/9/11 10:53 */ -import com.epri.fx.client.AppStartup; -import com.epri.fx.client.store.ApplicatonStore; -import com.jfoenix.controls.JFXButton; -import com.jfoenix.svg.SVGGlyph; -import com.jfoenix.svg.SVGGlyphLoader; import javafx.animation.Interpolator; -import javafx.animation.RotateTransition; -import javafx.animation.SequentialTransition; +import javafx.animation.KeyFrame; +import javafx.animation.KeyValue; +import javafx.animation.Timeline; import javafx.application.Application; +import javafx.beans.binding.Bindings; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.event.Event; +import javafx.event.EventHandler; import javafx.geometry.Point3D; -import javafx.scene.DepthTest; import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.effect.PerspectiveTransform; import javafx.scene.layout.StackPane; -import javafx.scene.paint.Color; +import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.util.Duration; -import java.io.IOException; public class TestFx extends Application { + //正面视图 + public StackPane frontNode; + //反面视图 + public StackPane backNode; + //是否翻转 + boolean flipped = false; + //翻转角度 + DoubleProperty time = new SimpleDoubleProperty(Math.PI / 2); + //正面翻转特效 + PerspectiveTransform frontEffect = new PerspectiveTransform(); + //反面翻转特效 + PerspectiveTransform backEffect = new PerspectiveTransform(); + Timeline anim = new Timeline(); + Timeline anim1 = new Timeline(); + @Override public void start(Stage primaryStage) throws Exception { - new Thread(() -> { - try { - SVGGlyphLoader.loadGlyphsFont(AppStartup.class.getResourceAsStream("/fonts/icon_font/iconfont.svg"), - ApplicatonStore.ICON_FONT_KEY); -// SVGGlyphLoader.loadGlyphsFont(AppStartup.class.getResourceAsStream("/fonts/icon_font/icon-font-solid.svg"), -// "IconFontSolid.svg"); - } catch (IOException ioExc) { - ioExc.printStackTrace(); - } - }).start(); - JFXButton button = new JFXButton(""); - button.setPrefHeight(100); - button.setPrefWidth(200); - button.setRipplerFill(Color.RED); - SVGGlyph materialIconView = SVGGlyphLoader.getIcoMoonGlyph(ApplicatonStore.ICON_FONT_KEY + ".home-outline"); -// materialIconView.setDepthTest(DepthTest.DISABLE); - materialIconView.setRotationAxis(new Point3D(0, 1, 0)); - materialIconView.setSize(80); - button.setGraphic(materialIconView); - StackPane stackPane = new StackPane(); - stackPane.getChildren().add(button); + StackPane rootPane = new StackPane(); - RotateTransition transition1 = new RotateTransition(Duration.millis(500), materialIconView); - transition1.setByAngle(180); - transition1.setInterpolator(Interpolator.EASE_BOTH); - transition1.setOnFinished(event -> { - }); - - - button.setOnMouseEntered(event -> { - transition1.play(); - }); - button.setOnMouseExited(event -> { - transition1.play(); - }); - - Scene scene = new Scene(stackPane, 1000, 700); + rootPane.getChildren().addAll(create()); + Scene scene = new Scene(rootPane, 1000, 700); primaryStage.setScene(scene); primaryStage.setTitle("JavaFX Welcome"); primaryStage.show(); } + private StackPane create() { + + Button a= new Button("正面视图"); + Button b= new Button("反面视图"); + a.setOnAction(event -> { + + frontNode.setEffect(frontEffect); + backNode.setEffect(backEffect); + anim.play(); + }); + b.setOnAction(event -> { + + frontNode.setEffect(frontEffect); + backNode.setEffect(backEffect); + anim1.play(); + }); + frontNode = new StackPane(); + frontNode.getChildren().add(a); + frontNode.setStyle("-fx-background-color: #11aa55"); + backNode = new StackPane(); + backNode.getChildren().add(b); + + backNode.setStyle("-fx-background-color: #88bb55"); + KeyFrame frame1 = new KeyFrame(Duration.ZERO, new KeyValue(time, + Math.PI / 2, Interpolator.LINEAR)); + KeyFrame frame2 = new KeyFrame(Duration.seconds(1), + new EventHandler() { + @Override + public void handle(Event event) { + frontNode.setEffect(null); + backNode.setEffect(null); + } + + }, new KeyValue(time, -Math.PI / 2, Interpolator.LINEAR)); + + KeyFrame frame3 = new KeyFrame(Duration.seconds(1), new EventHandler() { + @Override + public void handle(Event event) { + frontNode.setEffect(null); + backNode.setEffect(null); + } + + }, new KeyValue(time, + Math.PI / 2, Interpolator.LINEAR)); + KeyFrame frame4 = new KeyFrame(Duration.ZERO, new KeyValue(time, -Math.PI / 2, Interpolator.LINEAR)); + + time.addListener((observable, oldValue, newValue) -> { + setPT(frontEffect, time.get()); + setPT(backEffect, time.get() - Math.PI); + }); + anim.getKeyFrames().addAll(frame1, frame2); + + anim1.getKeyFrames().addAll(frame4, frame3); + + + backNode.visibleProperty().bind( + Bindings.when(time.lessThan(0)).then(true).otherwise(false)); + frontNode.visibleProperty().bind(backNode.visibleProperty().not()); + + + StackPane stackPane = new StackPane(); + stackPane.setPrefSize(460, 450); + stackPane.setMaxSize(460, 450); + stackPane.getChildren().addAll(backNode, frontNode); + return stackPane; + } + + private void setPT(PerspectiveTransform pt, double t) { + double width = 450; + double height = 450; + double radius = width / 2; + double back = height / 10; + pt.setUlx(radius - Math.sin(t) * radius); + pt.setUly(0 - Math.cos(t) * back); + pt.setUrx(radius + Math.sin(t) * radius); + pt.setUry(0 + Math.cos(t) * back); + pt.setLrx(radius + Math.sin(t) * radius); + pt.setLry(height - Math.cos(t) * back); + pt.setLlx(radius - Math.sin(t) * radius); + pt.setLly(height + Math.cos(t) * back); + } + public static void main(String[] args) { launch(args); } diff --git a/client/src/test/java/TimelineEvents.java b/client/src/test/java/TimelineEvents.java new file mode 100644 index 0000000..e505bf0 --- /dev/null +++ b/client/src/test/java/TimelineEvents.java @@ -0,0 +1,94 @@ +import javafx.application.Application; +import javafx.stage.Stage; +import javafx.animation.AnimationTimer; +import javafx.animation.KeyFrame; +import javafx.animation.KeyValue; +import javafx.animation.Timeline; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Group; +import javafx.scene.Scene; +import javafx.scene.effect.Lighting; +import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.scene.shape.Circle; +import javafx.scene.text.Text; +import javafx.util.Duration; + +public class TimelineEvents extends Application { + + //主时间轴 + private Timeline timeline; + private AnimationTimer timer; + + //用于指定实际帧的变量 + private Integer i=0; + + @Override public void start(Stage stage) { + Group p = new Group(); + Scene scene = new Scene(p); + stage.setScene(scene); + stage.setWidth(500); + stage.setHeight(500); + p.setTranslateX(80); + p.setTranslateY(80); + + //创建一个带有特效的圆 + final Circle circle = new Circle(20, Color.rgb(156,216,255)); + circle.setEffect(new Lighting()); + //在圆内部创建一个文本 + final Text text = new Text (i.toString()); + text.setStroke(Color.BLACK); + //为带有文本的圆创建一个布局 + final StackPane stack = new StackPane(); + stack.getChildren().addAll(circle, text); + stack.setLayoutX(30); + stack.setLayoutY(30); + + p.getChildren().add(stack); + stage.show(); + + //为了移动圆创建一个时间轴 + timeline = new Timeline(); + timeline.setCycleCount(1); + timeline.setAutoReverse(true); + + //在每个帧开始时你可以添加一个特定的动作 + timer = new AnimationTimer() { + @Override + public void handle(long l) { + text.setText(i.toString()); + i++; + } + + }; + + //创建一个带有缩放因子的keyValue:将圆缩放2倍 + KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2); + KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2); + + //创建一个KeyFrame, keyValue会在2秒钟时抵达 + Duration duration = Duration.millis(2000); + //当抵达关键帧时可以指定一个特定的动作 + EventHandler onFinished = new EventHandler() { + public void handle(ActionEvent t) { + stack.setTranslateX(java.lang.Math.random()*200-100); + //复位计数器  + i = 0; + } + }; + + KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY); + + //将关键帧添加到时间轴中 + timeline.getKeyFrames().add(keyFrame); + + timeline.play(); + timer.start(); + } + + + public static void main(String[] args) { + Application.launch(args); + } + } \ No newline at end of file