#
luxiaotao1123
2020-07-09 d109886022563627870ae251b95ba15082b8980f
#
2个文件已添加
1个文件已修改
133 ■■■■■ 已修改文件
src/main/java/com/zy/common/web/RouterController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pdaCe/index.html 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pdaCe/login.html 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/RouterController.java
@@ -46,4 +46,14 @@
        }
    }
    @RequestMapping("/pda/ce")
    public void pdaCe(HttpServletResponse response) {
        try{
            String redirect = Cools.isEmpty(applicationName)?"/views/pdaCe/login.html":"/"+applicationName+"/views/pdaCe/login.html";
            response.sendRedirect(redirect);
        } catch (Exception ex){
            ex.printStackTrace();
        }
    }
}
src/main/webapp/views/pdaCe/index.html
New file
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, target-densitydpi=high-dpi, initial-scale=1.0, user-scalable=no"/>
    <title>中扬物流</title>
    <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
</head>
<body>
    Hello World
<!--    <button onclick="her()">页面跳转</button>-->
</body>
<script>
    function her() {
        window.location.href="login.html";
    }
</script>
</html>
src/main/webapp/views/pdaCe/login.html
New file
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, target-densitydpi=high-dpi, initial-scale=1.0, user-scalable=no"/>
    <title>系统登录</title>
    <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
    <style>
        .login-form input {
            display: block;
        }
        .login-form button {
            display: block;
        }
    </style>
</head>
<body>
    <h1>中扬物流</h1>
    <div class="login-form">
        <div>
            <span>账号</span>
            <input type="text" id="mobile" value="super">
        </div>
        <div>
            <span>密码</span>
            <input type="password" id="password" value="xltys1995">
        </div>
        <div>
            <button onclick="login()">登录</button>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/js/tools/md5.js"></script>
<script type="text/javascript">
    function login(){
        httpRequest({
            httpUrl: baseUrl+"/login.action",
            type: 'post',
            data: {
                mobile: document.getElementById('mobile').value,
                password: hex_md5(document.getElementById('password').value)
            }
        }, function (res) {
            window.location.href = "index.html";
        })
    }
    function httpRequest(paramObj,fun,errFun) {
        var xmlhttp = null;
        /*创建XMLHttpRequest对象,
         *老版本的 Internet Explorer(IE5 和 IE6)使用 ActiveX 对象:new ActiveXObject("Microsoft.XMLHTTP")
         * */
        if(window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        }else if(window.ActiveXObject) {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        /*判断是否支持请求*/
        if(xmlhttp == null) {
            alert('你的浏览器不支持XMLHttp');
            return;
        }
        /*请求方式,并且转换为大写*/
        var httpType = (paramObj.type || 'GET').toUpperCase();
        /*数据类型*/
        var dataType = paramObj.dataType || 'json';
        /*请求接口*/
        var httpUrl = paramObj.httpUrl || '';
        /*是否异步请求*/
        var async = paramObj.async || true;
        /*请求参数--post请求参数格式为:foo=bar&lorem=ipsum*/
        var paramData = paramObj.data || [];
        var requestData = '';
        for(var name in paramData) {
            requestData += name + '='+ paramData[name] + '&';
        }
        requestData = requestData === '' ? '' : requestData.substring(0,requestData.length - 1);
        /*请求接收*/
        xmlhttp.onreadystatechange = function() {
            if(xmlhttp.readyState === 4 && xmlhttp.status === 200) {
                /*成功回调函数*/
                fun(JSON.parse(xmlhttp.responseText));
            }else{
                /*失败回调函数*/
                errFun;
            }
        }
        /*接口连接,先判断连接类型是post还是get*/
        if(httpType === 'GET') {
            xmlhttp.open("GET",httpUrl,async);
            xmlhttp.send(null);
        }else if(httpType === 'POST'){
            xmlhttp.open("POST",httpUrl,async);
            //发送合适的请求头信息
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.send(requestData);
        }
    }
</script>
</html>