头像弹窗处增加了退出登录和导出密钥

This commit is contained in:
my-style committed 2020-04-07 23:39:51 +08:00
1 parent 7c47a5966b
commit 78e558b31c
5 files changed
+135 -19

No files matched your search

BIN
View File
Binary file not shown.
+2 -2
View File
@@ -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
@@ -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();
}
}
}
+53 -10
View File
@@ -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;
}
@@ -9,7 +9,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane prefHeight="225.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.minoa.view.mine.HeadPhotoAboutMeController">
<AnchorPane prefHeight="225.0" prefWidth="300.0" stylesheets="@../login/Login.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.minoa.view.mine.HeadPhotoAboutMeController">
<children>
<VBox spacing="25.0" AnchorPane.leftAnchor="15.0" AnchorPane.topAnchor="35.0">
<children>
@@ -30,6 +30,8 @@
<Image url="@../../../../../resources/images/ic_launcher-web.png" />
</image>
</ImageView>
<Line endX="100.0" layoutX="129.0" layoutY="169.0" opacity="0.8" startX="-100.0" stroke="#000000d5" AnchorPane.bottomAnchor="55.0" AnchorPane.leftAnchor="50.0" />
<Line endX="100.0" layoutX="129.0" layoutY="169.0" opacity="0.0" startX="-100.0" stroke="#000000d5" AnchorPane.bottomAnchor="55.0" AnchorPane.leftAnchor="50.0" />
<Button fx:id="exitButton" layoutX="123.0" layoutY="159.0" mnemonicParsing="false" onAction="#exitLogin" text="退出登录" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="20.0" />
<Button layoutX="158.0" layoutY="162.0" mnemonicParsing="false" onAction="#exportSafeBag" text="导出密钥" AnchorPane.bottomAnchor="30.0" AnchorPane.rightAnchor="20.0" />
</children>
</AnchorPane>