修改登录框
This commit is contained in:
@@ -2,7 +2,6 @@ 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;
|
||||
@@ -70,7 +69,7 @@ public class AppStartup extends Application {
|
||||
|
||||
ApplicationContext.getInstance().register(stage, Stage.class);
|
||||
|
||||
Flow flow = new Flow(LoginControllerNew.class);
|
||||
Flow flow = new Flow(LoginController.class);
|
||||
FlowHandler flowHandler = flow.createHandler();
|
||||
StackPane rootPane = flowHandler.start(new AnimatedFlowContainer(Duration.millis(320), ContainerAnimations.SWIPE_LEFT));
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@ 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.feign.admin.MenuFeign;
|
||||
import com.epri.fx.client.store.ApplicatonStore;
|
||||
import com.epri.fx.client.request.feign.login.LoginFeign;
|
||||
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.DynamicEnumUtils;
|
||||
import com.epri.fx.server.util.EncryptUtil;
|
||||
import com.epri.fx.server.util.user.JwtAuthenticationRequest;
|
||||
import com.epri.fx.server.vo.FrontUser;
|
||||
@@ -18,6 +17,8 @@ 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;
|
||||
@@ -34,16 +35,17 @@ import javafx.beans.property.DoubleProperty;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.EventType;
|
||||
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.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Duration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -65,28 +67,50 @@ import java.util.stream.Collectors;
|
||||
@ViewController("/fxml/login/login.fxml")
|
||||
public class LoginController {
|
||||
|
||||
|
||||
@FXML
|
||||
|
||||
private Pane imagePane;
|
||||
@FXML
|
||||
private GridPane enterPane;
|
||||
@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;
|
||||
@FXML
|
||||
private Label errorLabel;
|
||||
@FXML
|
||||
@ActionTrigger("login")
|
||||
private JFXButton loginBut;
|
||||
@FXML
|
||||
private VBox signCredsPane;
|
||||
|
||||
@FXML
|
||||
private JFXProgressBar lodingBar;
|
||||
//翻转角度
|
||||
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;
|
||||
@@ -95,47 +119,42 @@ public class LoginController {
|
||||
|
||||
private DoubleProperty imageWidth = new SimpleDoubleProperty();
|
||||
private DoubleProperty imageHeiht = new SimpleDoubleProperty();
|
||||
private Stage stage;
|
||||
|
||||
|
||||
@Inject
|
||||
private Session session;
|
||||
|
||||
@FXML
|
||||
@ActionTrigger("login")
|
||||
private JFXButton loginBut;
|
||||
|
||||
@FXMLViewFlowContext
|
||||
private ViewFlowContext flowContext;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
errorLabel.visibleProperty().bind(errorLabel.textProperty().isNotEmpty());
|
||||
errorLabel.managedProperty().bind(errorLabel.visibleProperty());
|
||||
|
||||
lodingBar.visibleProperty().bind(enterPane.disableProperty());
|
||||
lodingBar.managedProperty().bind(lodingBar.visibleProperty());
|
||||
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");
|
||||
|
||||
userNameTextField.focusedProperty().addListener((o, oldVal, newVal) -> {
|
||||
if (!newVal) {
|
||||
userNameTextField.validate();
|
||||
}
|
||||
});
|
||||
passWordTextField.focusedProperty().addListener((o, oldVal, newVal) -> {
|
||||
if (!newVal) {
|
||||
passWordTextField.validate();
|
||||
}
|
||||
});
|
||||
userIcon.setGraphic(userSvg);
|
||||
pwdIcon.setGraphic(pwdSvg);
|
||||
reuserIcon.setGraphic(reuserSvg);
|
||||
repwdIcon.setGraphic(repwdSvg);
|
||||
repwd2Icon.setGraphic(repwd2Svg);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
loginBut.disableProperty().bind(Bindings.or(
|
||||
userNameTextField.textProperty().isEqualTo(""),
|
||||
passWordTextField.textProperty().isEqualTo("")));
|
||||
|
||||
rootPane.setOnKeyPressed(event -> {
|
||||
if (event.getCode() == KeyCode.ENTER) {
|
||||
if (loginBut.isDisable() == false) {
|
||||
login();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
imagePane.widthProperty().addListener(new ChangeListener<Number>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
|
||||
@@ -149,16 +168,25 @@ public class LoginController {
|
||||
}
|
||||
});
|
||||
|
||||
registeredPane.visibleProperty().bind(
|
||||
Bindings.when(angleProperty.lessThan(0)).then(true).otherwise(false));
|
||||
loginPane.visibleProperty().bind(registeredPane.visibleProperty().not());
|
||||
|
||||
initAnimation();
|
||||
loadingImage();
|
||||
initAction();
|
||||
|
||||
FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), signCredsPane);
|
||||
}
|
||||
|
||||
private void initAnimation() {
|
||||
FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), centerPane);
|
||||
fadeTransition.setFromValue(0f);
|
||||
fadeTransition.setToValue(1f);
|
||||
|
||||
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(500), signCredsPane);
|
||||
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(500), centerPane);
|
||||
translateTransition.setInterpolator(Interpolator.EASE_BOTH);
|
||||
translateTransition.setFromY(400);
|
||||
translateTransition.setToY(signCredsPane.getLayoutY());
|
||||
translateTransition.setToY(centerPane.getLayoutY());
|
||||
|
||||
ParallelTransition parallelTransition = new ParallelTransition();
|
||||
parallelTransition.setDelay(Duration.millis(1500));
|
||||
@@ -169,6 +197,52 @@ public class LoginController {
|
||||
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);
|
||||
@@ -205,10 +279,62 @@ public class LoginController {
|
||||
}
|
||||
}).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() {
|
||||
|
||||
@@ -217,7 +343,7 @@ public class LoginController {
|
||||
jwtAuthenticationRequest.setPassword(EncryptUtil.getInstance().Base64Encode(passWordTextField.getText()));
|
||||
ProcessChain.create()
|
||||
.addRunnableInPlatformThread(() -> {
|
||||
enterPane.setDisable(true);
|
||||
centerPane.setDisable(true);
|
||||
loginBut.setText("正在登录...");
|
||||
})
|
||||
.addSupplierInExecutor(() -> Request.connector(LoginFeign.class).login(jwtAuthenticationRequest))
|
||||
@@ -239,7 +365,7 @@ public class LoginController {
|
||||
lodingBar.requestFocus();
|
||||
})
|
||||
.withFinal(() -> {
|
||||
enterPane.setDisable(false);
|
||||
centerPane.setDisable(false);
|
||||
loginBut.setText("登录");
|
||||
}).run();
|
||||
|
||||
@@ -312,7 +438,7 @@ public class LoginController {
|
||||
continue;
|
||||
}
|
||||
|
||||
MenuVoCell menuVoCell=new MenuVoCell(menu,childrenMenus);
|
||||
MenuVoCell menuVoCell = new MenuVoCell(menu, childrenMenus);
|
||||
|
||||
ApplicatonStore.getMenuVoCells().add(menuVoCell);
|
||||
|
||||
|
||||
@@ -1,478 +0,0 @@
|
||||
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<Number>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
|
||||
imageWidth.setValue(newValue);
|
||||
}
|
||||
});
|
||||
imagePane.heightProperty().addListener(new ChangeListener<Number>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Number> 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<File> 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<MenuVO> allMenuList = ApplicatonStore.getAllMenu();
|
||||
Map<Integer, List<MenuVO>> allMap = allMenuList.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
|
||||
MenuVO rootMenu = allMenuList.stream().min(Comparator.comparing(MenuVO::getParentId)).get();
|
||||
|
||||
|
||||
List<MenuVO> permissionInfoList = ApplicatonStore.getPermissionMenus();
|
||||
Map<Integer, List<MenuVO>> permissionInfoMap = permissionInfoList.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
|
||||
Map<String, List<MenuVO>> permissonTitleMap = permissionInfoList.stream().collect(Collectors.groupingBy(MenuVO::getTitle));
|
||||
|
||||
for (MenuVO menu : allMap.get(rootMenu.getId())) {
|
||||
|
||||
List<MenuVO> childrenMenus = permissionInfoMap.get(menu.getId());
|
||||
|
||||
List<MenuVO> 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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.ContentDisplay;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import com.jfoenix.controls.JFXButton?>
|
||||
<?import com.jfoenix.controls.JFXPasswordField?>
|
||||
<?import com.jfoenix.controls.JFXProgressBar?>
|
||||
<?import com.jfoenix.controls.JFXTextField?>
|
||||
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||
<?import javafx.scene.control.Hyperlink?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.effect.DropShadow?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<StackPane fx:id="rootPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="970.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<Pane fx:id="imagePane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: #3F007F;" />
|
||||
<StackPane fx:id="centerPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="450.0" prefWidth="650.0" style="-fx-background-radius: 14;">
|
||||
<children>
|
||||
<HBox fx:id="loginPane">
|
||||
<children>
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="450.0" prefWidth="251.0" style="-fx-background-radius: 14 0 0 14; -fx-background-color: linear-gradient(#e66465, #9198e5);">
|
||||
<children>
|
||||
<Label id="login-welcome-title" layoutX="70.0" layoutY="134.0" text="欢迎" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="48.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label id="login-welcome-text" layoutX="38.0" layoutY="213.0" text="登录访问您的帐户" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="79.0" layoutY="419.0" text="©中国xxx∙xxx" textFill="#ffffffad" />
|
||||
</children>
|
||||
<effect>
|
||||
<DropShadow color="#0000009e" height="0.0" radius="19.17" width="78.68" />
|
||||
</effect>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="450.0" prefWidth="352.0" style="-fx-background-color: #ffffff; -fx-background-radius: 0 14 14 0;" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label id="login-title" layoutX="168.0" layoutY="45.0" text="登录">
|
||||
<font>
|
||||
<Font name="System Bold" size="33.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<JFXProgressBar fx:id="lodingBar" layoutX="66.0" layoutY="83.0" visible="false" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
<JFXTextField id="login-text-field" fx:id="userNameTextField" labelFloat="true" layoutX="71.0" layoutY="126.0" prefHeight="45.0" prefWidth="260.0" promptText="用户名">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXTextField>
|
||||
<JFXPasswordField id="login-text-field" fx:id="passWordTextField" labelFloat="true" layoutX="71.0" layoutY="210.0" prefHeight="45.0" prefWidth="260.0" promptText="密码">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXPasswordField>
|
||||
<JFXToggleButton alignment="CENTER_LEFT" layoutX="66.0" layoutY="265.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="45.0" prefWidth="260.0" text="记住密码" />
|
||||
<JFXButton fx:id="loginBut" layoutX="71.0" layoutY="326.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="50.0" prefWidth="260.0" style="-fx-background-color: linear-gradient(#e66465, #9198e5); -fx-background-radius: 25;" text="登录" textFill="#fffefe">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXButton>
|
||||
<Hyperlink fx:id="registeredLink" layoutX="226.0" layoutY="404.0" text="注册" />
|
||||
<Label id="login-prompt" layoutX="141.0" layoutY="408.0" text="还没有帐号?去" />
|
||||
<VBox alignment="CENTER" layoutY="302.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<children>
|
||||
<Label id="login-error-label" fx:id="errorLabel" alignment="CENTER" contentDisplay="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" VBox.vgrow="ALWAYS" />
|
||||
</children>
|
||||
</VBox>
|
||||
<Label id="icon-label" fx:id="userIcon" alignment="CENTER" contentDisplay="CENTER" layoutX="296.0" layoutY="131.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
<Label id="icon-label" fx:id="pwdIcon" alignment="CENTER" contentDisplay="CENTER" layoutX="296.0" layoutY="215.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox fx:id="registeredPane" visible="false">
|
||||
<children>
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="450.0" prefWidth="251.0" style="-fx-background-radius: 14 0 0 14; -fx-background-color: linear-gradient(#3F007F, #7226A5);">
|
||||
<children>
|
||||
<Label id="login-welcome-title" layoutX="70.0" layoutY="134.0" text="欢迎" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="48.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label id="login-welcome-text" layoutX="38.0" layoutY="213.0" text="注册访问您的帐户" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="79.0" layoutY="419.0" text="©中国xxx∙xxx" textFill="#ffffffad" />
|
||||
</children>
|
||||
<effect>
|
||||
<DropShadow color="#0000009e" height="0.0" radius="19.17" width="78.68" />
|
||||
</effect>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="450.0" prefWidth="352.0" style="-fx-background-color: #ffffff; -fx-background-radius: 0 14 14 0;" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label id="login-title" layoutX="166.0" layoutY="45.0" text="注册">
|
||||
<font>
|
||||
<Font name="System Bold" size="33.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<JFXProgressBar layoutX="66.0" layoutY="83.0" visible="false" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
<JFXTextField id="login-text-field" labelFloat="true" layoutX="71.0" layoutY="122.0" prefHeight="45.0" prefWidth="260.0" promptText="用户名" AnchorPane.topAnchor="122.0">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXTextField>
|
||||
<JFXPasswordField id="login-text-field" labelFloat="true" layoutX="69.0" layoutY="197.0" prefHeight="45.0" prefWidth="260.0" promptText="密码" AnchorPane.topAnchor="197.0">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXPasswordField>
|
||||
<JFXButton layoutX="71.0" layoutY="340.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="50.0" prefWidth="260.0" style="-fx-background-color: linear-gradient(#3F007F, #7226A5); -fx-background-radius: 25;" text="注册" textFill="#fffefe">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXButton>
|
||||
<Hyperlink fx:id="loginLink" layoutX="212.0" layoutY="402.0" text="登录" />
|
||||
<Label id="login-prompt" layoutX="147.0" layoutY="406.0" text="已有帐号去" />
|
||||
<JFXPasswordField id="login-text-field" labelFloat="true" layoutX="67.0" layoutY="270.0" prefHeight="45.0" prefWidth="260.0" promptText="确认密码" AnchorPane.topAnchor="270.0">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXPasswordField>
|
||||
<Label id="icon-label" fx:id="reuserIcon" alignment="CENTER" contentDisplay="CENTER" layoutX="292.0" layoutY="127.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
<Label id="icon-label" fx:id="repwdIcon" alignment="CENTER" contentDisplay="CENTER" layoutX="292.0" layoutY="202.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
<Label id="icon-label" fx:id="repwd2Icon" alignment="CENTER" contentDisplay="CENTER" layoutX="292.0" layoutY="275.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
<effect>
|
||||
<DropShadow color="#0000009e" height="0.0" offsetY="10.0" radius="44.9725" width="181.89" />
|
||||
</effect>
|
||||
</StackPane>
|
||||
</children>
|
||||
</StackPane>
|
||||
@@ -4,102 +4,140 @@
|
||||
<?import com.jfoenix.controls.JFXPasswordField?>
|
||||
<?import com.jfoenix.controls.JFXProgressBar?>
|
||||
<?import com.jfoenix.controls.JFXTextField?>
|
||||
<?import com.jfoenix.validation.RequiredFieldValidator?>
|
||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import com.jfoenix.controls.JFXToggleButton?>
|
||||
<?import javafx.scene.control.Hyperlink?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.effect.DropShadow?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<StackPane fx:id="rootPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="573.0" prefWidth="857.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<AnchorPane>
|
||||
<children>
|
||||
<Pane id="imagePane" fx:id="imagePane" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: #664433;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<VBox fx:id="signCredsPane" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="450.0" prefWidth="460.0" style="-fx-background-color: rgba(255,255,255,1); -fx-background-radius: 10;">
|
||||
<children>
|
||||
<Text fill="#1a1816" lineSpacing="2.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 3em;" text="xxx帐户登录" textAlignment="CENTER" wrappingWidth="261.34375">
|
||||
<font>
|
||||
<Font size="28.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</Text>
|
||||
<JFXProgressBar fx:id="lodingBar" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="3.0" />
|
||||
<GridPane fx:id="enterPane" vgap="10.0" VBox.vgrow="ALWAYS">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<StackPane fx:id="rootPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="970.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<Pane fx:id="imagePane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: #3F007F;" />
|
||||
<StackPane fx:id="centerPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="450.0" prefWidth="650.0" style="-fx-background-radius: 14;">
|
||||
<children>
|
||||
<HBox fx:id="loginPane">
|
||||
<children>
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="55.0" prefWidth="340.0">
|
||||
<children>
|
||||
<JFXTextField fx:id="userNameTextField" focusColor="#6a9d67" labelFloat="true" layoutX="2.0" layoutY="50.0" prefHeight="66.0" prefWidth="350.0" promptText="用户名" style="-fx-text-fill: #3F3A36; -fx-prompt-text-fill: #70665e; -fx-font-size: 2em;" styleClass="login-text" unFocusColor="#70665e" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="50.0">
|
||||
<validators>
|
||||
<RequiredFieldValidator message="Input Required!">
|
||||
<!-- <FontIcon iconLiteral="fas-exclamation-triangle"/>-->
|
||||
</RequiredFieldValidator>
|
||||
</validators>
|
||||
<font>
|
||||
<Font name="System Bold" size="20.0" />
|
||||
</font>
|
||||
</JFXTextField>
|
||||
<FontAwesomeIconView id="login-glyph-icon" fill="#3f3a36" glyphName="USER" layoutX="325.0" layoutY="92.0" size="26" text="" AnchorPane.rightAnchor="4.571428298950195" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="55.0" prefWidth="340.0" GridPane.rowIndex="1">
|
||||
<children>
|
||||
<JFXPasswordField fx:id="passWordTextField" focusColor="#6a9d67" labelFloat="true" layoutY="56.0" prefHeight="66.0" prefWidth="350.0" promptText="密码" style="-fx-prompt-text-fill: #70665e; -fx-text-fill: #3F3A36; -fx-font-size: 2em;" styleClass="login-text" unFocusColor="#70665e" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="56.0">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
<validators>
|
||||
<RequiredFieldValidator message="Input Required!">
|
||||
<!-- <FontIcon iconLiteral="fas-exclamation-triangle"/>-->
|
||||
</RequiredFieldValidator>
|
||||
</validators>
|
||||
</JFXPasswordField>
|
||||
<FontAwesomeIconView id="login-glyph-icon" fill="#3f3a36" glyphName="UNLOCK_ALT" layoutX="326.0" layoutY="96.0" size="30" AnchorPane.rightAnchor="4.714284896850586" />
|
||||
</children>
|
||||
<GridPane.margin>
|
||||
<Insets />
|
||||
</GridPane.margin>
|
||||
</AnchorPane>
|
||||
<VBox alignment="CENTER" spacing="10.0" GridPane.rowIndex="2">
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="450.0" prefWidth="251.0" style="-fx-background-radius: 14 0 0 14; -fx-background-color: linear-gradient(#e66465, #9198e5);">
|
||||
<children>
|
||||
<Label fx:id="errorLabel" style="-fx-font-size: 1.2em;" textFill="#c54a39" />
|
||||
<JFXButton fx:id="loginBut" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="48.0" prefWidth="355.0" style="-fx-background-color: #6A9D67; -fx-background-radius: 7; -fx-font-size: 14pt; -fx-font-weight: BOLD;" text="登录" textFill="WHITE">
|
||||
</JFXButton>
|
||||
<Label id="login-welcome-title" layoutX="70.0" layoutY="134.0" text="欢迎" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="48.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label id="login-welcome-text" layoutX="38.0" layoutY="213.0" text="登录访问您的帐户" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="79.0" layoutY="419.0" text="©中国xxx∙xxx" textFill="#ffffffad" />
|
||||
</children>
|
||||
</VBox>
|
||||
<effect>
|
||||
<DropShadow color="#0000009e" height="0.0" radius="19.17" width="78.68" />
|
||||
</effect>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="450.0" prefWidth="352.0" style="-fx-background-color: #ffffff; -fx-background-radius: 0 14 14 0;" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label id="login-title" layoutX="168.0" layoutY="45.0" text="登录">
|
||||
<font>
|
||||
<Font name="System Bold" size="33.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<JFXProgressBar fx:id="lodingBar" layoutX="66.0" layoutY="83.0" visible="false" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
<JFXTextField id="login-text-field" fx:id="userNameTextField" labelFloat="true" layoutX="71.0" layoutY="126.0" prefHeight="45.0" prefWidth="260.0" promptText="用户名">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXTextField>
|
||||
<JFXPasswordField id="login-text-field" fx:id="passWordTextField" labelFloat="true" layoutX="71.0" layoutY="210.0" prefHeight="45.0" prefWidth="260.0" promptText="密码">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXPasswordField>
|
||||
<JFXToggleButton alignment="CENTER_LEFT" layoutX="66.0" layoutY="265.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="45.0" prefWidth="260.0" text="记住密码" />
|
||||
<JFXButton fx:id="loginBut" layoutX="71.0" layoutY="326.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="50.0" prefWidth="260.0" style="-fx-background-color: linear-gradient(#e66465, #9198e5); -fx-background-radius: 25;" text="登录" textFill="#fffefe">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXButton>
|
||||
<Hyperlink fx:id="registeredLink" layoutX="226.0" layoutY="404.0" text="注册" />
|
||||
<Label id="login-prompt" layoutX="141.0" layoutY="408.0" text="还没有帐号?去" />
|
||||
<VBox alignment="CENTER" layoutY="302.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
||||
<children>
|
||||
<Label id="login-error-label" fx:id="errorLabel" alignment="CENTER" contentDisplay="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" VBox.vgrow="ALWAYS" />
|
||||
</children>
|
||||
</VBox>
|
||||
<Label id="icon-label" fx:id="userIcon" alignment="CENTER" contentDisplay="CENTER" layoutX="296.0" layoutY="131.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
<Label id="icon-label" fx:id="pwdIcon" alignment="CENTER" contentDisplay="CENTER" layoutX="296.0" layoutY="215.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
<Text fill="#3f3a36" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 12px;" text="©中国xxx∙xxx" textAlignment="CENTER" />
|
||||
</children>
|
||||
<StackPane.margin>
|
||||
<Insets />
|
||||
</StackPane.margin>
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="30.0" right="30.0" top="30.0" />
|
||||
</padding>
|
||||
<effect>
|
||||
<DropShadow color="#0000009f" height="163.93" radius="79.945" width="157.85" />
|
||||
</effect>
|
||||
</VBox>
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox fx:id="registeredPane" visible="false">
|
||||
<children>
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="450.0" prefWidth="251.0" style="-fx-background-radius: 14 0 0 14; -fx-background-color: linear-gradient(#3F007F, #7226A5);">
|
||||
<children>
|
||||
<Label id="login-welcome-title" layoutX="70.0" layoutY="134.0" text="欢迎" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="48.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label id="login-welcome-text" layoutX="38.0" layoutY="213.0" text="注册访问您的帐户" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="79.0" layoutY="419.0" text="©中国xxx∙xxx" textFill="#ffffffad" />
|
||||
</children>
|
||||
<effect>
|
||||
<DropShadow color="#0000009e" height="0.0" radius="19.17" width="78.68" />
|
||||
</effect>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="450.0" prefWidth="352.0" style="-fx-background-color: #ffffff; -fx-background-radius: 0 14 14 0;" HBox.hgrow="ALWAYS">
|
||||
<children>
|
||||
<Label id="login-title" layoutX="166.0" layoutY="45.0" text="注册">
|
||||
<font>
|
||||
<Font name="System Bold" size="33.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<JFXProgressBar layoutX="66.0" layoutY="83.0" visible="false" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
<JFXTextField id="login-text-field" labelFloat="true" layoutX="71.0" layoutY="122.0" prefHeight="45.0" prefWidth="260.0" promptText="用户名" AnchorPane.topAnchor="122.0">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXTextField>
|
||||
<JFXPasswordField id="login-text-field" labelFloat="true" layoutX="69.0" layoutY="197.0" prefHeight="45.0" prefWidth="260.0" promptText="密码" AnchorPane.topAnchor="197.0">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXPasswordField>
|
||||
<JFXButton layoutX="71.0" layoutY="340.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="50.0" prefWidth="260.0" style="-fx-background-color: linear-gradient(#3F007F, #7226A5); -fx-background-radius: 25;" text="注册" textFill="#fffefe">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXButton>
|
||||
<Hyperlink fx:id="loginLink" layoutX="212.0" layoutY="402.0" text="登录" />
|
||||
<Label id="login-prompt" layoutX="147.0" layoutY="406.0" text="已有帐号去" />
|
||||
<JFXPasswordField id="login-text-field" labelFloat="true" layoutX="67.0" layoutY="270.0" prefHeight="45.0" prefWidth="260.0" promptText="确认密码" AnchorPane.topAnchor="270.0">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</JFXPasswordField>
|
||||
<Label id="icon-label" fx:id="reuserIcon" alignment="CENTER" contentDisplay="CENTER" layoutX="292.0" layoutY="127.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
<Label id="icon-label" fx:id="repwdIcon" alignment="CENTER" contentDisplay="CENTER" layoutX="292.0" layoutY="202.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
<Label id="icon-label" fx:id="repwd2Icon" alignment="CENTER" contentDisplay="CENTER" layoutX="292.0" layoutY="275.0" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="35.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
<effect>
|
||||
<DropShadow color="#0000009e" height="0.0" offsetY="10.0" radius="44.9725" width="181.89" />
|
||||
</effect>
|
||||
</StackPane>
|
||||
</children>
|
||||
</StackPane>
|
||||
|
||||
Reference in New Issue
Block a user