passport = new Object(); passport.siteRootURL = "http://www.kbl-shop.cn/__passport/"; passport.appID = 0; passport.User = function(instanceNameString, loginStatusHtmlContainerID) { this.instanceNameString = instanceNameString; this.loginStatusHtmlContainerID = loginStatusHtmlContainerID; this.visitorID = 0; this.userID = 0; this.userName = null; this.isLogin = false; this.authString = null; /*是否用弹出面板登录*/ this.isLoginInPopPanel = false; /*获取用户状态HTML*/ this.getStatusHtml = function() { var html = ""; var returnURL = document.URL; if (this.isLogin) { html += ''; html += '您好!' + this.userName + ''; html += '退出'; html += '|我的帐户'; html += '|订单查询'; html += ''; } else { if (this.userName != null) { html += ''; //html += '您好!' + this.userName + ''; if (this.isLoginInPopPanel) { html += '您还未登录'; } else { html += '您还未登录'; } html += '新注册'; html += '|我的帐户'; html += '|订单查询'; html += ''; } else { html += ''; html += '注册'; if (this.isLoginInPopPanel) { html += '您还未登录'; } else { html += '您还未登录'; } html += '|我的帐户'; html += '|订单查询'; html += ''; } } /*自动跳转同步登录状态*/; var sysLoginStatusInIframeURL = '/_sso/passport-access.aspx?passportaction=syn-login-status'; html += ''; return html; }; /*写用户状态HTML*/ this.writeStatusHtml = function(htmlContainerID) { this.loginStatusHtmlContainerID = htmlContainerID; document.write(this.getStatusHtml()); }; this.callbackJS = ""; /*检查是否登录,如果没有登录则显示登录框或者提示登录*/ this.checkLoginStatus = function(callbackJS) { this.callbackJS = callbackJS; var obj = document.createElement("div"); obj.style.display = "none"; var sysLoginStatusInIframeURL = '/_sso/passport-access.aspx?passportaction=syn-login-status'; obj.innerHTML = ''; document.body.appendChild(obj); }; /*显示登录面板*/ this.showLoginPanel = function() { cn.liusoft.importJS("cn.liusoft.dom.window"); cn.liusoft.dom.window.Mask.show(null,null,"#000",60); var loginInIframeURL = passport.siteRootURL + 'login-in-iframe.aspx?appid='+passport.appID+'&topurl='+encodeURIComponent(window.top.location.href); var html = ''; html += '
'; html += '
'; html += '
登录通行证
'; html += ''; html += '
'; html += '
'; html += ''; html += '
'; html += '
'; if(document.all) { cn.liusoft.dom.window.Dialog.show("login-in-iframe-panel_dialogID", html, "login-in-iframe-panel_dialogControlPointID",100); } else { cn.liusoft.dom.window.Dialog.show(null, html, null,100); } this.addOnLoginCompletedListener(this.instanceNameString + ".closeLoginDialog();"); }; /*关闭登录对话框*/ this.closeLoginDialog = function() { if(document.all) { cn.liusoft.dom.window.Dialog.hide("login-in-iframe-panel_dialogID"); } else { cn.liusoft.dom.window.Dialog.hide(); } cn.liusoft.dom.window.Mask.hide(); }; this.loginInIframeComplete = function(currentUser) { this.isLogin = currentUser.isLogin; this.visitorID = currentUser.visitorID; this.userID = currentUser.userID; this.userName = currentUser.userName; document.getElementById(this.loginStatusHtmlContainerID).innerHTML = this.getStatusHtml(); this.onLoginCompleted(); }; /*登录成功后要处理的函数列表*/ this.onLoginCompletedListeners = new Array(); /*添加登录成功后要处理的函数*/ this.addOnLoginCompletedListener = function(listener) { this.onLoginCompletedListeners[this.onLoginCompletedListeners.length] = listener; }; /*执行登录成功后要处理的函数*/ this.onLoginCompleted = function() { for(var i=0;i