修改退出方式
This commit is contained in:
parent
b576a8931c
commit
5e2dbc6191
@ -178,4 +178,10 @@ public class AppUI extends Application {
|
|||||||
private void onBrowseEvent(BrowseEvent event) {
|
private void onBrowseEvent(BrowseEvent event) {
|
||||||
getHostServices().showDocument(event.getUri().toString());
|
getHostServices().showDocument(event.getUri().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() throws Exception {
|
||||||
|
super.stop();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,9 +169,7 @@ public class MainView implements FxmlView<MainViewModel>, Initializable {
|
|||||||
|
|
||||||
closeBut.setGraphic(close);
|
closeBut.setGraphic(close);
|
||||||
closeBut.setOnAction(actionEvent -> {
|
closeBut.setOnAction(actionEvent -> {
|
||||||
Stage stage = (Stage) closeBut.getScene().getWindow();
|
mainViewModel.loginOut(true);
|
||||||
|
|
||||||
stage.close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -387,7 +385,7 @@ public class MainView implements FxmlView<MainViewModel>, Initializable {
|
|||||||
Bounds bounds = userBut.localToScreen(userBut.getBoundsInLocal());
|
Bounds bounds = userBut.localToScreen(userBut.getBoundsInLocal());
|
||||||
contextMenu.show(userBut, bounds.getMinX(), bounds.getMinY() + bounds.getHeight());
|
contextMenu.show(userBut, bounds.getMinX(), bounds.getMinY() + bounds.getHeight());
|
||||||
|
|
||||||
menuItem2.setOnAction(actionEvent -> mainViewModel.loginOut());
|
menuItem2.setOnAction(actionEvent -> mainViewModel.loginOut(false));
|
||||||
menuItem1.setOnAction(actionEvent -> {
|
menuItem1.setOnAction(actionEvent -> {
|
||||||
|
|
||||||
ViewTuple<UserInfoView, UserInfoViewModel> viewTuple = FluentViewLoader.fxmlView(UserInfoView.class).load();
|
ViewTuple<UserInfoView, UserInfoViewModel> viewTuple = FluentViewLoader.fxmlView(UserInfoView.class).load();
|
||||||
|
@ -5,6 +5,7 @@ import com.lw.dillon.admin.module.system.controller.admin.auth.vo.AuthPermission
|
|||||||
import com.lw.fx.request.Request;
|
import com.lw.fx.request.Request;
|
||||||
import com.lw.fx.store.AppStore;
|
import com.lw.fx.store.AppStore;
|
||||||
import com.lw.fx.util.MessageType;
|
import com.lw.fx.util.MessageType;
|
||||||
|
import com.lw.fx.websocket.SSLWebSocketClient;
|
||||||
import com.lw.ui.request.api.system.AuthFeign;
|
import com.lw.ui.request.api.system.AuthFeign;
|
||||||
import com.lw.ui.request.api.system.NotifyMessageFeign;
|
import com.lw.ui.request.api.system.NotifyMessageFeign;
|
||||||
import de.saxsys.mvvmfx.MvvmFX;
|
import de.saxsys.mvvmfx.MvvmFX;
|
||||||
@ -62,7 +63,7 @@ public class MainViewModel implements ViewModel, SceneLifecycle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loginOut() {
|
public void loginOut(boolean exit) {
|
||||||
ProcessChain.create()
|
ProcessChain.create()
|
||||||
.addSupplierInExecutor(() -> {
|
.addSupplierInExecutor(() -> {
|
||||||
return Request.connector(AuthFeign.class).logout();
|
return Request.connector(AuthFeign.class).logout();
|
||||||
@ -70,8 +71,14 @@ public class MainViewModel implements ViewModel, SceneLifecycle {
|
|||||||
.addConsumerInPlatformThread(r -> {
|
.addConsumerInPlatformThread(r -> {
|
||||||
|
|
||||||
if (r.isSuccess()) {
|
if (r.isSuccess()) {
|
||||||
MvvmFX.getNotificationCenter().publish("showLoginRegister");
|
SSLWebSocketClient.getInstance().loginOut();
|
||||||
MvvmFX.getNotificationCenter().publish("message", "退出成功!", MessageType.SUCCESS);
|
if (exit) {
|
||||||
|
System.exit(0);
|
||||||
|
} else {
|
||||||
|
MvvmFX.getNotificationCenter().publish("showLoginRegister");
|
||||||
|
MvvmFX.getNotificationCenter().publish("message", "退出成功!", MessageType.SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.onException(e -> {
|
.onException(e -> {
|
||||||
@ -87,6 +94,7 @@ public class MainViewModel implements ViewModel, SceneLifecycle {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onViewRemoved() {
|
public void onViewRemoved() {
|
||||||
|
|
||||||
System.err.println("------remove");
|
System.err.println("------remove");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ public class MainFrame extends JFrame {
|
|||||||
public void windowClosed(WindowEvent e) {
|
public void windowClosed(WindowEvent e) {
|
||||||
super.windowClosed(e);
|
super.windowClosed(e);
|
||||||
loginOut(true);
|
loginOut(true);
|
||||||
System.exit(0);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user