diff --git a/main/java/shkd/repc/resp/portal/IndexEditNewPlugin.java b/main/java/shkd/repc/resp/portal/IndexEditNewPlugin.java index 632ee6b..0c148a1 100644 --- a/main/java/shkd/repc/resp/portal/IndexEditNewPlugin.java +++ b/main/java/shkd/repc/resp/portal/IndexEditNewPlugin.java @@ -11,17 +11,25 @@ import kd.bos.form.control.Label; import kd.bos.form.control.Search; import kd.bos.form.control.events.SearchEnterEvent; import kd.bos.form.control.events.SearchEnterListener; +import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.operate.FormOperate; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; +import kd.bos.orm.util.CollectionUtils; +import kd.bos.session.SessionManager; import kd.repc.common.util.CacheMCData; +import kd.repc.common.util.CustomCacheUtil; import kd.repc.resp.formplugin.portal.IndexEditNew; import kd.repc.resp.formplugin.portal.PortalLableStyleChangeUtil; +import kd.repc.resp.formplugin.registered.RegisteredUtils; import java.util.EventObject; import java.util.HashMap; +import java.util.List; import java.util.Map; public class IndexEditNewPlugin extends IndexEditNew implements SearchEnterListener { + String[] lablekeys = new String[]{"qeug_label_notification"}; protected static final String companyLogoFlag = "companylogo"; protected static final String COMPANYLOGOFLEXPANEL = "companylogoflexpanel"; @@ -71,6 +79,14 @@ public class IndexEditNewPlugin extends IndexEditNew implements SearchEnterListe search2.setSearchKey(""); this.getView().updateView("qeug_searchap"); break; + case "qeug_label_notification": + (new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "qeug_label_notification", ResManager.loadKDString("通知公告", "IndexEditNew_8", "repc-resp-formplugin", new Object[0])); + HashMap cardInfo = new HashMap(); + cardInfo.put("formId", "qeug_resp_notice_new"); + cardInfo.put("container", "qeug_gc_notice_new"); + cardInfo.put("cardId", "qeug_card_resp_notice_new"); + this.loadCards(portalConfigId, cardInfo, (Map)null); + break; case "label_bidwon": (new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "label_bidwon", ResManager.loadKDString("中标公告", "IndexEditNew_5", "repc-resp-formplugin", new Object[0])); this.loadCards(portalConfigId, this.getCardInfo("bidwinannolarge"), (Map)null); @@ -139,6 +155,82 @@ public class IndexEditNewPlugin extends IndexEditNew implements SearchEnterListe this.getView().showForm(formShowPara); } + @Override + public void beforeDoOperation(BeforeDoOperationEventArgs args) { + super.beforeDoOperation(args); + FormOperate operate = (FormOperate)args.getSource(); + String key = operate.getOperateKey(); + String[] switchKeys = new String[]{"home", "bidprojanno", "bidwinanno", "recruitanno", "contactus", "notification"}; + List switchKeyList = CollectionUtils.arrayToList(switchKeys); + String globalSessionId; + if (switchKeyList.contains(key)) { + this.setHeadflexpanelBackgroundImg(true); + globalSessionId = this.getPageCache().get("registeredid"); + if (!StringUtils.isEmpty(globalSessionId)) { + this.getView().setVisible(Boolean.FALSE, new String[]{"btn_templogin", "link_login", "label_regist"}); + this.getView().setVisible(Boolean.TRUE, new String[]{"label_logintip", "btn_exit"}); + } else { + this.getView().setVisible(Boolean.TRUE, new String[]{"btn_templogin", "link_login", "label_regist"}); + this.getView().setVisible(Boolean.FALSE, new String[]{"label_logintip", "btn_exit"}); + } + + this.getView().getModel().setValue("showcontrol", key); + } else if ("reg".equals(key)) { + this.setHeadflexpanelBackgroundImg(true); + this.getView().setVisible(false, new String[]{"flexpanelap"}); + if (RegisteredUtils.isOldRegisterEnable()) { + this.openForm("resp_regpolicy", "resp_regpolicy", (Map)null); + } else { + this.openForm("resp_registered", "resp_registered", (Map)null); + } + } else if ("suplogin".equals(key)) { + this.getView().setVisible(false, new String[]{"flexpanelap"}); + this.setHeadflexpanelBackgroundImg(true); + this.openForm("resp_suplogin", "resp_suplogin", (Map)null); + } else if ("exit".equals(key)) { + this.getPageCache().put("registeredid", (String)null); + globalSessionId = RequestContext.get().getGlobalSessionId(); + CacheMCData.setAttribute(globalSessionId, "registeredid", ""); + CacheMCData.setAttribute(globalSessionId, "label_logintip", ""); + String mobilePhone = (String) CustomCacheUtil.getAttributes(globalSessionId); + if (StringUtils.isNotEmpty(mobilePhone)) { + String cacheKey = RequestContext.get().getAccountId() + "_" + mobilePhone; + String ipKey = cacheKey + "_ip"; + String appKey = cacheKey + "_app"; + String token = (String)CustomCacheUtil.getAttributes(cacheKey); + SessionManager.removeSession(token); + CustomCacheUtil.remove(ipKey); + CustomCacheUtil.remove(appKey); + } + + this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap"}); + this.getView().setVisible(Boolean.FALSE, new String[]{"panel_reg"}); + this.getView().getModel().setValue("showcontrol", "home"); + this.getView().setVisible(Boolean.TRUE, new String[]{"btn_templogin", "link_login", "label_regist"}); + this.getView().setVisible(Boolean.FALSE, new String[]{"label_logintip", "btn_exit"}); + } + + } + + private void openForm(String formId, String callBackFormId, Map resultMap) { + this.getPageCache().put(openPanelRegFlag, "true"); + Map map = new HashMap(); + map.put("formId", formId); + FormShowParameter para = FormShowParameter.createFormShowParameter(map); + para.setCustomParam("companyname", this.getPageCache().get("companyname")); + if (resultMap != null) { + para.setCustomParam("INFO_REGSUP", resultMap); + } + + OpenStyle openStyle = para.getOpenStyle(); + this.getView().setVisible(true, new String[]{"panel_reg"}); + openStyle.setTargetKey("panel_reg"); + openStyle.setShowType(ShowType.InContainer); + CloseCallBack callBack = new CloseCallBack(this, callBackFormId); + para.setCloseCallBack(callBack); + this.getView().showForm(para); + } + private void showLoginRegTipForm(String regTip) { FormShowParameter showParameter = new FormShowParameter(); showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); @@ -157,6 +249,13 @@ public class IndexEditNewPlugin extends IndexEditNew implements SearchEnterListe //插件类实现SearchEnterListener接口,才能注册 search.addEnterListener(this); + + for(int i = 0; i < this.lablekeys.length; ++i) { + this.addClickListeners(new String[]{this.lablekeys[i]}); + } + +// Container qeug_label_notification = (Container)this.getView().getControl("qeug_label_notification"); +// qeug_label_notification.addClickListener(this); } @Override