Fangjie Hu 8 years ago
parent
commit
f14b954bfe
  1. 5
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  2. 12
      designer_base/src/com/fr/design/extra/QQLoginWebPane.java

5
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -27,6 +27,8 @@ public class LoginWebBridge {
private static final long CHECK_MESSAGE_TIME = 30 * 1000L; private static final long CHECK_MESSAGE_TIME = 30 * 1000L;
//数据查询正常的标志 ok //数据查询正常的标志 ok
private static final String SUCCESS_MESSAGE_STATUS = "ok"; private static final String SUCCESS_MESSAGE_STATUS = "ok";
//数据通讯失败
private static final String FAILED_MESSAGE_STATUS = "error";
//消息条数 //消息条数
private int messageCount; private int messageCount;
@ -125,10 +127,13 @@ public class LoginWebBridge {
if(getMessage.isServerAlive()){ if(getMessage.isServerAlive()){
try { try {
String res = getMessage.getResponseText(); String res = getMessage.getResponseText();
if (res.equals(FAILED_MESSAGE_STATUS)) {
}else {
JSONObject jo = new JSONObject(res); JSONObject jo = new JSONObject(res);
if (jo.getString("status").equals(SUCCESS_MESSAGE_STATUS)) { if (jo.getString("status").equals(SUCCESS_MESSAGE_STATUS)) {
setMessageCount(Integer.parseInt(jo.getString("message"))); setMessageCount(Integer.parseInt(jo.getString("message")));
} }
}
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().info(e.getMessage()); FRContext.getLogger().info(e.getMessage());
} }

12
designer_base/src/com/fr/design/extra/QQLoginWebPane.java

@ -104,12 +104,17 @@ public class QQLoginWebPane extends JFXPanel {
showAlert(event.getData()); showAlert(event.getData());
} }
}); });
webEngine.getLoadWorker().stateProperty().addListener((ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) -> { webEngine.getLoadWorker().stateProperty().addListener(
if (newValue == Worker.State.SUCCEEDED) { new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
window = (JSObject) webEngine.executeScript("window"); window = (JSObject) webEngine.executeScript("window");
window.setMember("QQLoginHelper", QQLoginWebBridge.getHelper(webEngine)); window.setMember("QQLoginHelper", QQLoginWebBridge.getHelper(webEngine));
} }
}); }
}
);
webView.setContextMenuEnabled(false);//屏蔽右键 webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView); root.setCenter(webView);
} }
@ -151,7 +156,6 @@ public class QQLoginWebPane extends JFXPanel {
dialog.setHeight(DEFAULT_CONFIRM_HEIGHT); dialog.setHeight(DEFAULT_CONFIRM_HEIGHT);
dialog.setWidth(DEFAULT_CONFIRM_WIDTH); dialog.setWidth(DEFAULT_CONFIRM_WIDTH);
dialog.setIconified(false); dialog.setIconified(false);
dialog.setAlwaysOnTop(true);
dialog.initOwner(parent); dialog.initOwner(parent);
dialog.initModality(Modality.WINDOW_MODAL); dialog.initModality(Modality.WINDOW_MODAL);
dialog.setScene( dialog.setScene(

Loading…
Cancel
Save