Browse Source

Merge pull request #316 in BA/design from ~LEE/design:dev to dev

* commit 'f2b273c1b6e84fd83ae4052f4f1159a8f7a9ecd4':
  改一下写法,添加一些返回值为error的判断处理
master
superman 8 years ago
parent
commit
7edde71755
  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;
//数据查询正常的标志 ok
private static final String SUCCESS_MESSAGE_STATUS = "ok";
//数据通讯失败
private static final String FAILED_MESSAGE_STATUS = "error";
//消息条数
private int messageCount;
@ -125,10 +127,13 @@ public class LoginWebBridge {
if(getMessage.isServerAlive()){
try {
String res = getMessage.getResponseText();
if (res.equals(FAILED_MESSAGE_STATUS)) {
}else {
JSONObject jo = new JSONObject(res);
if (jo.getString("status").equals(SUCCESS_MESSAGE_STATUS)) {
setMessageCount(Integer.parseInt(jo.getString("message")));
}
}
} catch (Exception e) {
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());
}
});
webEngine.getLoadWorker().stateProperty().addListener((ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) -> {
if (newValue == Worker.State.SUCCEEDED) {
webEngine.getLoadWorker().stateProperty().addListener(
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.setMember("QQLoginHelper", QQLoginWebBridge.getHelper(webEngine));
}
});
}
}
);
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}
@ -151,7 +156,6 @@ public class QQLoginWebPane extends JFXPanel {
dialog.setHeight(DEFAULT_CONFIRM_HEIGHT);
dialog.setWidth(DEFAULT_CONFIRM_WIDTH);
dialog.setIconified(false);
dialog.setAlwaysOnTop(true);
dialog.initOwner(parent);
dialog.initModality(Modality.WINDOW_MODAL);
dialog.setScene(

Loading…
Cancel
Save