From 78e558b31ca6a1b1de68701ddcc9fcd2ad58309e Mon Sep 17 00:00:00 2001 From: my-style <2647778488@qq.com> Date: Tue, 7 Apr 2020 23:39:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=B4=E5=83=8F=E5=BC=B9=E7=AA=97=E5=A4=84?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=92=8C=E5=AF=BC=E5=87=BA=E5=AF=86=E9=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ndn/pid/pib.db | Bin 40960 -> 40960 bytes ndn/settings.properties | 4 +- .../view/mine/HeadPhotoAboutMeController.java | 81 ++++++++++++++++-- src/main/resources/fxml/login/Login.css | 63 +++++++++++--- .../fxml/mine/HeadPhotoAboutMeOverview.fxml | 6 +- 5 files changed, 135 insertions(+), 19 deletions(-) diff --git a/ndn/pid/pib.db b/ndn/pid/pib.db index dce6e54cb9e88651cbe6cadac630abbb73260f5c..e96a1301c7e0b0e0a5b8a056476498757a620533 100644 GIT binary patch delta 19 bcmZoTz|?SnX@WH4hKVxHj2kv4ESL`fOBV;y delta 19 bcmZoTz|?SnX@WH4iitALj4L)KESL`fN}mV9 diff --git a/ndn/settings.properties b/ndn/settings.properties index 85e14ab..e4bcf80 100644 --- a/ndn/settings.properties +++ b/ndn/settings.properties @@ -1,5 +1,5 @@ #\u4FEE\u6539\u914D\u7F6E\u6587\u4EF6 -#Tue Apr 07 15:45:02 CST 2020 +#Tue Apr 07 23:38:53 CST 2020 KeyName=/testKey_v3 loginUserName=466D1203678EFB16BE85C8A02E1486B6 ndnBlockChainIPAddress=116.77.74.139 @@ -7,6 +7,6 @@ ServerIPAddress=116.77.74.139 ThreadNumberForFileTransfer=5 ndnBlockChainPortAddress=9001 DataPackagePrefix=/ndn/edu/pkusz/OA -LoginStatus=true +LoginStatus=false loginPassWord=A1B9652D9ED940B8FC63453C50CB3337 ServerPortAddress=6363 diff --git a/src/main/java/cn/minoa/view/mine/HeadPhotoAboutMeController.java b/src/main/java/cn/minoa/view/mine/HeadPhotoAboutMeController.java index 739fd19..b66bb6b 100644 --- a/src/main/java/cn/minoa/view/mine/HeadPhotoAboutMeController.java +++ b/src/main/java/cn/minoa/view/mine/HeadPhotoAboutMeController.java @@ -1,12 +1,20 @@ package cn.minoa.view.mine; import cn.minoa.MainApp; +import cn.minoa.dataRequestInterface.MinoaDataAPI; +import cn.minoa.util.SecretKeyManageUtil; +import cn.minoa.view.login.KeepLoginStatus; import javafx.fxml.FXML; +import javafx.scene.control.Alert; +import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.text.Text; +import javafx.stage.DirectoryChooser; import javafx.stage.Stage; +import java.io.File; + public class HeadPhotoAboutMeController { private MainApp mainApp; @SuppressWarnings("unused") @@ -18,17 +26,19 @@ public class HeadPhotoAboutMeController { @FXML private Text phoneText; @FXML + private Button exitButton; + @FXML private ImageView headPhoto; - + public HeadPhotoAboutMeController() { // TODO Auto-generated constructor stub } - + @FXML private void initialize() { //在fxml被载入时候被自动调用 } - + /* * @param mainApp */ @@ -39,16 +49,77 @@ public class HeadPhotoAboutMeController { phoneText.setText(mainApp.loginer.getPhone()); showHeadPhoto(); } - + /* * @param dialogStage */ public void setDialogStage(Stage dialogStage) { this.dialogStage = dialogStage; } - + //设置头像 private void showHeadPhoto() { this.headPhoto.setImage(new Image("file:resources/images/headPhotos/"+mainApp.loginer.getUserName()+".png")); } + + // 退出登录 + @FXML + private void exitLogin(){ + // 修改内存中登录状态 + mainApp.isNeedKnowLoginStatus=false; + // 首先,修改本地登录状态 + KeepLoginStatus.setLoginStatus(false); + // 然后,关闭当前dialog + this.dialogStage.close(); + // 最后,展示登录界面 + mainApp.showLoginOverview(); + } + + // 导出证书 + @FXML + private void exportSafeBag(){ + // 选择要导出到的文件夹 + String localDirString = "."; + DirectoryChooser directoryChooser = new DirectoryChooser(); + directoryChooser.setTitle("选择要导出到的本地文件夹"); + Stage selectFileStage = new Stage(); + File file = directoryChooser.showDialog(selectFileStage); + if (file != null) { + // 文件不为空,且是一个文件夹 + if (file.isDirectory()) { + localDirString = file.getPath() + "\\"; + System.out.println("选中的本地保存文件夹为:" + localDirString); + } else { +// 弹窗参考:https://code.makery.ch/blog/javafx-dialogs-official/ + Alert alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("选中类型错误"); + alert.setHeaderText("你的选中类型错误"); + alert.setContentText("请确保你选中的是一个文件夹而不是一个文件。"); + alert.showAndWait(); + return; + } + }else{ + return ; + } + // 导出密钥到指定目录下的文件 + String keyfilename=MinoaDataAPI.keyChainNameString.substring(1,MinoaDataAPI.keyChainNameString.length()) + +"_"+MainApp.KeyFileNameString; + boolean res=SecretKeyManageUtil.exportSafeBag(localDirString+ + keyfilename); + if(res){ + // 弹窗参考:https://code.makery.ch/blog/javafx-dialogs-official/ + Alert alert = new Alert(Alert.AlertType.INFORMATION); + alert.setTitle("密钥导出成功"); + alert.setHeaderText("密钥导出成功"); + alert.setContentText("你已成功导出密钥"); + alert.showAndWait(); + }else{ + // 弹窗参考:https://code.makery.ch/blog/javafx-dialogs-official/ + Alert alert = new Alert(Alert.AlertType.WARNING); + alert.setTitle("密钥导出失败"); + alert.setHeaderText("密钥导出失败"); + alert.setContentText("由于系统未知原因,密钥导出时出现了问题。"); + alert.showAndWait(); + } + } } diff --git a/src/main/resources/fxml/login/Login.css b/src/main/resources/fxml/login/Login.css index 8ab1791..27158fe 100644 --- a/src/main/resources/fxml/login/Login.css +++ b/src/main/resources/fxml/login/Login.css @@ -4,7 +4,7 @@ * http://pixelduke.wordpress.com/2012/10/23/jmetro-windows-8-controls-on-java/ */ .button { - -fx-padding: 5 22 5 22; + -fx-padding: 5 22 5 22; -fx-border-color: #FFFFFF; -fx-border-width: 2; -fx-background-radius: 0; @@ -20,8 +20,8 @@ } .button:pressed, .button:default:hover:pressed { - -fx-background-color: white; - -fx-text-fill: #08BEFD; + -fx-background-color: white; + -fx-text-fill: #08BEFD; } .button:focused { @@ -51,7 +51,7 @@ * 注册账号及找回密码的Button */ #registerButton { - -fx-padding: 1 24 1 24; + -fx-padding: 1 24 1 24; -fx-border-color: #FFFFFF; -fx-border-width: 2; -fx-background-radius: 0; @@ -60,9 +60,9 @@ -fx-font-size: 12pt; -fx-text-fill: #FFFFFF; -fx-background-insets: 0 0 0 0, 0, 1, 2; -} +} #refindButton { - -fx-padding: 1 24 1 24; + -fx-padding: 1 24 1 24; -fx-border-color: #FFFFFF; -fx-border-width: 2; -fx-background-radius: 0; @@ -71,12 +71,55 @@ -fx-font-size: 12pt; -fx-text-fill: #FFFFFF; -fx-background-insets: 0 0 0 0, 0, 1, 2; -} - - +} + +#exitButton { + -fx-padding: 5 22 5 22; + -fx-border-color: #FFFFFF; + -fx-border-width: 2; + -fx-background-radius: 0; + -fx-background-color: #C75450; + -fx-font-family: "Segoe UI", Helvetica, Arial, sans-serif; + -fx-font-size: 12pt; + -fx-text-fill: #FFFFFF; + -fx-background-insets: 0 0 0 0, 0, 1, 2; +} + +#exitButton:hover { + -fx-background-color: #C377FE; +} + +#exitButton:pressed, .button:default:hover:pressed { + -fx-background-color: white; + -fx-text-fill: #08BEFD; +} + +#exitButton:focused { + -fx-border-color: white, white; + -fx-border-width: 1, 1; + -fx-border-style: solid, segments(1, 1); + -fx-border-radius: 0, 0; + -fx-border-insets: 1 1 1 1, 0; +} + +#exitButton:disabled, .button:default:disabled { + -fx-opacity: 0.4; + -fx-background-color: #08BEFD; + -fx-text-fill: white; +} + +#exitButton:default { + -fx-background-color: -fx-focus-color; + -fx-text-fill: #ffffff; +} + +#exitButton:default:hover { + -fx-background-color: derive(-fx-focus-color,30%); +} + /* * 针对区域设置不同的颜色 */ #upSplite{ - -fx-background-color: #586AFF; + -fx-background-color: #586AFF; } diff --git a/src/main/resources/fxml/mine/HeadPhotoAboutMeOverview.fxml b/src/main/resources/fxml/mine/HeadPhotoAboutMeOverview.fxml index 5788c58..e12afd3 100644 --- a/src/main/resources/fxml/mine/HeadPhotoAboutMeOverview.fxml +++ b/src/main/resources/fxml/mine/HeadPhotoAboutMeOverview.fxml @@ -9,7 +9,7 @@ - + @@ -30,6 +30,8 @@ - + +