Merge in DESIGN/design from ~LANLAN/design:feature/10.0 to feature/10.0 * commit 'd727b8f4244e224311d00fb709b8ae46bb6bedc1': REPORT-51360 设计器通行证和finedb里的区分开,对不支持jxbrowser的系统做兼容处理 REPORT-51360 新增模板商城toast提示 兼容处理 REPORT-51360 【10.0.17】设计器用户登录策略调整feature/10.0
@ -1,54 +1,43 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.login.AbstractDesignerSSO; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
|
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
public class BBSAction extends AbstractDesignerSSO { |
||||
|
||||
public class BBSAction extends UpdateAction |
||||
{ |
||||
|
||||
public BBSAction() { |
||||
this.setMenuKeySet(BBS); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/bbs"); |
||||
|
||||
public BBSAction() |
||||
{ |
||||
this.setMenuKeySet(BBS); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/bbs"); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param arg0 事件 |
||||
*/ |
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("bbs"); |
||||
BrowseUtils.browser(url); |
||||
public String getJumpUrl() { |
||||
return CloudCenter.getInstance().acquireUrlByKind("bbs"); |
||||
} |
||||
public static final MenuKeySet BBS = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'B'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Bbs"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
public static final MenuKeySet BBS = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'B'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Bbs"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
} |
||||
|
@ -1,50 +1,42 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.login.AbstractDesignerSSO; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
public class BugAction extends AbstractDesignerSSO { |
||||
|
||||
public class BugAction extends UpdateAction |
||||
{ |
||||
public BugAction() { |
||||
this.setMenuKeySet(BUG); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/bug"); |
||||
} |
||||
|
||||
public BugAction() |
||||
{ this.setMenuKeySet(BUG); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/bug"); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.bugs"); |
||||
BrowseUtils.browser(url); |
||||
@Override |
||||
public String getJumpUrl() { |
||||
return CloudCenter.getInstance().acquireUrlByKind("bbs.bugs"); |
||||
} |
||||
|
||||
} |
||||
public static final MenuKeySet BUG = new MenuKeySet() { |
||||
public static final MenuKeySet BUG = new MenuKeySet() { |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Bug"); |
||||
} |
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Bug"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public char getMnemonic() |
||||
{ |
||||
@Override |
||||
public char getMnemonic() { |
||||
|
||||
return 'U'; |
||||
} |
||||
}; |
||||
return 'U'; |
||||
} |
||||
}; |
||||
|
||||
} |
||||
|
@ -1,49 +1,41 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.login.AbstractDesignerSSO; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
public class NeedAction extends UpdateAction |
||||
{ |
||||
|
||||
public NeedAction() |
||||
{ |
||||
this.setMenuKeySet(NEED); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/need"); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.needs"); |
||||
BrowseUtils.browser(url); |
||||
|
||||
} |
||||
public static final MenuKeySet NEED = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'N'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Commuinity_Need"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
public class NeedAction extends AbstractDesignerSSO { |
||||
|
||||
public NeedAction() { |
||||
this.setMenuKeySet(NEED); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/need"); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String getJumpUrl() { |
||||
return CloudCenter.getInstance().acquireUrlByKind("bbs.needs"); |
||||
} |
||||
|
||||
public static final MenuKeySet NEED = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'N'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Commuinity_Need"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
} |
||||
|
@ -1,49 +1,41 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.login.AbstractDesignerSSO; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
|
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
public class SignAction extends UpdateAction |
||||
{ |
||||
|
||||
public SignAction() |
||||
{ |
||||
this.setMenuKeySet(SIGN); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/sign"); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.aut"); |
||||
BrowseUtils.browser(url); |
||||
|
||||
} |
||||
public static final MenuKeySet SIGN = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'S'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_sign"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
public class SignAction extends AbstractDesignerSSO { |
||||
|
||||
public SignAction() { |
||||
this.setMenuKeySet(SIGN); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/sign"); |
||||
} |
||||
|
||||
@Override |
||||
public String getJumpUrl() { |
||||
return CloudCenter.getInstance().acquireUrlByKind("bbs.aut"); |
||||
} |
||||
|
||||
public static final MenuKeySet SIGN = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'S'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_sign"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
} |
||||
|
@ -1,69 +1,41 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.login.AbstractDesignerSSO; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.KeyStroke; |
||||
import java.awt.Desktop; |
||||
import java.awt.event.ActionEvent; |
||||
import java.io.IOException; |
||||
import java.net.URI; |
||||
import java.net.URISyntaxException; |
||||
|
||||
public class UpAction extends UpdateAction |
||||
{ |
||||
public class UpAction extends AbstractDesignerSSO { |
||||
|
||||
public UpAction() |
||||
{ |
||||
this.setMenuKeySet(UPDATE); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update.png")); |
||||
|
||||
} |
||||
public UpAction() { |
||||
this.setMenuKeySet(UPDATE); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.update"); |
||||
if (StringUtils.isEmpty(url)) { |
||||
FineLoggerFactory.getLogger().info("The URL is empty!"); |
||||
return; |
||||
} |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(url)); |
||||
} catch (IOException exp) { |
||||
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); |
||||
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); |
||||
} catch (URISyntaxException exp) { |
||||
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); |
||||
} catch (Exception exp) { |
||||
FineLoggerFactory.getLogger().error(exp.getMessage(), exp); |
||||
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url); |
||||
} |
||||
|
||||
public String getJumpUrl() { |
||||
return CloudCenter.getInstance().acquireUrlByKind("bbs.update"); |
||||
} |
||||
public static final MenuKeySet UPDATE = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'U'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Update"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
public static final MenuKeySet UPDATE = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'U'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Update"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
} |
||||
|
@ -1,49 +1,43 @@
|
||||
package com.fr.design.actions.community; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.locale.impl.VideoMark; |
||||
import com.fr.design.login.AbstractDesignerSSO; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.locale.LocaleCenter; |
||||
import com.fr.general.locale.LocaleMark; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
public class VideoAction extends AbstractDesignerSSO { |
||||
|
||||
public class VideoAction extends UpdateAction |
||||
{ |
||||
|
||||
public VideoAction() |
||||
{ |
||||
this.setMenuKeySet(VIDEO); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/video"); |
||||
} |
||||
public VideoAction() { |
||||
this.setMenuKeySet(VIDEO); |
||||
this.setName(getMenuKeySet().getMenuName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon("/com/fr/design/images/bbs/video"); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent arg0) |
||||
{ |
||||
public String getJumpUrl() { |
||||
LocaleMark<String> localeMark = LocaleCenter.getMark(VideoMark.class); |
||||
BrowseUtils.browser(localeMark.getValue()); |
||||
return localeMark.getValue(); |
||||
} |
||||
public static final MenuKeySet VIDEO = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'V'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Video"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
public static final MenuKeySet VIDEO = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'V'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Video"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
} |
||||
|
@ -1,8 +1,10 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
import com.fr.design.login.DesignerLoginSource; |
||||
|
||||
/** |
||||
* Created by lp on 2016/8/16. |
||||
*/ |
||||
public interface LoginContextListener { |
||||
void showLoginContext(); |
||||
void showLoginContext(DesignerLoginSource source); |
||||
} |
||||
|
@ -0,0 +1,92 @@
|
||||
package com.fr.design.login; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.os.impl.SupportOSImpl; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.log.MessageFormatter; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.third.org.bouncycastle.util.encoders.Hex; |
||||
import java.awt.event.ActionEvent; |
||||
import java.security.SecureRandom; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
import javax.crypto.Cipher; |
||||
import javax.crypto.spec.IvParameterSpec; |
||||
import javax.crypto.spec.SecretKeySpec; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/6/7 |
||||
*/ |
||||
public abstract class AbstractDesignerSSO extends UpdateAction { |
||||
|
||||
private static final String PRODUCT_FINEREPORT = "product-finereport"; |
||||
|
||||
private static final String KEY = "i7hP48WAcuTrmxfN"; |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent event) { |
||||
String url = getJumpUrl(); |
||||
if (!SupportOSImpl.DESIGNER_LOGIN.support()) { |
||||
BrowseUtils.browser(url); |
||||
return; |
||||
} |
||||
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); |
||||
int uid = manager.getDesignerLoginUid(); |
||||
if (uid > 0) { |
||||
String ssoUrl = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}"); |
||||
try { |
||||
String code = generateLoginCode(); |
||||
MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(ssoUrl, new String[]{code, url}); |
||||
BrowseUtils.browser(tuple.getMessage()); |
||||
} catch (Exception e) { |
||||
BrowseUtils.browser(url); |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} else { |
||||
boolean loginRemindBeforeJumpBBS = manager.isLoginRemindBeforeJumpBBS(); |
||||
if (loginRemindBeforeJumpBBS) { |
||||
Map<String, String> params = new HashMap<>(); |
||||
params.put("bbsJumpUrl", url); |
||||
DesignerLoginHelper.showLoginDialog(DesignerLoginSource.BBS_JUMP, params); |
||||
manager.setLoginRemindBeforeJumpBBS(false); |
||||
} else { |
||||
BrowseUtils.browser(url); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private String generateLoginCode() throws Exception { |
||||
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); |
||||
JSONObject jo = JSONObject.create(); |
||||
jo.put("uid", manager.getDesignerLoginUid()); |
||||
jo.put("username", manager.getDesignerLoginUsername()); |
||||
jo.put("source", PRODUCT_FINEREPORT); |
||||
byte[] iv = randomIv(); |
||||
return new String(Hex.encode(iv)) + encrypt(jo.toString(), KEY.getBytes(), iv); |
||||
} |
||||
|
||||
private static byte[] randomIv() { |
||||
byte[] salt = new byte[16]; |
||||
SecureRandom secureRandom = new SecureRandom(); |
||||
secureRandom.setSeed(System.currentTimeMillis()); |
||||
secureRandom.nextBytes(salt); |
||||
return salt; |
||||
} |
||||
|
||||
public static String encrypt(String content, byte[] key, byte[] iv) throws Exception { |
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES"); |
||||
Cipher cipher = Cipher.getInstance("AES/CTR/PKCS5Padding"); |
||||
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); |
||||
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec); |
||||
byte[] resultBytes = cipher.doFinal(content.getBytes()); |
||||
return new String(Hex.encode(resultBytes)); |
||||
} |
||||
|
||||
public abstract String getJumpUrl(); |
||||
} |
@ -0,0 +1,280 @@
|
||||
package com.fr.design.login; |
||||
|
||||
import com.fr.design.bridge.exec.JSBridge; |
||||
import com.fr.design.bridge.exec.JSCallback; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.gui.ilable.ActionLabel; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.locale.impl.BbsResetMark; |
||||
import com.fr.design.login.executor.DesignerLoginBrowserExecutor; |
||||
import com.fr.design.login.executor.DesignerLoginExecutor; |
||||
import com.fr.design.login.executor.DesignerSendCaptchaExecutor; |
||||
import com.fr.design.login.executor.DesignerSmsLoginExecutor; |
||||
import com.fr.design.login.executor.DesignerSmsRegisterExecutor; |
||||
import com.fr.design.login.task.DesignerLoginTaskWorker; |
||||
import com.fr.design.mainframe.toast.DesignerToastMsgUtil; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.locale.LocaleCenter; |
||||
import com.fr.general.locale.LocaleMark; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.teamdev.jxbrowser.chromium.Browser; |
||||
import com.teamdev.jxbrowser.chromium.JSFunction; |
||||
import com.teamdev.jxbrowser.chromium.JSObject; |
||||
import java.awt.Desktop; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.net.URI; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingUtilities; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerLoginBridge { |
||||
|
||||
private Map<String, String> params; |
||||
|
||||
public static DesignerLoginBridge getBridge(Browser browser, Map<String, String> params) { |
||||
return new DesignerLoginBridge(browser, params); |
||||
} |
||||
|
||||
private JSObject window; |
||||
|
||||
private DesignerLoginBridge(Browser browser, Map<String, String> params) { |
||||
this.params = params; |
||||
this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); |
||||
Set<Map.Entry<String, String>> entries = params.entrySet(); |
||||
for (Map.Entry<String, String> entry : entries) { |
||||
this.window.setProperty(entry.getKey(), entry.getValue()); |
||||
} |
||||
} |
||||
|
||||
@JSBridge |
||||
public String i18nText(String key) { |
||||
return Toolkit.i18nText(key); |
||||
} |
||||
|
||||
@JSBridge |
||||
public void closeWindow(boolean loginSuccess) { |
||||
DesignerLoginSource source = DesignerLoginSource.valueOf(Integer.parseInt(params.get("designerLoginSource"))); |
||||
if (loginSuccess) { |
||||
if (source == DesignerLoginSource.GUIDE) { |
||||
DesignerToastMsgUtil.toastPrompt( |
||||
getHyperlinkPane( |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Guide_Login_Success_Title"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Guide_Login_Success_Hyperlink_Text"), |
||||
CloudCenter.getInstance().acquireUrlByKind("designer.premium.template", "https://market.fanruan.com/template") |
||||
) |
||||
); |
||||
} else if (source == DesignerLoginSource.BBS_JUMP) { |
||||
String bbsJumpUrl = params.get("bbsJumpUrl"); |
||||
BrowseUtils.browser(bbsJumpUrl); |
||||
} |
||||
DesignerLoginHelper.closeWindow(); |
||||
return; |
||||
} |
||||
if (source == DesignerLoginSource.SWITCH_ACCOUNT) { |
||||
DesignerLoginHelper.closeWindow(); |
||||
return; |
||||
} |
||||
if (source == DesignerLoginSource.BBS_JUMP) { |
||||
SwingUtilities.invokeLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
String bbsJumpUrl = params.get("bbsJumpUrl"); |
||||
String[] options = new String[]{ |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_BBS_Go_Directly"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Return_Login") |
||||
}; |
||||
int rv = FineJOptionPane.showConfirmDialog( |
||||
DesignerLoginHelper.getDialog(), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_BBS_Quit_Tip"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), |
||||
JOptionPane.OK_CANCEL_OPTION, |
||||
JOptionPane.WARNING_MESSAGE, |
||||
null, |
||||
options, |
||||
options[1] |
||||
); |
||||
if (rv == JOptionPane.YES_OPTION) { |
||||
BrowseUtils.browser(bbsJumpUrl); |
||||
DesignerLoginHelper.closeWindow(); |
||||
} |
||||
} |
||||
}); |
||||
} else { |
||||
SwingUtilities.invokeLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
String[] options = new String[]{ |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Quit"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Return_Login") |
||||
}; |
||||
int rv = FineJOptionPane.showConfirmDialog( |
||||
DesignerLoginHelper.getDialog(), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Quit_Tip"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), |
||||
JOptionPane.OK_CANCEL_OPTION, |
||||
JOptionPane.WARNING_MESSAGE, |
||||
null, |
||||
options, |
||||
options[1] |
||||
); |
||||
if (rv == JOptionPane.OK_OPTION) { |
||||
DesignerLoginHelper.closeWindow(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 服务条款 |
||||
*/ |
||||
@JSBridge |
||||
public void serviceHref() { |
||||
try { |
||||
String url = CloudCenter.getInstance().acquireUrlByKind("designer.bbs.service.terms", "https://bbs.fanruan.com/thread-102821-1-1.html"); |
||||
Desktop.getDesktop().browse(new URI(url)); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 忘记密码 |
||||
*/ |
||||
@JSBridge |
||||
public void forgetHref() { |
||||
try { |
||||
LocaleMark<String> resetMark = LocaleCenter.getMark(BbsResetMark.class); |
||||
Desktop.getDesktop().browse(new URI(resetMark.getValue())); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设计器端的用户登录 |
||||
* |
||||
* @param username 用户名 |
||||
* @param password 密码 |
||||
* @param callback 回调函数 |
||||
*/ |
||||
@JSBridge |
||||
public void normalLogin(String username, String password, final JSFunction callback) { |
||||
DesignerLoginTaskWorker<Void> worker = new DesignerLoginTaskWorker<>( |
||||
new JSCallback(DesignerLoginBrowserExecutor.create(window, callback)), |
||||
new DesignerLoginExecutor(username, password)); |
||||
worker.execute(); |
||||
} |
||||
|
||||
/** |
||||
* 发送短信验证码 |
||||
* |
||||
* @param regionCode 区号 |
||||
* @param phone 手机 |
||||
* @param callback 回调函数 |
||||
*/ |
||||
@JSBridge |
||||
public void sendCaptcha(String regionCode, String phone, final JSFunction callback) { |
||||
DesignerLoginTaskWorker<Void> worker = new DesignerLoginTaskWorker<>( |
||||
new JSCallback(DesignerLoginBrowserExecutor.create(window, callback)), |
||||
new DesignerSendCaptchaExecutor(regionCode, phone)); |
||||
worker.execute(); |
||||
} |
||||
|
||||
/** |
||||
* 设计器端的短信登录 |
||||
* |
||||
* @param regionCode 区号 |
||||
* @param phone 手机 |
||||
* @param code 验证码 |
||||
* @param callback 回调函数 |
||||
*/ |
||||
@JSBridge |
||||
public void smsLogin(String regionCode, String phone, String code, final JSFunction callback) { |
||||
DesignerLoginTaskWorker<Void> worker = new DesignerLoginTaskWorker<>( |
||||
new JSCallback(DesignerLoginBrowserExecutor.create(window, callback)), |
||||
new DesignerSmsLoginExecutor(regionCode, phone, code)); |
||||
worker.execute(); |
||||
} |
||||
|
||||
/** |
||||
* 设计器端的用户注册 |
||||
* |
||||
* @param regionCode 区号 |
||||
* @param phone 手机 |
||||
* @param password 密码 |
||||
* @param regToken 注册令牌 |
||||
* @param callback 回调函数 |
||||
*/ |
||||
@JSBridge |
||||
public void smsRegister(String regionCode, String phone, String password, String regToken, final JSFunction callback) { |
||||
DesignerLoginTaskWorker<Void> worker = new DesignerLoginTaskWorker<>( |
||||
new JSCallback(DesignerLoginBrowserExecutor.create(window, callback)), |
||||
new DesignerSmsRegisterExecutor(regionCode, phone, password, regToken)); |
||||
worker.execute(); |
||||
} |
||||
|
||||
/** |
||||
* 使用系统浏览器打开网页 |
||||
* |
||||
* @param url 要打开的网页 |
||||
*/ |
||||
@JSBridge |
||||
public void openShopUrlAtWebBrowser(String url) { |
||||
if (Desktop.isDesktopSupported()) { |
||||
try { |
||||
//创建一个URI实例,注意不是URL
|
||||
URI uri = URI.create(url); |
||||
//获取当前系统桌面扩展
|
||||
Desktop desktop = Desktop.getDesktop(); |
||||
//判断系统桌面是否支持要执行的功能
|
||||
if (desktop.isSupported(Desktop.Action.BROWSE)) { |
||||
//获取系统默认浏览器打开链接
|
||||
desktop.browse(uri); |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 调整面板大小 |
||||
* |
||||
* @param width 宽 |
||||
* @param height 高 |
||||
*/ |
||||
@JSBridge |
||||
public void resize(int width, int height) { |
||||
DesignerLoginHelper.getDialog().setSize(width, height); |
||||
} |
||||
|
||||
private JPanel getHyperlinkPane(String title, String hyperlinkText, String hyperlink) { |
||||
ActionLabel actionLabel = new ActionLabel(hyperlinkText); |
||||
actionLabel.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(hyperlink)); |
||||
} catch (Exception ignore) { |
||||
} |
||||
} |
||||
}); |
||||
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
panel.add(new UILabel(title)); |
||||
panel.add(actionLabel); |
||||
return panel; |
||||
} |
||||
} |
@ -0,0 +1,104 @@
|
||||
package com.fr.design.login; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.extra.WebViewDlgHelper; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.os.impl.SupportOSImpl; |
||||
import com.fr.design.update.ui.dialog.UpdateMainDialog; |
||||
import com.fr.general.GeneralContext; |
||||
import java.awt.Dialog; |
||||
import java.awt.Frame; |
||||
import java.awt.Window; |
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.WindowConstants; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerLoginHelper { |
||||
|
||||
private static final String MAIN_RESOURCE_PATH = "/com/fr/design/login/login.html"; |
||||
private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser"; |
||||
|
||||
private static UIDialog dialog = null; |
||||
|
||||
public static String getMainResourcePath() { |
||||
return MAIN_RESOURCE_PATH; |
||||
} |
||||
|
||||
public static UIDialog getDialog() { |
||||
return dialog; |
||||
} |
||||
|
||||
public static void showLoginDialog(DesignerLoginSource source) { |
||||
showLoginDialog(source, new HashMap<>()); |
||||
} |
||||
|
||||
public static void showLoginDialog(DesignerLoginSource source, Map<String, String> params) { |
||||
showLoginDialog(source, params, DesignerContext.getDesignerFrame()); |
||||
} |
||||
|
||||
public static void showLoginDialog(DesignerLoginSource source, Map<String, String> params, Window window) { |
||||
if (!SupportOSImpl.DESIGNER_LOGIN.support()) { |
||||
WebViewDlgHelper.createLoginDialog(window); |
||||
return; |
||||
} |
||||
boolean hasJxBrowser = true; |
||||
try { |
||||
Class.forName(JXBROWSER); |
||||
} catch (ClassNotFoundException e) { |
||||
hasJxBrowser = false; |
||||
} |
||||
if (hasJxBrowser) { |
||||
showLoginPane(source, params, window); |
||||
} else { |
||||
showUpdatePane(); |
||||
} |
||||
} |
||||
|
||||
private static void showLoginPane(DesignerLoginSource source, Map<String, String> params, Window window) { |
||||
DesignerLoginPane designerLoginPane = new DesignerLoginPane(source, params); |
||||
if (dialog == null) { |
||||
if (window instanceof Dialog) { |
||||
dialog = new DesignerLoginShowDialog((Dialog) window, designerLoginPane); |
||||
} else if (window instanceof Frame) { |
||||
dialog = new DesignerLoginShowDialog((Frame) window, designerLoginPane); |
||||
} else { |
||||
return; |
||||
} |
||||
|
||||
} |
||||
dialog.setVisible(true); |
||||
} |
||||
|
||||
|
||||
private static void showUpdatePane() { |
||||
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Login_Message")); |
||||
if (!GeneralContext.getLocale().equals(Locale.JAPANESE) && !GeneralContext.getLocale().equals(Locale.JAPAN) |
||||
&& !Locale.getDefault().equals(Locale.JAPAN) && !Locale.getDefault().equals(Locale.JAPANESE)) { |
||||
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); |
||||
dialog.setAutoUpdateAfterInit(); |
||||
dialog.showDialog(); |
||||
} |
||||
} |
||||
|
||||
public static void closeWindow() { |
||||
if (dialog != null) { |
||||
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
||||
dialog.setVisible(false); |
||||
dialog = null; |
||||
} |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
DesignerEnvManager.getEnvManager().setOpenDebug(true); |
||||
showLoginDialog(DesignerLoginSource.NORMAL); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.design.login; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.login.utils.DesignerLoginUtils; |
||||
import com.fr.design.ui.ModernUIPane; |
||||
import com.teamdev.jxbrowser.chromium.JSValue; |
||||
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; |
||||
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; |
||||
import java.awt.BorderLayout; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerLoginPane extends BasicPane { |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "DESIGNER_LOGIN"; |
||||
} |
||||
|
||||
public DesignerLoginPane(DesignerLoginSource source, Map<String, String> params) { |
||||
params.put("designerLoginSource", String.valueOf(source.getSource())); |
||||
params.put("lastLoginType", String.valueOf(DesignerEnvManager.getEnvManager().getLastLoginType().getType())); |
||||
params.put("lastLoginAccount", DesignerEnvManager.getEnvManager().getLastLoginAccount()); |
||||
setLayout(new BorderLayout()); |
||||
ModernUIPane<Object> modernUIPane = new ModernUIPane.Builder<>() |
||||
.prepare(new ScriptContextAdapter() { |
||||
@Override |
||||
public void onScriptContextCreated(ScriptContextEvent event) { |
||||
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); |
||||
window.asObject().setProperty("DesignerLoginHelper", DesignerLoginBridge.getBridge(event.getBrowser(), params)); |
||||
} |
||||
}) |
||||
.withEMB(DesignerLoginHelper.getMainResourcePath(), DesignerLoginUtils.renderMap()) |
||||
.build(); |
||||
add(modernUIPane, BorderLayout.CENTER); |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.design.login; |
||||
|
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dialog; |
||||
import java.awt.Dimension; |
||||
import java.awt.Frame; |
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerLoginShowDialog extends UIDialog { |
||||
|
||||
private static final Dimension DEFAULT = new Dimension(422, 478); |
||||
|
||||
public DesignerLoginShowDialog(Frame frame, Component pane) { |
||||
super(frame); |
||||
init(pane); |
||||
} |
||||
|
||||
public DesignerLoginShowDialog(Dialog dialog, Component pane) { |
||||
super(dialog); |
||||
init(pane); |
||||
} |
||||
|
||||
private void init(Component pane) { |
||||
setUndecorated(true); |
||||
JPanel panel = (JPanel) getContentPane(); |
||||
panel.setLayout(new BorderLayout()); |
||||
add(pane, BorderLayout.CENTER); |
||||
setSize(DEFAULT); |
||||
GUICoreUtils.centerWindow(this); |
||||
setResizable(false); |
||||
} |
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.login; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/6/7 |
||||
*/ |
||||
public enum DesignerLoginSource { |
||||
NORMAL(0), GUIDE(1), SWITCH_ACCOUNT(2), BBS_JUMP(3), UNKNOWN(-1); |
||||
|
||||
private int source; |
||||
|
||||
DesignerLoginSource(int source) { |
||||
this.source = source; |
||||
} |
||||
|
||||
public int getSource() { |
||||
return source; |
||||
} |
||||
|
||||
public static DesignerLoginSource valueOf(int source) { |
||||
for(DesignerLoginSource value : DesignerLoginSource.values()) { |
||||
if(value.getSource() == source) { |
||||
return value; |
||||
} |
||||
} |
||||
return UNKNOWN; |
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.login; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/6/4 |
||||
*/ |
||||
public enum DesignerLoginType { |
||||
NORMAL_LOGIN(0), SMS_LOGIN(1), UNKNOWN(-1); |
||||
|
||||
private int type; |
||||
|
||||
DesignerLoginType(int type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public int getType() { |
||||
return type; |
||||
} |
||||
|
||||
public static DesignerLoginType valueOf(int type) { |
||||
for(DesignerLoginType value : DesignerLoginType.values()) { |
||||
if(value.getType() == type) { |
||||
return value; |
||||
} |
||||
} |
||||
return UNKNOWN; |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.login.bean; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/6/3 |
||||
*/ |
||||
public class BBSAccountLogin { |
||||
|
||||
private int uid; |
||||
|
||||
private String username; |
||||
|
||||
private String appId; |
||||
|
||||
private String refreshToken; |
||||
|
||||
public int getUid() { |
||||
return uid; |
||||
} |
||||
|
||||
public void setUid(int uid) { |
||||
this.uid = uid; |
||||
} |
||||
|
||||
public String getUsername() { |
||||
return username; |
||||
} |
||||
|
||||
public void setUsername(String username) { |
||||
this.username = username; |
||||
} |
||||
|
||||
public String getAppId() { |
||||
return appId; |
||||
} |
||||
|
||||
public void setAppId(String appId) { |
||||
this.appId = appId; |
||||
} |
||||
|
||||
public String getRefreshToken() { |
||||
return refreshToken; |
||||
} |
||||
|
||||
public void setRefreshToken(String refreshToken) { |
||||
this.refreshToken = refreshToken; |
||||
} |
||||
} |
@ -0,0 +1,226 @@
|
||||
package com.fr.design.login.config; |
||||
|
||||
import com.fr.design.login.DesignerLoginType; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLReadable; |
||||
import com.fr.stable.xml.XMLWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/6/2 |
||||
*/ |
||||
public class DesignerLoginConfigManager implements XMLReadable, XMLWriter { |
||||
|
||||
public static final String XML_TAG = "DesignerLoginConfigManager"; |
||||
|
||||
private static DesignerLoginConfigManager singleton; |
||||
|
||||
/** |
||||
* bbs uid |
||||
*/ |
||||
private int uid = -1; |
||||
/** |
||||
* bbs 用户名 |
||||
*/ |
||||
private String username = StringUtils.EMPTY; |
||||
/** |
||||
* bbs 应用Id |
||||
*/ |
||||
private String appId = StringUtils.EMPTY; |
||||
/** |
||||
* bbs refreshToken |
||||
*/ |
||||
private String refreshToken = StringUtils.EMPTY; |
||||
/** |
||||
* 登录引导页一个月内不再提醒 |
||||
*/ |
||||
private boolean doNotRemind = false; |
||||
/** |
||||
* 登录引导页一个月内不再提醒 |
||||
*/ |
||||
private long doNotRemindSelectedTime = -1L; |
||||
/** |
||||
* 设计器激活时间 |
||||
*/ |
||||
private long designerActivatedTime = -1L; |
||||
/** |
||||
* bbs 上次登录时间 |
||||
*/ |
||||
private long lastLoginTime = -1L; |
||||
/** |
||||
* bbs 上次登录方式 |
||||
*/ |
||||
private DesignerLoginType lastLoginType = DesignerLoginType.UNKNOWN; |
||||
/** |
||||
* bbs 上次登录账号 |
||||
*/ |
||||
private String lastLoginAccount = StringUtils.EMPTY; |
||||
/** |
||||
* 当前版本第一次启动 |
||||
*/ |
||||
private boolean currentVersionFirstLaunch = true; |
||||
/** |
||||
* bbs跳转前的登录提醒 |
||||
*/ |
||||
private boolean loginRemindBeforeJumpBBS = true; |
||||
/** |
||||
* 插件管理第一次启动时的提醒 |
||||
*/ |
||||
private boolean pluginRemindOnFirstLaunch = true; |
||||
|
||||
private DesignerLoginConfigManager() { |
||||
|
||||
} |
||||
|
||||
public static DesignerLoginConfigManager getInstance() { |
||||
if (singleton == null) { |
||||
singleton = new DesignerLoginConfigManager(); |
||||
} |
||||
return singleton; |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader reader) { |
||||
if (reader.isAttr()) { |
||||
this.setUid(reader.getAttrAsInt("uid", -1)); |
||||
this.setUsername(reader.getAttrAsString("username", StringUtils.EMPTY)); |
||||
this.setAppId(reader.getAttrAsString("appId", StringUtils.EMPTY)); |
||||
this.setRefreshToken(reader.getAttrAsString("refreshToken", StringUtils.EMPTY)); |
||||
this.setDoNotRemind(reader.getAttrAsBoolean("doNotRemind", false)); |
||||
this.setDoNotRemindSelectedTime(reader.getAttrAsLong("doNotRemindSelectedTime", -1L)); |
||||
this.setDesignerActivatedTime(reader.getAttrAsLong("designerActivatedTime", -1L)); |
||||
this.setLastLoginTime(reader.getAttrAsLong("lastLoginTime", -1L)); |
||||
this.setCurrentVersionFirstLaunch(reader.getAttrAsBoolean("currentVersionFirstLaunch", true)); |
||||
this.setLastLoginType(DesignerLoginType.valueOf(reader.getAttrAsInt("lastLoginType", -1))); |
||||
this.setLastLoginAccount(reader.getAttrAsString("lastLoginAccount", StringUtils.EMPTY)); |
||||
this.setLoginRemindBeforeJumpBBS(reader.getAttrAsBoolean("loginRemindBeforeJumpBBS", true)); |
||||
this.setPluginRemindOnFirstLaunch(reader.getAttrAsBoolean("pluginRemindOnFirstLaunch", true)); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
writer.startTAG(XML_TAG); |
||||
writer.attr("uid", uid); |
||||
writer.attr("username", username); |
||||
writer.attr("appId", appId); |
||||
writer.attr("refreshToken", refreshToken); |
||||
writer.attr("doNotRemind", doNotRemind); |
||||
writer.attr("doNotRemindSelectedTime", doNotRemindSelectedTime); |
||||
writer.attr("designerActivatedTime", designerActivatedTime); |
||||
writer.attr("lastLoginTime", lastLoginTime); |
||||
writer.attr("currentVersionFirstLaunch", currentVersionFirstLaunch); |
||||
writer.attr("lastLoginType", lastLoginType.getType()); |
||||
writer.attr("lastLoginAccount", lastLoginAccount); |
||||
writer.attr("loginRemindBeforeJumpBBS", loginRemindBeforeJumpBBS); |
||||
writer.attr("pluginRemindOnFirstLaunch", pluginRemindOnFirstLaunch); |
||||
writer.end(); |
||||
} |
||||
|
||||
public int getUid() { |
||||
return uid; |
||||
} |
||||
|
||||
public void setUid(int uid) { |
||||
this.uid = uid; |
||||
} |
||||
|
||||
public String getUsername() { |
||||
return username; |
||||
} |
||||
|
||||
public void setUsername(String username) { |
||||
this.username = username; |
||||
} |
||||
|
||||
public String getAppId() { |
||||
return appId; |
||||
} |
||||
|
||||
public void setAppId(String appId) { |
||||
this.appId = appId; |
||||
} |
||||
|
||||
public String getRefreshToken() { |
||||
return refreshToken; |
||||
} |
||||
|
||||
public void setRefreshToken(String refreshToken) { |
||||
this.refreshToken = refreshToken; |
||||
} |
||||
|
||||
public long getDoNotRemindSelectedTime() { |
||||
return doNotRemindSelectedTime; |
||||
} |
||||
|
||||
public void setDoNotRemindSelectedTime(long doNotRemindSelectedTime) { |
||||
this.doNotRemindSelectedTime = doNotRemindSelectedTime; |
||||
} |
||||
|
||||
public boolean isDoNotRemind() { |
||||
return doNotRemind; |
||||
} |
||||
|
||||
public void setDoNotRemind(boolean doNotRemind) { |
||||
this.doNotRemind = doNotRemind; |
||||
} |
||||
|
||||
public long getDesignerActivatedTime() { |
||||
return designerActivatedTime; |
||||
} |
||||
|
||||
public void setDesignerActivatedTime(long designerActivatedTime) { |
||||
this.designerActivatedTime = designerActivatedTime; |
||||
} |
||||
|
||||
public long getLastLoginTime() { |
||||
return lastLoginTime; |
||||
} |
||||
|
||||
public void setLastLoginTime(long lastLoginTime) { |
||||
this.lastLoginTime = lastLoginTime; |
||||
} |
||||
|
||||
public boolean isCurrentVersionFirstLaunch() { |
||||
return currentVersionFirstLaunch; |
||||
} |
||||
|
||||
public void setCurrentVersionFirstLaunch(boolean currentVersionFirstLaunch) { |
||||
this.currentVersionFirstLaunch = currentVersionFirstLaunch; |
||||
} |
||||
|
||||
public DesignerLoginType getLastLoginType() { |
||||
return lastLoginType; |
||||
} |
||||
|
||||
public void setLastLoginType(DesignerLoginType lastLoginType) { |
||||
this.lastLoginType = lastLoginType; |
||||
} |
||||
|
||||
public String getLastLoginAccount() { |
||||
return lastLoginAccount; |
||||
} |
||||
|
||||
public void setLastLoginAccount(String lastLoginAccount) { |
||||
this.lastLoginAccount = lastLoginAccount; |
||||
} |
||||
|
||||
public boolean isLoginRemindBeforeJumpBBS() { |
||||
return loginRemindBeforeJumpBBS; |
||||
} |
||||
|
||||
public void setLoginRemindBeforeJumpBBS(boolean loginRemindBeforeJumpBBS) { |
||||
this.loginRemindBeforeJumpBBS = loginRemindBeforeJumpBBS; |
||||
} |
||||
|
||||
public boolean isPluginRemindOnFirstLaunch() { |
||||
return pluginRemindOnFirstLaunch; |
||||
} |
||||
|
||||
public void setPluginRemindOnFirstLaunch(boolean pluginRemindOnFirstLaunch) { |
||||
this.pluginRemindOnFirstLaunch = pluginRemindOnFirstLaunch; |
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.fr.design.login.executor; |
||||
|
||||
import com.fr.design.bridge.exec.JSExecutor; |
||||
import com.teamdev.jxbrowser.chromium.JSFunction; |
||||
import com.teamdev.jxbrowser.chromium.JSObject; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-04-18 |
||||
*/ |
||||
public class DesignerLoginBrowserExecutor implements JSExecutor { |
||||
|
||||
public static DesignerLoginBrowserExecutor create(JSObject window, JSFunction callback) { |
||||
return new DesignerLoginBrowserExecutor(window, callback); |
||||
} |
||||
|
||||
private JSObject window; |
||||
private JSFunction callback; |
||||
|
||||
private DesignerLoginBrowserExecutor(JSObject window, JSFunction callback) { |
||||
this.window = window; |
||||
this.callback = callback; |
||||
} |
||||
|
||||
@Override |
||||
public void executor(String newValue) { |
||||
callback.invoke(window, newValue); |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.design.login.executor; |
||||
|
||||
import com.fr.design.extra.Process; |
||||
import com.fr.design.extra.exe.Command; |
||||
import com.fr.design.extra.exe.Executor; |
||||
import com.fr.design.login.service.DesignerPassportManager; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/28 |
||||
*/ |
||||
public class DesignerLoginExecutor implements Executor { |
||||
private String result = "[]"; |
||||
|
||||
private String username; |
||||
private String password; |
||||
|
||||
public DesignerLoginExecutor(String username, String password) { |
||||
this.username = username; |
||||
this.password = password; |
||||
} |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
result = String.valueOf(DesignerPassportManager.getInstance().login(username, password)); |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.design.login.executor; |
||||
|
||||
import com.fr.design.extra.Process; |
||||
import com.fr.design.extra.exe.Command; |
||||
import com.fr.design.extra.exe.Executor; |
||||
import com.fr.design.login.service.DesignerPassportManager; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/28 |
||||
*/ |
||||
public class DesignerSendCaptchaExecutor implements Executor { |
||||
private String result = "[]"; |
||||
|
||||
private String regionCode; |
||||
private String phone; |
||||
|
||||
public DesignerSendCaptchaExecutor(String regionCode, String phone) { |
||||
this.regionCode = regionCode; |
||||
this.phone = phone; |
||||
} |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
result = String.valueOf(DesignerPassportManager.getInstance().sendCaptcha(regionCode, phone)); |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.design.login.executor; |
||||
|
||||
import com.fr.design.extra.Process; |
||||
import com.fr.design.extra.exe.Command; |
||||
import com.fr.design.extra.exe.Executor; |
||||
import com.fr.design.login.service.DesignerPassportManager; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/28 |
||||
*/ |
||||
public class DesignerSmsLoginExecutor implements Executor { |
||||
private String result = "[]"; |
||||
|
||||
private String regionCode; |
||||
private String phone; |
||||
private String code; |
||||
|
||||
public DesignerSmsLoginExecutor(String regionCode, String phone, String code) { |
||||
this.regionCode = regionCode; |
||||
this.phone = phone; |
||||
this.code = code; |
||||
} |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
result = DesignerPassportManager.getInstance().smsLogin(regionCode, phone, code); |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.login.executor; |
||||
|
||||
import com.fr.design.extra.Process; |
||||
import com.fr.design.extra.exe.Command; |
||||
import com.fr.design.extra.exe.Executor; |
||||
import com.fr.design.login.service.DesignerPassportManager; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/28 |
||||
*/ |
||||
public class DesignerSmsRegisterExecutor implements Executor { |
||||
private String result = "[]"; |
||||
|
||||
private String regionCode; |
||||
private String phone; |
||||
private String password; |
||||
private String regToken; |
||||
|
||||
public DesignerSmsRegisterExecutor(String regionCode, String phone, String password, String regToken) { |
||||
this.regionCode = regionCode; |
||||
this.phone = phone; |
||||
this.password = password; |
||||
this.regToken = regToken; |
||||
} |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
result = String.valueOf(DesignerPassportManager.getInstance().smsRegister(regionCode, phone, password, regToken)); |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,83 @@
|
||||
package com.fr.design.login.guide; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.bridge.exec.JSBridge; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.login.DesignerLoginHelper; |
||||
import com.fr.design.login.DesignerLoginSource; |
||||
import com.teamdev.jxbrowser.chromium.Browser; |
||||
import com.teamdev.jxbrowser.chromium.JSObject; |
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.SwingUtilities; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerGuideBridge { |
||||
|
||||
public static DesignerGuideBridge getBridge(Browser browser) { |
||||
return new DesignerGuideBridge(browser); |
||||
} |
||||
|
||||
private JSObject window; |
||||
|
||||
private DesignerGuideBridge(Browser browser) { |
||||
this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); |
||||
} |
||||
|
||||
@JSBridge |
||||
public String i18nText(String key) { |
||||
return Toolkit.i18nText(key); |
||||
} |
||||
|
||||
@JSBridge |
||||
public void closeWindow(boolean doNotRemind, boolean login) { |
||||
if (login) { |
||||
DesignerGuideHelper.closeWindow(); |
||||
DesignerLoginHelper.showLoginDialog(DesignerLoginSource.GUIDE); |
||||
checkDoNotRemind(doNotRemind); |
||||
} else { |
||||
SwingUtilities.invokeLater(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
String[] options = new String[]{ |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Quit"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Return_Login") |
||||
}; |
||||
int rv = FineJOptionPane.showConfirmDialog( |
||||
DesignerGuideHelper.getDialog(), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Login_Quit_Tip"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), |
||||
JOptionPane.YES_NO_OPTION, |
||||
JOptionPane.WARNING_MESSAGE, |
||||
null, |
||||
options, |
||||
options[1] |
||||
); |
||||
if (rv == JOptionPane.YES_OPTION) { |
||||
DesignerGuideHelper.closeWindow(); |
||||
checkDoNotRemind(doNotRemind); |
||||
} else if (rv == JOptionPane.NO_OPTION) { |
||||
DesignerLoginHelper.showLoginDialog(DesignerLoginSource.GUIDE); |
||||
DesignerGuideHelper.closeWindow(); |
||||
checkDoNotRemind(doNotRemind); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 用户勾选了一个月内不再提醒 |
||||
*/ |
||||
private void checkDoNotRemind(boolean doNotRemind) { |
||||
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); |
||||
manager.setDesignerLoginDoNotRemind(doNotRemind); |
||||
if (doNotRemind) { |
||||
manager.setDesignerLoginDoNotRemindSelectedTime(System.currentTimeMillis()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,114 @@
|
||||
package com.fr.design.login.guide; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.event.DesignerOpenedListener; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.os.impl.SupportOSImpl; |
||||
import javax.swing.WindowConstants; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerGuideHelper { |
||||
|
||||
private static final String MAIN_RESOURCE_PATH = "/com/fr/design/login/guide.html"; |
||||
private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser"; |
||||
private static final long ONE_WEEK = 7 * 24 * 3600 * 1000L; |
||||
private static final long ONE_MONTH = 30 * 24 * 3600 * 1000L; |
||||
private static final long SIX_MONTH = 6 * ONE_MONTH; |
||||
|
||||
private static UIDialog dialog = null; |
||||
|
||||
public static String getMainResourcePath() { |
||||
return MAIN_RESOURCE_PATH; |
||||
} |
||||
|
||||
public static UIDialog getDialog() { |
||||
return dialog; |
||||
} |
||||
|
||||
public static void prepareShowGuideDialog() { |
||||
if (!SupportOSImpl.DESIGNER_LOGIN.support()) { |
||||
return; |
||||
} |
||||
if (isActivatedForOneWeek()) { |
||||
if (isLogin() && !isLoginForSixMonths()) { |
||||
return; |
||||
} |
||||
if (selectedDoNotRemindInOneMonth()) { |
||||
return; |
||||
} |
||||
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { |
||||
@Override |
||||
public void designerOpened() { |
||||
showGuideDialog(); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 激活满一周 |
||||
*/ |
||||
private static boolean isActivatedForOneWeek() { |
||||
return (System.currentTimeMillis() - DesignerEnvManager.getEnvManager().getDesignerActivatedTime()) > ONE_WEEK; |
||||
} |
||||
|
||||
/** |
||||
* 已经登录 |
||||
*/ |
||||
private static boolean isLogin() { |
||||
return DesignerEnvManager.getEnvManager().getDesignerLoginUid() > 0; |
||||
} |
||||
|
||||
/** |
||||
* 已经登录满六个月 |
||||
*/ |
||||
private static boolean isLoginForSixMonths() { |
||||
return isLogin() && (System.currentTimeMillis() - DesignerEnvManager.getEnvManager().getDesignerLastLoginTime()) > SIX_MONTH; |
||||
} |
||||
|
||||
/** |
||||
* 一个月内不再提醒 |
||||
*/ |
||||
private static boolean selectedDoNotRemindInOneMonth() { |
||||
return DesignerEnvManager.getEnvManager().isDesignerLoginDoNotRemind() |
||||
&& (System.currentTimeMillis() - DesignerEnvManager.getEnvManager().getDesignerLoginDoNotRemindSelectedTime()) <= ONE_MONTH; |
||||
} |
||||
|
||||
private static void showGuideDialog() { |
||||
boolean hasJxBrowser = true; |
||||
try { |
||||
Class.forName(JXBROWSER); |
||||
} catch (ClassNotFoundException e) { |
||||
hasJxBrowser = false; |
||||
} |
||||
if (hasJxBrowser) { |
||||
showGuidePane(); |
||||
} |
||||
} |
||||
|
||||
private static void showGuidePane() { |
||||
DesignerGuidePane designerGuidePane = new DesignerGuidePane(); |
||||
if (dialog == null) { |
||||
dialog = new DesignerGuideShowDialog(DesignerContext.getDesignerFrame(), designerGuidePane); |
||||
} |
||||
dialog.setVisible(true); |
||||
} |
||||
|
||||
public static void closeWindow() { |
||||
if (dialog != null) { |
||||
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
||||
dialog.setVisible(false); |
||||
dialog = null; |
||||
} |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
DesignerEnvManager.getEnvManager().setOpenDebug(true); |
||||
showGuideDialog(); |
||||
} |
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.design.login.guide; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.login.guide.utils.DesignerGuideUtils; |
||||
import com.fr.design.ui.ModernUIPane; |
||||
import com.teamdev.jxbrowser.chromium.JSValue; |
||||
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; |
||||
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerGuidePane extends BasicPane { |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "DESIGNER_GUIDE"; |
||||
} |
||||
|
||||
public DesignerGuidePane() { |
||||
setLayout(new BorderLayout()); |
||||
ModernUIPane<Object> modernUIPane = new ModernUIPane.Builder<>() |
||||
.prepare(new ScriptContextAdapter() { |
||||
@Override |
||||
public void onScriptContextCreated(ScriptContextEvent event) { |
||||
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); |
||||
window.asObject().setProperty("DesignerGuideHelper", DesignerGuideBridge.getBridge(event.getBrowser())); |
||||
} |
||||
}) |
||||
.withEMB(DesignerGuideHelper.getMainResourcePath(), DesignerGuideUtils.renderMap()) |
||||
.build(); |
||||
add(modernUIPane, BorderLayout.CENTER); |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.login.guide; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.Frame; |
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerGuideShowDialog extends UIDialog { |
||||
|
||||
private static final Dimension DEFAULT = new Dimension(700, 577); |
||||
|
||||
public DesignerGuideShowDialog(Frame frame, BasicPane pane) { |
||||
super(frame); |
||||
setUndecorated(true); |
||||
JPanel panel = (JPanel) getContentPane(); |
||||
panel.setLayout(new BorderLayout()); |
||||
add(pane, BorderLayout.CENTER); |
||||
setSize(DEFAULT); |
||||
GUICoreUtils.centerWindow(this); |
||||
setResizable(false); |
||||
} |
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.design.login.guide.utils; |
||||
|
||||
import com.fr.general.GeneralContext; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerGuideUtils { |
||||
|
||||
public static Map<String, String> renderMap() { |
||||
Map<String, String> map4Tpl = new HashMap<>(); |
||||
map4Tpl.put("language", GeneralContext.getLocale().toString()); |
||||
return map4Tpl; |
||||
} |
||||
} |
@ -0,0 +1,167 @@
|
||||
package com.fr.design.login.service; |
||||
|
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.general.http.HttpToolbox; |
||||
import com.fr.general.log.MessageFormatter; |
||||
import com.fr.json.JSON; |
||||
import com.fr.json.JSONFactory; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.third.org.apache.commons.lang3.RandomStringUtils; |
||||
import java.util.HashMap; |
||||
import java.util.UUID; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/28 |
||||
*/ |
||||
public class DesignerLoginClient { |
||||
|
||||
private static final String LOGIN_API = CloudCenter.getInstance().acquireUrlByKind("designer.login.api", "http://api.shequ.fanruan.com/v1/user/login/"); |
||||
private static final String SEND_CAPTCHA_API = CloudCenter.getInstance().acquireUrlByKind("designer.send.captcha.api", "http://api.shequ.fanruan.com/v1/code/getsmscaptcha/?location={}&phone={}&smstype={}"); |
||||
private static final String SMS_LOGIN_API = CloudCenter.getInstance().acquireUrlByKind("designer.sms.login.api", "http://api.shequ.fanruan.com/v1/user/smslogin/"); |
||||
private static final String SMS_REGISTER_API = CloudCenter.getInstance().acquireUrlByKind("designer.sms.register.api", "http://api.shequ.fanruan.com/v1/user/register/"); |
||||
private static final String USERNAME = "username"; |
||||
private static final String PASSWORD = "password"; |
||||
private static final String SMS_TYPE_LOGIN_AND_REGISTER = "1"; |
||||
private static final String LOCATION = "location"; |
||||
private static final String PHONE = "phone"; |
||||
private static final String CODE = "code"; |
||||
private static final String STATUS = "status"; |
||||
private static final String DATA = "data"; |
||||
private static final String CLIENT = "client"; |
||||
private static final String UID = "uid"; |
||||
private static final String APP_ID = "appid"; |
||||
private static final String REFRESH_TOKEN = "refresh_token"; |
||||
private static final String REGISTER = "register"; |
||||
private static final String REG_TOKEN = "regtoken"; |
||||
private static final String REG_PHONE = "regphone"; |
||||
private static final String DEVICE = "device"; |
||||
private static final String REG_FROM = "reg_from"; |
||||
private static final String PRODUCT_FINEREPORT = "product-finereport"; |
||||
|
||||
/** |
||||
* 服务器内部错误 |
||||
*/ |
||||
private static final int INTERNAL_ERROR = 0; |
||||
|
||||
/** |
||||
* 未知错误 |
||||
*/ |
||||
private static final int UNKNOWN_ERROR = -3; |
||||
|
||||
/** |
||||
* 网络连接失败 |
||||
*/ |
||||
private static final int NETWORK_CONNECTED_FAILED = -4; |
||||
|
||||
public DesignerLoginResult login(String username, String password) { |
||||
try { |
||||
HashMap<String, Object> params = new HashMap<>(); |
||||
params.put(USERNAME, username); |
||||
params.put(PASSWORD, password); |
||||
String result = HttpToolbox.post(LOGIN_API, params); |
||||
JSONObject response = JSONFactory.createJSON(JSON.OBJECT, result); |
||||
int status = response.optInt(STATUS); |
||||
if (status < 0) { |
||||
return DesignerLoginResult.create(status, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, false, StringUtils.EMPTY); |
||||
} |
||||
JSONObject data = response.optJSONObject(DATA); |
||||
if (data != null) { |
||||
JSONObject client = data.optJSONObject(CLIENT); |
||||
if (client != null) { |
||||
int uid = client.optInt(UID); |
||||
if (uid > 0) { |
||||
return DesignerLoginResult.create(uid, client.optString(USERNAME), client.optString(APP_ID), data.optString(REFRESH_TOKEN), false, StringUtils.EMPTY); |
||||
} |
||||
} |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
return DesignerLoginResult.create(NETWORK_CONNECTED_FAILED, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, false, StringUtils.EMPTY); |
||||
} |
||||
return DesignerLoginResult.create(UNKNOWN_ERROR, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, false, StringUtils.EMPTY); |
||||
} |
||||
|
||||
public int sendCaptcha(String regionCode, String phone) { |
||||
try { |
||||
String url = MessageFormatter.arrayFormat(SEND_CAPTCHA_API, new String[]{regionCode, phone, SMS_TYPE_LOGIN_AND_REGISTER}).getMessage(); |
||||
String result = HttpToolbox.get(url); |
||||
JSONObject response = JSONFactory.createJSON(JSON.OBJECT, result); |
||||
return response.optInt(STATUS); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return INTERNAL_ERROR; |
||||
} |
||||
|
||||
public DesignerLoginResult smsLogin(String regionCode, String phone, String code) { |
||||
try { |
||||
HashMap<String, Object> params = new HashMap<>(); |
||||
params.put(LOCATION, regionCode); |
||||
params.put(PHONE, phone); |
||||
params.put(CODE, code); |
||||
String result = HttpToolbox.post(SMS_LOGIN_API, params); |
||||
JSONObject response = JSONFactory.createJSON(JSON.OBJECT, result); |
||||
int status = response.optInt(STATUS); |
||||
if (status < 0) { |
||||
return DesignerLoginResult.create(status, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, false, StringUtils.EMPTY); |
||||
} |
||||
JSONObject data = response.optJSONObject(DATA); |
||||
if (data != null) { |
||||
boolean register = data.optBoolean(REGISTER); |
||||
if (register) { |
||||
String regToken = data.optString(REG_TOKEN); |
||||
if (regToken != null) { |
||||
return DesignerLoginResult.create(status, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, true, regToken); |
||||
} |
||||
} else { |
||||
JSONObject client = data.optJSONObject(CLIENT); |
||||
if (client != null) { |
||||
int uid = client.optInt(UID); |
||||
if (uid > 0) { |
||||
return DesignerLoginResult.create(uid, client.optString(USERNAME), client.optString(APP_ID), data.optString(REFRESH_TOKEN), false, StringUtils.EMPTY); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return DesignerLoginResult.create(INTERNAL_ERROR, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, false, StringUtils.EMPTY); |
||||
} |
||||
|
||||
public DesignerLoginResult smsRegister(String regionCode, String phone, String password, String regToken) { |
||||
try { |
||||
HashMap<String, Object> params = new HashMap<>(); |
||||
params.put(USERNAME, RandomStringUtils.randomAlphabetic(8)); |
||||
params.put(PASSWORD, password); |
||||
params.put(REG_TOKEN, regToken); |
||||
params.put(LOCATION, regionCode); |
||||
params.put(REG_PHONE, phone); |
||||
params.put(DEVICE, PRODUCT_FINEREPORT); |
||||
params.put(REG_FROM, PRODUCT_FINEREPORT); |
||||
String result = HttpToolbox.post(SMS_REGISTER_API, params); |
||||
JSONObject response = JSONFactory.createJSON(JSON.OBJECT, result); |
||||
int status = response.optInt(STATUS); |
||||
if (status < 0) { |
||||
return DesignerLoginResult.create(status, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, false, StringUtils.EMPTY); |
||||
} |
||||
JSONObject data = response.optJSONObject(DATA); |
||||
if (data != null) { |
||||
JSONObject client = data.optJSONObject(CLIENT); |
||||
if (client != null) { |
||||
int uid = client.optInt(UID); |
||||
if (uid > 0) { |
||||
return DesignerLoginResult.create(uid, client.optString(USERNAME), client.optString(APP_ID), data.optString(REFRESH_TOKEN), false, StringUtils.EMPTY); |
||||
} |
||||
} |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return DesignerLoginResult.create(INTERNAL_ERROR, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, false, StringUtils.EMPTY); |
||||
} |
||||
} |
@ -0,0 +1,82 @@
|
||||
package com.fr.design.login.service; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/28 |
||||
*/ |
||||
public class DesignerLoginResult { |
||||
|
||||
private int uid; |
||||
|
||||
private String username; |
||||
|
||||
private String appId; |
||||
|
||||
private String refreshToken; |
||||
|
||||
private boolean register; |
||||
|
||||
private String regToken; |
||||
|
||||
private DesignerLoginResult(int uid, String username, String appId, String refreshToken, boolean register, String regToken) { |
||||
this.uid = uid; |
||||
this.username = username; |
||||
this.appId = appId; |
||||
this.refreshToken = refreshToken; |
||||
this.regToken = regToken; |
||||
this.register = register; |
||||
} |
||||
|
||||
public static DesignerLoginResult create(int uid, String username, String appId, String refreshToken, boolean register, String regToken) { |
||||
return new DesignerLoginResult(uid, username, appId, refreshToken, register, regToken); |
||||
} |
||||
|
||||
public int getUid() { |
||||
return uid; |
||||
} |
||||
|
||||
public void setUid(int uid) { |
||||
this.uid = uid; |
||||
} |
||||
|
||||
public String getUsername() { |
||||
return username; |
||||
} |
||||
|
||||
public void setUsername(String username) { |
||||
this.username = username; |
||||
} |
||||
|
||||
public String getAppId() { |
||||
return appId; |
||||
} |
||||
|
||||
public void setAppId(String appId) { |
||||
this.appId = appId; |
||||
} |
||||
|
||||
public String getRefreshToken() { |
||||
return refreshToken; |
||||
} |
||||
|
||||
public void setRefreshToken(String refreshToken) { |
||||
this.refreshToken = refreshToken; |
||||
} |
||||
|
||||
public boolean isRegister() { |
||||
return register; |
||||
} |
||||
|
||||
public void setRegister(boolean register) { |
||||
this.register = register; |
||||
} |
||||
|
||||
public String getRegToken() { |
||||
return regToken; |
||||
} |
||||
|
||||
public void setRegToken(String regToken) { |
||||
this.regToken = regToken; |
||||
} |
||||
} |
@ -0,0 +1,114 @@
|
||||
package com.fr.design.login.service; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.login.DesignerLoginType; |
||||
import com.fr.design.upm.event.CertificateEvent; |
||||
import com.fr.event.EventDispatcher; |
||||
import com.fr.json.JSONObject; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/28 |
||||
*/ |
||||
public class DesignerPassportManager { |
||||
|
||||
private static final String STATUS = "status"; |
||||
private static final String REGISTER = "register"; |
||||
private static final String REG_TOKEN = "regtoken"; |
||||
|
||||
private static volatile DesignerPassportManager instance = null; |
||||
|
||||
public static DesignerPassportManager getInstance() { |
||||
if (instance == null) { |
||||
synchronized (DesignerPassportManager.class) { |
||||
if (instance == null) { |
||||
instance = new DesignerPassportManager(); |
||||
} |
||||
} |
||||
} |
||||
return instance; |
||||
} |
||||
|
||||
/** |
||||
* 账号密码登录帆软通行证 |
||||
* |
||||
* @param username 论坛账号 |
||||
* @param password 密码 |
||||
*/ |
||||
public int login(String username, String password) { |
||||
DesignerLoginClient client = new DesignerLoginClient(); |
||||
DesignerLoginResult result = client.login(username, password); |
||||
int uid = result.getUid(); |
||||
if (uid > 0) { |
||||
saveUserInfo(uid, result.getUsername(), result.getAppId(), result.getRefreshToken(), DesignerLoginType.NORMAL_LOGIN, username); |
||||
} |
||||
return uid; |
||||
} |
||||
|
||||
/** |
||||
* 发送短信验证码 |
||||
* |
||||
* @param regionCode 区号 |
||||
* @param phone 手机 |
||||
*/ |
||||
public int sendCaptcha(String regionCode, String phone) { |
||||
DesignerLoginClient client = new DesignerLoginClient(); |
||||
return client.sendCaptcha(regionCode, phone); |
||||
} |
||||
|
||||
/** |
||||
* 短信登录帆软通行证 |
||||
* |
||||
* @param regionCode 区号 |
||||
* @param phone 手机 |
||||
* @param code 验证码 |
||||
*/ |
||||
public String smsLogin(String regionCode, String phone, String code) { |
||||
DesignerLoginClient client = new DesignerLoginClient(); |
||||
DesignerLoginResult result = client.smsLogin(regionCode, phone, code); |
||||
int uid = result.getUid(); |
||||
if (uid > 0) { |
||||
saveUserInfo(uid, result.getUsername(), result.getAppId(), result.getRefreshToken(), DesignerLoginType.SMS_LOGIN, regionCode + "-" + phone); |
||||
} |
||||
JSONObject jo = new JSONObject(); |
||||
jo.put(STATUS, result.getUid()); |
||||
jo.put(REGISTER, result.isRegister()); |
||||
jo.put(REG_TOKEN, result.getRegToken()); |
||||
return jo.toString(); |
||||
} |
||||
|
||||
/** |
||||
* 注册帆软通行证 |
||||
* |
||||
* @param regionCode 区号 |
||||
* @param phone 手机 |
||||
* @param password 密码 |
||||
* @param regToken 注册令牌 |
||||
*/ |
||||
public int smsRegister(String regionCode, String phone, String password, String regToken) { |
||||
DesignerLoginClient client = new DesignerLoginClient(); |
||||
DesignerLoginResult result = client.smsRegister(regionCode, phone, password, regToken); |
||||
int uid = result.getUid(); |
||||
if (uid > 0) { |
||||
saveUserInfo(uid, result.getUsername(), result.getAppId(), result.getRefreshToken(), DesignerLoginType.SMS_LOGIN, regionCode + "-" + phone); |
||||
} |
||||
return uid; |
||||
} |
||||
|
||||
/** |
||||
* 保存登录信息 |
||||
*/ |
||||
private void saveUserInfo(int uid, String username, String appId, String refreshToken, DesignerLoginType type, String account) { |
||||
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); |
||||
manager.setDesignerLoginUid(uid); |
||||
manager.setDesignerLoginUsername(username); |
||||
manager.setDesignerLoginAppId(appId); |
||||
manager.setDesignerLoginRefreshToken(refreshToken); |
||||
manager.setDesignerLastLoginTime(System.currentTimeMillis()); |
||||
manager.setLastLoginType(type); |
||||
manager.setLastLoginAccount(account); |
||||
DesignerEnvManager.getEnvManager().saveXMLFile(); |
||||
EventDispatcher.fire(CertificateEvent.LOGIN, username); |
||||
} |
||||
} |
@ -0,0 +1,87 @@
|
||||
package com.fr.design.login.socketio; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.login.DesignerLoginType; |
||||
import com.fr.design.login.bean.BBSAccountLogin; |
||||
import com.fr.design.upm.event.CertificateEvent; |
||||
import com.fr.event.EventDispatcher; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.third.socketio.AckRequest; |
||||
import com.fr.third.socketio.Configuration; |
||||
import com.fr.third.socketio.SocketIOClient; |
||||
import com.fr.third.socketio.SocketIOServer; |
||||
import com.fr.third.socketio.listener.DataListener; |
||||
import java.net.URLDecoder; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/6/3 |
||||
*/ |
||||
public class LoginAuthServer { |
||||
|
||||
private SocketIOServer server; |
||||
|
||||
private static final String HOSTNAME = "localhost"; |
||||
private static final int PORT = 41925; |
||||
|
||||
private static volatile LoginAuthServer instance = null; |
||||
|
||||
public static LoginAuthServer getInstance() { |
||||
if (instance == null) { |
||||
synchronized (LoginAuthServer.class) { |
||||
if (instance == null) { |
||||
instance = new LoginAuthServer(); |
||||
} |
||||
} |
||||
} |
||||
return instance; |
||||
} |
||||
|
||||
private LoginAuthServer() { |
||||
Configuration config = new Configuration(); |
||||
config.setHostname(HOSTNAME); |
||||
config.setPort(PORT); |
||||
server = new SocketIOServer(config); |
||||
initEventListener(); |
||||
} |
||||
|
||||
public void start() { |
||||
try { |
||||
server.start(); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
|
||||
public void stop() { |
||||
try { |
||||
server.stop(); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
|
||||
private void initEventListener() { |
||||
server.addEventListener("bbsAccountLogin", BBSAccountLogin.class, new DataListener<BBSAccountLogin>() { |
||||
@Override |
||||
public void onData(SocketIOClient client, BBSAccountLogin data, AckRequest ackRequest) throws Exception { |
||||
// 保存登录信息到.FineReport100配置中
|
||||
int uid = data.getUid(); |
||||
if (uid > 0) { |
||||
String username = URLDecoder.decode(data.getUsername(), "UTF-8"); |
||||
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); |
||||
manager.setDesignerLoginUid(data.getUid()); |
||||
manager.setDesignerLoginUsername(username); |
||||
manager.setDesignerLoginAppId(data.getAppId()); |
||||
manager.setDesignerLoginRefreshToken(data.getRefreshToken()); |
||||
manager.setDesignerLastLoginTime(System.currentTimeMillis()); |
||||
manager.setLastLoginType(DesignerLoginType.NORMAL_LOGIN); |
||||
manager.setLastLoginAccount(username); |
||||
DesignerEnvManager.getEnvManager().saveXMLFile(); |
||||
EventDispatcher.fire(CertificateEvent.LOGIN, username); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,51 @@
|
||||
package com.fr.design.login.task; |
||||
|
||||
import com.fr.design.bridge.exec.JSCallback; |
||||
import com.fr.design.bridge.exec.JSUtils; |
||||
import com.fr.design.extra.Process; |
||||
import com.fr.design.extra.exe.Command; |
||||
import com.fr.design.extra.exe.Executor; |
||||
import com.fr.stable.StringUtils; |
||||
import javax.swing.SwingWorker; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/27 |
||||
*/ |
||||
public class DesignerLoginTaskWorker<V> extends SwingWorker<V, String> { |
||||
|
||||
private Executor executor; |
||||
private JSCallback callback; |
||||
|
||||
public DesignerLoginTaskWorker(final JSCallback callback, final Executor executor) { |
||||
this.executor = executor; |
||||
this.callback = callback; |
||||
} |
||||
|
||||
@Override |
||||
protected V doInBackground() throws Exception { |
||||
Command[] commands = executor.getCommands(); |
||||
for (Command command : commands) { |
||||
String message = command.getExecuteMessage(); |
||||
if (StringUtils.isNotBlank(message)) { |
||||
publish(message); |
||||
} |
||||
command.run(new Process<String>() { |
||||
@Override |
||||
public void process(String s) { |
||||
if (StringUtils.isNotBlank(s)) { |
||||
publish(JSUtils.trimText(s)); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void done() { |
||||
String result = executor.getTaskFinishMessage(); |
||||
callback.execute(result); |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.login.utils; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.mainframe.toast.DesignerToastMsgUtil; |
||||
import com.fr.general.GeneralContext; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author Lanlan |
||||
* @version 10.0 |
||||
* Created by Lanlan on 2021/5/21 |
||||
*/ |
||||
public class DesignerLoginUtils { |
||||
|
||||
public static Map<String, String> renderMap() { |
||||
Map<String, String> map4Tpl = new HashMap<>(); |
||||
map4Tpl.put("language", GeneralContext.getLocale().toString()); |
||||
return map4Tpl; |
||||
} |
||||
|
||||
public static void showPluginRemindOnFirstLaunch() { |
||||
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); |
||||
int uid = manager.getDesignerLoginUid(); |
||||
if (uid > 0) { |
||||
boolean pluginRemindOnFirstLaunch = manager.isPluginRemindOnFirstLaunch(); |
||||
if (pluginRemindOnFirstLaunch) { |
||||
DesignerToastMsgUtil.toastWarning( |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Plugin_Tip") |
||||
); |
||||
manager.setPluginRemindOnFirstLaunch(false); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,2 @@
|
||||
VERSION=1.0 |
||||
ENV_VERSION=10.0 |
@ -0,0 +1,52 @@
|
||||
.background-login-close { |
||||
color: white !important; |
||||
font-weight: bold; |
||||
font-size: 14px; |
||||
} |
||||
.background-guide-close { |
||||
color: black !important; |
||||
font-weight: bold; |
||||
font-size: 16px; |
||||
} |
||||
.background-login-loading { |
||||
background: url(./img/login_loading.gif) no-repeat center center; |
||||
} |
||||
.background-plugin-need-update { |
||||
background: url(./img/icon_new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-cant-use { |
||||
background: url(./img/icon_cantuse.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable { |
||||
background: url(./img/icon_disable.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable-new { |
||||
background: url(./img/icon_disable-new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-selected { |
||||
background: url(./img/icon_marked.png) no-repeat center center; |
||||
} |
||||
.background-shop-title-close { |
||||
background: url(./img/icon_close40x40_normal.svg) no-repeat center center; |
||||
} |
||||
.background-dialog-confirm { |
||||
background: url(./img/warning.png) no-repeat center center; |
||||
background-size: contain; |
||||
} |
||||
.background-close-button { |
||||
background: url(./img/icon_close9x9_normal.png) no-repeat center center; |
||||
} |
||||
.background-close-button:hover { |
||||
background: url(./img/icon_close9x9_hover.png) no-repeat center center; |
||||
} |
||||
.designer-login-guide { |
||||
background: url(./img/login_guide.png) no-repeat center center; |
||||
background-size: cover; |
||||
} |
||||
.designer-guide-login-button { |
||||
font-size: 14px; |
||||
color: white; |
||||
border-radius: 4px; |
||||
background-color: #3685F2; |
||||
} |
||||
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<title>title</title> |
||||
<style> |
||||
@font-face { |
||||
font-family: "fineui"; |
||||
src: url('../lib/font/iconfont.eot'); |
||||
src: url('../lib/font/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('../lib/font/iconfont.woff') format('woff'), /* chrome、firefox */ url('../lib/font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('../lib/font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */ |
||||
} |
||||
</style> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<link rel="stylesheet" type="text/css" href="lib/bundle.css"/> |
||||
<script type="text/javascript" charset="UTF-8" src="lib/locale/login_zh_CN.js?_=compatible"></script> |
||||
<script type="text/javascript" charset="UTF-8" src="lib/locale/login_${language}.js"></script><script type="text/javascript" charset="UTF-8" src="lib/fineui.min.js"></script><script type="text/javascript"></script> |
||||
<style> |
||||
body { |
||||
overflow-y: auto; |
||||
} |
||||
</style> |
||||
<link href="guide.css" rel="stylesheet"></head> |
||||
</html> |
||||
<script type="text/javascript" src="guide.js"></script> |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 260 B |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 473 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 357 KiB |
@ -0,0 +1,5 @@
|
||||
var Store = { |
||||
i18n : { |
||||
|
||||
}} |
||||
window.Store = Store; |
@ -0,0 +1,5 @@
|
||||
var Store = { |
||||
i18n : { |
||||
|
||||
}} |
||||
window.Store = Store; |
@ -0,0 +1,5 @@
|
||||
var Store = { |
||||
i18n : { |
||||
|
||||
}} |
||||
window.Store = Store; |
@ -0,0 +1,59 @@
|
||||
var Store = { |
||||
i18n : { |
||||
'Designer-Login_User_Name': '用户名/邮箱/手机号', |
||||
'Designer-Login_User_Name_Hint': '请输入用户名/邮箱/手机号', |
||||
'Designer-Login_Password': '密码', |
||||
'Designer-Login_Password_Hint': '请输入密码', |
||||
'Designer-Login': '登录', |
||||
'Designer-Login_Title': '帆软通行证登录', |
||||
'Designer-Login_I_Have_Read': '我已阅读', |
||||
'Designer-Login_Service_Terms': '服务条款', |
||||
'Designer-Login_Forget_Password': '忘记密码?', |
||||
'Designer-Login_Sms': '验证码登录', |
||||
'Designer-Login_Normal': '密码登录', |
||||
'Designer-Login_Phone': '手机号码', |
||||
'Designer-Login_Phone_Hint': '请输入手机号码', |
||||
'Designer-Login_Code': '验证码', |
||||
'Designer-Login_Code_Hint': '请输入验证码', |
||||
'Designer-Login_Code_Request': '获取验证码', |
||||
'Designer-Login_Code_Request_Again': '重新获取', |
||||
'Designer-Login_Register_Or_Login': '注册/登录', |
||||
'Designer-Basic_Chinese_Mainland': '中国大陆', |
||||
'Designer-Basic_Chinese_Hong_Kong': '中国香港', |
||||
'Designer-Basic_Chinese_Macao': '中国澳门', |
||||
'Designer-Basic_Chinese_Taiwan': '中国台湾', |
||||
'Designer-Basic_Turkey': '土耳其', |
||||
'Designer-Basic_South_Korea': '韩国', |
||||
'Designer-Basic_Japan': '日本', |
||||
'Designer-Basic_Singapore': '新加坡', |
||||
'Designer-Basic_Malaysia': '马来西亚', |
||||
'Designer-Login_Username_Not_Null': '用户名不能为空', |
||||
'Designer-Login_Password_Not_Null': '密码不能为空', |
||||
'Designer-Login_Username_Or_Password_Incorrect': '用户名或者密码错误,请检查', |
||||
'Designer-Login_Phone_Not_Null': '手机号码格式非法', |
||||
'Designer-Login_Code_Not_Null': '验证码不能为空', |
||||
'Designer-Login_Code_Incorrect': '验证码已过期,请重新获取', |
||||
'Designer-Login_Password_Setting_Hint': '输入登录密码(可输入6-16位密码)', |
||||
'Designer-Login_Store_User_Not_Exist': '用户名不存在', |
||||
'Designer-Login_Store_User_Password_Error': '用户名或密码错误', |
||||
'Designer-Login_Token_Request_Failed': '注册令牌获取失败', |
||||
'Designer-Login_Unexpected_Error': '未知错误', |
||||
'Designer-Login_Internal_Error': '服务器内部错误', |
||||
'Designer-Guide_Do_Not_Remind': '一个月内不再提醒', |
||||
'Designer-Guide_Login': '立即登录', |
||||
'Designer-BBS_Register_Timeout': '注册超时,请重新发送验证码', |
||||
'Designer-BBS_Phone_Is_Register': '该手机号码已注册', |
||||
'Designer-BBS_Captcha_Send_Exceed_Limit': '验证码每60s只能发送一次', |
||||
'Designer-BBS_Phone_Format_Error': '发送失败,手机号格式错误', |
||||
'Designer-BBS_Captcha_Out_Of_Date': '验证码已过期,请重新获取', |
||||
'Designer-BBS_Captcha_Try_Exceed_Limit': '验证码尝试次数已达上限,请重新获取', |
||||
'Designer-BBS_Captcha_Error': '验证码错误', |
||||
'Designer-BBS_Username_Format_Error': '昵称只支持中英文和数字', |
||||
'Designer-BBS_Username_Too_Short': '昵称长度太短', |
||||
'Designer-BBS_Username_Too_Long': '这个昵称长度已经达到了上限', |
||||
'Designer-BBS_Username_Is_Register': '该用户已被注册', |
||||
'Designer-BBS_Please_Enter_Correct_Phone': '请输入正确的手机号', |
||||
'Designer-Login_Network_Connected_Failed': '网络连接失败', |
||||
|
||||
}} |
||||
window.Store = Store; |
@ -0,0 +1,5 @@
|
||||
var Store = { |
||||
i18n : { |
||||
|
||||
}} |
||||
window.Store = Store; |
@ -0,0 +1,40 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */ |
||||
const fs = require('fs'); |
||||
const { resolve } = require('path'); |
||||
const propertiesReader = require('properties-reader'); |
||||
|
||||
function compileSinglePropertiesFile2JS(filename) { |
||||
if (!/\.properties/g.test(filename)) { |
||||
return; |
||||
} |
||||
|
||||
const filePrefix = filename.split('.')[0].replace('show_', ''); |
||||
|
||||
let content = ''; |
||||
|
||||
const properties = propertiesReader(resolve(__dirname, `../../../i18n/${filename}`)); |
||||
|
||||
properties.each((key, value) => { |
||||
content += ` '${key}': '${value}',\n`; |
||||
}); |
||||
|
||||
content = `var Store = {
|
||||
i18n : { |
||||
${content} |
||||
}} |
||||
window.Store = Store;` |
||||
|
||||
fs.writeFileSync( |
||||
resolve( |
||||
__dirname, |
||||
`${filePrefix}.js` |
||||
), |
||||
content |
||||
); |
||||
} |
||||
function compilePropertiesFiles2JS() { |
||||
fs.readdirSync(resolve(__dirname, '../../../i18n')) |
||||
.forEach(file => compileSinglePropertiesFile2JS(file)); |
||||
} |
||||
|
||||
compilePropertiesFiles2JS(); |
@ -0,0 +1,230 @@
|
||||
.background-login-close { |
||||
color: white !important; |
||||
font-weight: bold; |
||||
font-size: 14px; |
||||
} |
||||
.background-guide-close { |
||||
color: black !important; |
||||
font-weight: bold; |
||||
font-size: 16px; |
||||
} |
||||
.background-login-loading { |
||||
background: url(./img/login_loading.gif) no-repeat center center; |
||||
} |
||||
.background-plugin-need-update { |
||||
background: url(./img/icon_new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-cant-use { |
||||
background: url(./img/icon_cantuse.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable { |
||||
background: url(./img/icon_disable.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable-new { |
||||
background: url(./img/icon_disable-new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-selected { |
||||
background: url(./img/icon_marked.png) no-repeat center center; |
||||
} |
||||
.background-shop-title-close { |
||||
background: url(./img/icon_close40x40_normal.svg) no-repeat center center; |
||||
} |
||||
.background-dialog-confirm { |
||||
background: url(./img/warning.png) no-repeat center center; |
||||
background-size: contain; |
||||
} |
||||
.background-close-button { |
||||
background: url(./img/icon_close9x9_normal.png) no-repeat center center; |
||||
} |
||||
.background-close-button:hover { |
||||
background: url(./img/icon_close9x9_hover.png) no-repeat center center; |
||||
} |
||||
.designer-login-login-title { |
||||
font-size: 20px; |
||||
color: #FFFFFF; |
||||
} |
||||
|
||||
.background-login-close { |
||||
color: white !important; |
||||
font-weight: bold; |
||||
font-size: 14px; |
||||
} |
||||
.background-guide-close { |
||||
color: black !important; |
||||
font-weight: bold; |
||||
font-size: 16px; |
||||
} |
||||
.background-login-loading { |
||||
background: url(./img/login_loading.gif) no-repeat center center; |
||||
} |
||||
.background-plugin-need-update { |
||||
background: url(./img/icon_new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-cant-use { |
||||
background: url(./img/icon_cantuse.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable { |
||||
background: url(./img/icon_disable.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable-new { |
||||
background: url(./img/icon_disable-new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-selected { |
||||
background: url(./img/icon_marked.png) no-repeat center center; |
||||
} |
||||
.background-shop-title-close { |
||||
background: url(./img/icon_close40x40_normal.svg) no-repeat center center; |
||||
} |
||||
.background-dialog-confirm { |
||||
background: url(./img/warning.png) no-repeat center center; |
||||
background-size: contain; |
||||
} |
||||
.background-close-button { |
||||
background: url(./img/icon_close9x9_normal.png) no-repeat center center; |
||||
} |
||||
.background-close-button:hover { |
||||
background: url(./img/icon_close9x9_hover.png) no-repeat center center; |
||||
} |
||||
.designer-login-login-body .login-login-button { |
||||
font-size: 16px; |
||||
border-radius: 20px; |
||||
background-color: #3685F2; |
||||
} |
||||
.designer-login-body { |
||||
border-radius: 8px; |
||||
background-color: #FFFFFF; |
||||
} |
||||
.designer-login-body .designer-login-change-mode { |
||||
font-size: 14px; |
||||
border-bottom-width: 2px; |
||||
} |
||||
.designer-login-body .designer-login-change-mode.hover { |
||||
color: #0082FC; |
||||
} |
||||
.designer-login-body .designer-login-change-mode.active { |
||||
border-bottom-color: #0082FC; |
||||
} |
||||
.designer-login-text { |
||||
color: #647185; |
||||
font-size: 14px; |
||||
} |
||||
.designer-login-editor-username { |
||||
color: #C4C9D1; |
||||
font-size: 14px; |
||||
margin-bottom: 15px; |
||||
} |
||||
.designer-login-editor-password { |
||||
color: #C4C9D1; |
||||
font-size: 14px; |
||||
margin-bottom: 15px; |
||||
} |
||||
.designer-login-error-message { |
||||
color: #FF2F3F; |
||||
font-size: 14px; |
||||
} |
||||
.designer-login-code-text { |
||||
color: #3685F2; |
||||
font-size: 14px; |
||||
} |
||||
.designer-login-border-bottom { |
||||
border-bottom: 1px solid #e8eaed; |
||||
} |
||||
|
||||
.background-login-close { |
||||
color: white !important; |
||||
font-weight: bold; |
||||
font-size: 14px; |
||||
} |
||||
.background-guide-close { |
||||
color: black !important; |
||||
font-weight: bold; |
||||
font-size: 16px; |
||||
} |
||||
.background-login-loading { |
||||
background: url(./img/login_loading.gif) no-repeat center center; |
||||
} |
||||
.background-plugin-need-update { |
||||
background: url(./img/icon_new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-cant-use { |
||||
background: url(./img/icon_cantuse.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable { |
||||
background: url(./img/icon_disable.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable-new { |
||||
background: url(./img/icon_disable-new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-selected { |
||||
background: url(./img/icon_marked.png) no-repeat center center; |
||||
} |
||||
.background-shop-title-close { |
||||
background: url(./img/icon_close40x40_normal.svg) no-repeat center center; |
||||
} |
||||
.background-dialog-confirm { |
||||
background: url(./img/warning.png) no-repeat center center; |
||||
background-size: contain; |
||||
} |
||||
.background-close-button { |
||||
background: url(./img/icon_close9x9_normal.png) no-repeat center center; |
||||
} |
||||
.background-close-button:hover { |
||||
background: url(./img/icon_close9x9_hover.png) no-repeat center center; |
||||
} |
||||
.designer-login-login-foot .login-foot-text { |
||||
font-size: 14px; |
||||
color: #647185; |
||||
} |
||||
.designer-login-login-foot .login-link { |
||||
font-size: 14px; |
||||
color: #3685F2; |
||||
} |
||||
|
||||
.background-login-close { |
||||
color: white !important; |
||||
font-weight: bold; |
||||
font-size: 14px; |
||||
} |
||||
.background-guide-close { |
||||
color: black !important; |
||||
font-weight: bold; |
||||
font-size: 16px; |
||||
} |
||||
.background-login-loading { |
||||
background: url(./img/login_loading.gif) no-repeat center center; |
||||
} |
||||
.background-plugin-need-update { |
||||
background: url(./img/icon_new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-cant-use { |
||||
background: url(./img/icon_cantuse.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable { |
||||
background: url(./img/icon_disable.png) no-repeat center center; |
||||
} |
||||
.background-plugin-is-disable-new { |
||||
background: url(./img/icon_disable-new.png) no-repeat center center; |
||||
} |
||||
.background-plugin-selected { |
||||
background: url(./img/icon_marked.png) no-repeat center center; |
||||
} |
||||
.background-shop-title-close { |
||||
background: url(./img/icon_close40x40_normal.svg) no-repeat center center; |
||||
} |
||||
.background-dialog-confirm { |
||||
background: url(./img/warning.png) no-repeat center center; |
||||
background-size: contain; |
||||
} |
||||
.background-close-button { |
||||
background: url(./img/icon_close9x9_normal.png) no-repeat center center; |
||||
} |
||||
.background-close-button:hover { |
||||
background: url(./img/icon_close9x9_hover.png) no-repeat center center; |
||||
} |
||||
.designer-login-login { |
||||
border: solid 1px #009DE3; |
||||
} |
||||
.designer-login { |
||||
background-color: #3685F2; |
||||
} |
||||
|
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<title>title</title> |
||||
<style> |
||||
@font-face { |
||||
font-family: "fineui"; |
||||
src: url('../lib/font/iconfont.eot'); |
||||
src: url('../lib/font/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('../lib/font/iconfont.woff') format('woff'), /* chrome、firefox */ url('../lib/font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('../lib/font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */ |
||||
} |
||||
</style> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<link rel="stylesheet" type="text/css" href="lib/bundle.css"/> |
||||
<script type="text/javascript" charset="UTF-8" src="lib/locale/login_zh_CN.js?_=compatible"></script> |
||||
<script type="text/javascript" charset="UTF-8" src="lib/locale/login_${language}.js"></script><script type="text/javascript" charset="UTF-8" src="lib/fineui.min.js"></script><script type="text/javascript"></script> |
||||
<style> |
||||
body { |
||||
overflow-y: auto; |
||||
} |
||||
</style> |
||||
<link href="login.css" rel="stylesheet"></head> |
||||
</html> |
||||
<script type="text/javascript" src="login.js"></script> |