Commit 7e57430a by 宋祥

Merge branch 'dev-sx' of http://129.211.46.84:8800/platform/hg-smart into dev

parents 7f07fd39 94917747
$(function () {
// 登录页加载完成时,进行浏览器版本检测
window.onload = function () {
var BROWSER_VERSION = 9;
var browser = (function () {
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE ' + (tem[1] || '');
}
if (M[1] === 'Chrome') {
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]);
return M.join(' ');
})();
var BrowserVersion = browser.split(" ");
if ((/^(MS)?( )?IE/).test(browser) && BrowserVersion[1] < BROWSER_VERSION) {
$(".warning-window").css("display", "block");
$(".i-overlay").css("display", "block");
}
if ((/^(MS)?( )?IE/).test(browser) && BrowserVersion[1] < BROWSER_VERSION - 1) {
$("#login").attr("disabled", true);
}
// 触发登录操作
loginClick();
};
$(".i-close").on("click", function () {
$(".warning-window").css("display", "none");
$(".i-overlay").css("display", "none");
});
//放大镜
$(".i-zoom-close").on("click", function () {
$(".zoom-window").css("display", "none");
$(".i-overlay").css("display", "none");
});
$(".info-detail").on("click", function () {
$(".zoom-window").css("display", "block");
$(".i-overlay").css("display", "block");
});
$.fn.textScroll = function (options) {
var defaults = {
duration: 8000,//滚动总时长控制
mode: 'normal',//滚动模式:普通normal;逐行line
perDistance: 18//line模式下每次滚动距离
},
that = this,
scrollInterval,
content = this.find(".text-content");
var items = $.extend({}, defaults, options);
//添加占位元素,处理无法滚动到底的情况
function addHoldDiv(stage, textContent) {
if (items.mode === 'no-gap') {
that.append(content.clone().addClass("second-text"));
} else {
var holdDiv = "<div class='hold-scroll'></div>";
stage.append(holdDiv);
var divHeight = stage.height() + textContent.height();
$(".hold-scroll").css({"width": "100%", "height": divHeight, "color": "transparent"});
}
}
//根据不同模式添加动画
function addAnimate() {
if (items.mode === 'normal' || items.mode === 'no-gap') {
var scrollPercent = that.scrollTop() / content.outerHeight(true);
if (that.scrollTop() === 0) {
that.animate({scrollTop: '0'}, 1000);
}
that.animate({scrollTop: content.outerHeight(true)}, Math.round(items.duration * (1 - scrollPercent)), "linear");
that.animate({scrollTop: '0'}, 0, arguments.callee);
} else if (items.mode === 'line') {
var times = Math.ceil(content.outerHeight(true) / items.perDistance);
scrollInterval = setInterval(function () {
if (content.outerHeight(true) - that.scrollTop() <= 0) {
that.animate({scrollTop: 0}, 0);
} else {
that.animate({scrollTop: that.scrollTop() + items.perDistance}, 0);
}
}, Math.round(items.duration / times));
}
}
addHoldDiv(that, content);
that.niceScroll({
'autohidemode': 'false'
});
that.mouseenter(function () {
if (items.mode === 'normal' || items.mode === 'no-gap') {
that.stop(true);
} else if (items.mode === 'line') {
clearInterval(scrollInterval);
}
that.getNiceScroll().show();
});
that.mouseleave(function (e) {
var targetElement = $(e.toElement);
if (targetElement.hasClass("nicescroll-rails-vr") || targetElement.hasClass("nicescroll-cursors")) {
targetElement.one("mouseleave", function (e) {
if ($(e.toElement) !== that && !$(e.toElement).hasClass("nicescroll-rails-vr")) {
that.getNiceScroll().hide();
addAnimate();
}
});
} else if (!targetElement.hasClass("nicescroll-rails-vr") && !targetElement.hasClass("nicescroll-cursors")) {
that.getNiceScroll().hide();
addAnimate();
}
});
that.mouseleave();
};
loginClick = function () {
var loginForm = document.getElementsByTagName("form")[0];
var urlParam = location.href.substr(location.href.indexOf("?") + 1);
if (urlParam.indexOf("p_redirect") !== -1) {
var keyString = urlParam.split('=')[0];
var valueString =urlParam.split('=')[1];
if (keyString === "p_redirect") {
var tmpInput = document.createElement("input");
tmpInput.type = "hidden";
tmpInput.name = "p_redirect";
tmpInput.value = valueString;
loginForm.appendChild(tmpInput);
}
}
// 将密码框的值修改为加密后的值
var loginPublicKey = $("#__LOGIN_PUBLICKEY__").val();
if(isAvailable(loginPublicKey)){
var encrypt = new JSEncrypt();
encrypt.setPublicKey(loginPublicKey);
var encryptedUsername = encrypt.encrypt($("input[name='p_username1']").val());
$("input[name='p_username']").val(encryptedUsername);
var encryptedPassword = encrypt.encrypt($("input[name='p_password1']").val());
$("input[name='p_password']").val(encryptedPassword);
}
loginForm.submit();
};
//判断是否值能获取的方法
function isAvailable(obj) {
if (obj === undefined) {
return false;
}
if (obj === null) {
return false;
}
if (obj === "null") {
return false;
}
return obj !== "";
}
function getParameterByName(name, url) {
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) {
return null;
}
if (!results[2]) {
return null;
}
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
});
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.baosight.iplat4j.common.constant.RSAConstants" %>
<%@ page import="com.baosight.iplat4j.core.FrameworkInfo" %>
<%@ page import="com.baosight.iplat4j.core.license.LicenseStub" %>
<%@ page import="com.baosight.iplat4j.core.log.Logger" %>
<%@ page import="com.baosight.iplat4j.core.log.LoggerFactory" %>
<%@ page import="com.baosight.iplat4j.core.util.StringUtils" %>
<%@ page import="java.net.URLDecoder" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%
org.springframework.security.core.context.SecurityContextHolder.clearContext();
LicenseStub.setLicenseDir(application.getRealPath("/WEB-INF"));
String[] ret = LicenseStub.checkLicense2();
boolean valid = "true".equals(ret[0]); //LicenseStub.checkLicense2();
int days = 0;
if (!"".equals(ret[2]) && !"0".equals(ret[2])) {
days = Integer.parseInt(ret[2]);
}
String licMsg = valid ? (("false".equals(ret[3]) && days >= -10 && days < 0) ?
"<div style='color:#ee9933;font-weight:bold;font-size:18px'>许可证还有[" + (-days) + "]天将过期!</div>"
: "")
: "<div style='color:red;font-weight:bold;font-size:22px'>许可证非法!</div>";
Exception exp = (Exception) request.getAttribute("AuthenticationException");
String user = (String) request.getAttribute("AuthenticationUser");
if (!org.springframework.util.StringUtils.isEmpty(request.getParameter("expmsg"))) {
String expmsg = request.getParameter("expmsg");
exp = new Exception(URLDecoder.decode("Exception:" + expmsg));
}
String loginErrTag = "0";
if (!org.springframework.util.StringUtils.isEmpty(request.getParameter("login_error"))) {
loginErrTag = request.getParameter("login_error");
}
String username = "";
String password = "";
String captcha = "";
if (exp != null) {
username = user;
}
String usrHeader = request.getHeader("user-agent");
String projectCname = FrameworkInfo.getProjectCname();
String projectTypeDesc = FrameworkInfo.getProjectTypeDesc();
// 获取iPlatUI静态资源地址
String iPlatStaticURL = FrameworkInfo.getPlatStaticURL(request);
String theme = "ant";
// 获取Context根路径,考虑到分布式部署的场景,不能直接使用WebContext
String iPlatContext = FrameworkInfo.getPlatWebContext(request);
//读取加密配置,以及公钥
String loginPublicKey = "";
if ("on".equals(RSAConstants.cryptoPasswordEnable)) {
loginPublicKey = RSAConstants.loginRsaPublicKey;
}
final Logger logger = LoggerFactory.getLogger("index");
String LoginLogo = "default";
String LoginSystemName = "";
%>
<c:set var="ctx" value="<%=iPlatContext%>"/>
<c:set var="iPlatStaticURL" value="<%=iPlatStaticURL%>"/>
<c:set var="loginExp" value="<%=exp%>"/>
<c:set var="theme" value="<%=theme%>" scope="session"/>
<c:set var="LoginLogo" value="<%=LoginLogo%>"/>
<c:set var="LoginSystemName" value="<%=LoginLogo%>"/>
<html class="i-theme-blue">
<head>
<meta charset="utf-8"/>
<meta name="robots" content="noindex, nofollow"/>
<meta name="description" content="登录界面"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<% if (StringUtils.isNotEmpty(projectCname) && StringUtils.isNotEmpty(projectTypeDesc)) { %>
<title><%=projectCname%>[<%=projectTypeDesc%>]登录界面</title>
<% } else { %>
<title>登录界面</title>
<% } %>
<link rel="shortcut icon" href="iplat.ico" type="image/x-icon">
<link rel="stylesheet" id="css-main" href="${iPlatStaticURL}/iplatui/assets/css/iplat.ui.bootstrap.min.css">
<link href="${iPlatStaticURL}/iPlatV7-login.css" rel="stylesheet" type="text/css"/>
<%--<link rel="stylesheet" type="text/css" href="${iPlatStaticURL}/iplatui/css/iplat.ui.ued.login.css">&lt;%&ndash;ued亮色样式&ndash;%&gt;--%>
<script src="${iPlatStaticURL}/kendoui/js/jquery.min.js"></script>
<!--[if lte IE 8]>
<link href="${iPlatStaticURL}/iPlatV7-login-ie.css" rel="stylesheet" type="text/css"/>
<script src="${iPlatStaticURL}/iplatui/assets/js/polyfills/iplat.ui.ie8.polyfills.min.js"></script>
<![endif]-->
<script src="${iPlatStaticURL}/auto-login.js"></script>
<%--引入RSA加密js--%>
<script src="${iPlatStaticURL}/iplatui/js/jsencrypt.js"></script>
<%
String domain = FrameworkInfo.getProjectAppTopDomain();
if (domain != null && domain.startsWith(".")) {
domain = domain.substring(1);
%>
<script type="text/javascript">
try {
document.domain = '<%=domain%>';
} catch (ex) {
alert('model not valid[<%=domain%>]');
}
</script>
<%
}
%>
</head>
<body class="i-theme-${theme}" style="display: none;">
<div class="main">
<div class="wrapper">
<div class="content overflow-hidden">
<div class="row">
<%--公钥参数--%>
<input id="__LOGIN_PUBLICKEY__" inline="true" type="hidden" value="<%=loginPublicKey%>"/>
<div class="col-sm-6 col-sm-offset-2 col-md-4 col-md-offset-4" style="margin-bottom: 1em">
<div class="form-header">
<p style="font-size: 28px;"><b>企业经营一体化平台</b></p>
</div>
</div>
<div class="col-sm-6 col-sm-offset-2 col-md-4 col-md-offset-4">
<div class="login-block <c:if test="${not empty loginExp}"> animated shake</c:if>"
style="background-color: white;border-radius: 10px">
<div class="form-header">
<c:choose>
<c:when test="${LoginLogo == 'default'}">
<div class=""> <%--logodefault--%>
<div style="color: #004B9D;margin-left: 63%"><%=LoginSystemName%>
</div>
</div>
</c:when>
<c:otherwise>
<div class="logo">
<img src="<%=LoginLogo%>" style="float: left;height: 43px">
<div style=" width: 2px;height: 43px;background-color: rgba(28, 29, 35, 0.04);float: left;margin-left: 10px;margin-right: 10px"></div>
<img src="iplatui/img/login/bld_logo.png"
style="float: left;width: 90px;height: 43px;">
<div style="color: #004B9D;margin-left: 58%"><%=LoginSystemName%>
</div>
</div>
</c:otherwise>
</c:choose>
<p style="font-size: 20px;color: black;">用户登录</p>
<p class="text-danger">
<c:if test="${not empty loginExp}">
<%
String loginError = exp.getMessage();
int index = loginError.indexOf("Exception:");
if (index >= 0) {
loginError = loginError.substring(index + 10);
}
if (!"1".equals(loginErrTag) &&
(request.getAttribute("AuthenticationUser") == null
|| request.getAttribute("AuthenticationUser") == "")) {
loginError = "请输入用户名";
}
%>
<%=loginError%>
</c:if>
</p>
</div>
<form autocomplete="off" class="form-horizontal push-10-t push-10" action="${ctx}/login"
method="post" onsubmit="javascript:return loginClick();">
<div class="form-group">
<div class="col-xs-12">
<div class="input-group">
<div class="input-group-addon" style="background-color: rgb(232, 240, 254)">
账号
</div>
<input class="form-input" type="text"
style="border: rgb(232, 240, 254);background-color: rgb(232, 240, 254);color: black"
value="YG5918"
name="p_username1" placeholder="用户名"/>
</div>
</div>
</div>
<div class="form-group password">
<div class="col-xs-12">
<div class="input-group">
<div class="input-group-addon" style="background-color: rgb(232, 240, 254)">
密码
</div>
<input class="form-input" type="password"
style="border: rgb(232, 240, 254);background-color: rgb(232, 240, 254);color: black"
value="Easy160731!"
name="p_password1" autocomplete="off" placeholder="密码"/>
</div>
</div>
</div>
<input type="text" name="p_username" placeholder="用户名" style=""/>
<input type="password" name="p_password" autocomplete="off" placeholder="密码" style=""/>
<div class="form-group remember">
<div class="col-xs-6">
<%--<label class="css-input">--%>
<%--<input type="checkbox" id="login-remember-me" value="false"--%>
<%--name="remember-me"/><span class="i-icon"></span>--%>
<%--2周内免登录--%>
<%--</label>--%>
<%--<a href="${ctx}/web/XS0102">注册账号</a>--%>
</div>
<div class="col-xs-6" style="text-align: right">
<%--<a href="${ctx}/web/XS0102" style="margin-right: 6px">注册</a>--%>
<%--<a href="${ctx}/web/XS0106">忘记密码?</a>--%>
</div>
</div>
<div class="form-group log-in">
<div class="col-xs-12">
<button id="login" class="login-btn" type="submit">登录
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="i-overlay"></div>
</body>
<script type="text/javascript">
var ctx = "${ctx}";
</script>
</html>
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
%> %>
<% <%
String pAuthen = request.getParameter("p_authen");
String directmode = request.getParameter("maintain") != null ? request.getParameter("maintain").toString() : ""; String directmode = request.getParameter("maintain") != null ? request.getParameter("maintain").toString() : "";
RequestDispatcher rd; RequestDispatcher rd;
String appName = FrameworkInfo.getProjectAppName(); String appName = FrameworkInfo.getProjectAppName();
...@@ -95,17 +94,6 @@ ...@@ -95,17 +94,6 @@
} else { } else {
response.sendRedirect(request.getContextPath() + _urlHtml); response.sendRedirect(request.getContextPath() + _urlHtml);
} }
} else if ("Trust".equals(pAuthen)) {
// 自动登录
rd = request.getRequestDispatcher("auto-login.jsp");
try {
rd.forward(request, response);
} catch (ServletException e1) {
e1.printStackTrace();
} finally {
out.clear();
out = pageContext.pushBody();
}
} else { } else {
//以正常方式进入登录首页 //以正常方式进入登录首页
rd = request.getRequestDispatcher("iPlatV7-login.jsp"); rd = request.getRequestDispatcher("iPlatV7-login.jsp");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment