From 1e7c7d2afbcc15b5b10e21b3e8b00c5d98348a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Thu, 18 Aug 2016 18:12:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=86=85=E8=AE=BA?= =?UTF-8?q?=E5=9D=9B=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/LoginPane.java | 2 +- .../src/com/fr/design/extra/LoginWebBridge.java | 14 ++++++++------ .../src/com/fr/design/extra/QQLoginWebBridge.java | 8 +++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/LoginPane.java b/designer_base/src/com/fr/design/extra/LoginPane.java index 206696192..f49088af2 100644 --- a/designer_base/src/com/fr/design/extra/LoginPane.java +++ b/designer_base/src/com/fr/design/extra/LoginPane.java @@ -16,7 +16,7 @@ public class LoginPane extends BasicPane { public LoginPane() { setLayout(new BorderLayout()); - if (System.getProperty("java.version").startsWith("1.8")) { + if (StableUtils.getMajorJavaVersion() == 8) { String installHome; if (StableUtils.isDebug()) { URL url = ClassLoader.getSystemResource(""); diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index 34a906a36..4f1811431 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java @@ -25,6 +25,10 @@ import java.net.URLEncoder; public class LoginWebBridge { private static final String LOGIN_SUCCESS_FLAG = "http://bbs.finereport.com"; + private static final String LOGININ = "0"; + private static final String LOGIN_INFO_EMPTY = "-1"; + private static final String DISCONNECTED = "-2"; + private static final String UNKNOWN_ERROR = "-3"; private static final int TIME_OUT = 10000; private static com.fr.design.extra.LoginWebBridge helper; @@ -102,19 +106,17 @@ public class LoginWebBridge { */ public String defaultLogin(String username, String password) { if (!StringUtils.isNotBlank(username) && !StringUtils.isNotBlank(password)) { - //用户名密码为空 - return "-1"; + return LOGIN_INFO_EMPTY; } if (!testConnection()) { - //网络测试连接不通过 - return "-2"; + return DISCONNECTED; } if (login(username, password)) { updateUserInfo(username, password); loginSuccess(username); - return "0"; + return LOGININ; }else { - return "-3"; + return UNKNOWN_ERROR; } } diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java index bc76cef1c..a038d56ce 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java @@ -1,6 +1,5 @@ package com.fr.design.extra; -import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; @@ -17,6 +16,7 @@ public class QQLoginWebBridge { private static com.fr.design.extra.QQLoginWebBridge helper; private WebEngine webEngine; private static String LOGINSUCCESS = "ok"; + private static String LOGINFAILED = "failed"; private UIDialog uiDialog; private UILabel uiLabel; private UIDialog qqDialog; @@ -95,9 +95,11 @@ public class QQLoginWebBridge { String username = jo.get("username").toString(); closeQQWindow(); closeParentWindow(); - //设置label的用户名 uiLabel.setText(username); - }else { + DesignerEnvManager.getEnvManager().setBBSName(username); + }else if (status.equals(LOGINFAILED)){ + //账号没有QQ授权 + closeQQWindow(); } } }