<!DOCTYPE html><!--河职院-->
<html xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1">
    <meta content="" name="Keywords">
    <meta name="description" content="">
    <link rel="icon" type="image/x-icon" href="/favicon.ico">
    <script src="/static/oauth/jquery/jquery-min.js"></script>
    <script src="/static/oauth/jquery/jQuery.md5.js"></script>
    <script src="/static/oauth/jquery/navoverall.js"></script>
    <script src="/static/oauth/commons/js/aes/core.js"></script>
    <script src="/static/oauth/commons/js/aes/md5.js"></script>
    <script src="/static/oauth/commons/js/aes/evpkdf.js"></script>
    <script src="/static/oauth/commons/js/aes/enc-base64.js"></script>
    <script src="/static/oauth/commons/js/aes/cipher-core.js"></script>
    <script src="/static/oauth/commons/js/aes/aes.js"></script>
    <script src="/static/oauth/commons/js/aes/hmac.js"></script>
    <script src="/static/oauth/commons/js/aes/sha1.js"></script>
    <script src="/static/oauth/commons/js/aes/sha256.js"></script>
    <script src="/static/oauth/wework/js/wwLogin-1.2.4.js"></script>
    <script src="/static/oauth/wework/js/wxLogin.js"></script>
    <script src="/static/oauth/commons/bootstrap/bootstrap.min.js"></script>
    <link href="/static/oauth/commons/font-icon/iconfont.css" type="text/css" rel="stylesheet"/>
    <link href="/static/oauth/commons/css/login_v1.css" type="text/css" rel="stylesheet"/>
    <title></title>
    <style>
        #login-navigation {
            height: 81px;
        }
    </style>
    <script type="text/javascript">

        VIEW = 'login';

        function Encrypt(word) {
            var key = CryptoJS.enc.Utf8.parse("c2A89L6DkTAFysjy");  //十六位十六进制数作为密钥
            var iv = CryptoJS.enc.Utf8.parse('dMitHORyqbeYVE0o');
            var srcs = CryptoJS.enc.Utf8.parse(word);
            var encrypted = CryptoJS.AES.encrypt(srcs, key, {
                iv: iv,
                mode: CryptoJS.mode.CBC,
                padding: CryptoJS.pad.Pkcs7
            });
            return encrypted.toString();
        }

        function loginSubmit() {
            localStorage.clear();
            var encPwd = Encrypt($("#userpwd").val())
            var username = $("#username").val(),
                userpwd = encPwd,
                code = $("#verifcation_code_2").val();
            if (!username && !userpwd) {
                $("#error-message").html('<div id="msg">账号，密码不能为空</div>').show();
                return;
            }
            if (!username) {
                $("#error-message").html('<div id="msg">账号不能为空</div>').show();
                return;
            }
            ;
            if (!userpwd) {
                $("#error-message").html('<div id="msg">密码不能为空</div>').show();
                return;
            }
            ;
            if (window.verifcationCode && !code) {
                $("#error-message").html('<div id="msg">验证码不能为空</div>').show();
                return;
            }
            $.ajax({
                type: "post",
                url: "/sso/api/verify",
                dataType: "json",
                data: {
                    "username": $.trim(username),
                    "userpwd": $.trim(userpwd),
                    "verifcationCode": window.verifcationCode ? $.trim(code) : ""
                },
                success: function (result) {
                    if (result.code == 0) {
                        $("#userpwd").val(encPwd);
                        $('form#formid').submit();
                    } else {
                        if (result.code == 100) {
                            window.verifcationCode = true;
                            $("#code_img_2").attr("src", "/sso/api/validateCode?t=" + new Date().getTime());
                            $("#verifcation_code_2").val('');
                            $("#userpwd").val('');
                            $("#login_code_img_container").show();
                        }
                        if (result.code == 40040) {
                            $("#verifcation_code_2").val('');
                        }
                        $("#msg").hide();
                        $("#error-message").html('<div id="msg">' + result.msg + '</div>').show();
                        $("#error-message").show();
                        $("#msg").fadeOut(5000);
                        return;
                    }
                },
                error: function () {
                    $("#msg").hide();
                    $("#error-message").html('<div id="msg">网络异常,请联系管理员</div>');
                    $("#error-message").show();
                    $("#msg").fadeOut(5000);
                    return;
                }
            });
        };
        // $(document).keyup(function(event){
        //   if(event.keyCode ==13){
        //      loginSubmit()
        //   }
        // });
    </script>


</head>
<body>
<div id="banner">
    <div class="BackgSwitc" style="height: 100%;">
        <video id="video" width="100%" autoplay loop="loop" requestFullscreen>
            <!-- <source src="commons/images/logobg.ogg" type="video/ogg"> commons/images/logobg.mp4 -->
            <source src="" type="video/mp4">
        </video>
    </div>
    <div class="box">
        <div id="login-navigation" class="type-area">
            <div class="logo clearfix">
                <img src="" alt="" style="width: auto;height: 65px">
                <span class="logo-grade"></span>
            </div>
            <ul class="container clearfix" hidden>
                <li>
                    <a href="javascript:;" target="_blank">官方网站</a>
                </li>
                <li>
                    <a href="javascript:;" target="_blank">应用市场</a>
                </li>
                <li>
                    <a href="javascript:;" target="_blank">开发文档</a>
                </li>
                <li>
                    <a href="javascript:;" target="_blank">数据智脑</a>
                </li>
            </ul>
        </div>
        <div id="login-main" class="type-area">
            <div class="banner-text">
                <!-- 字体改成图片 -->
                <div class="text">
                    <ul>
                        <li>
                            <div class="big-text">
                                <span class="Chinese"></span>
                                <span class="English"></span>
                            </div>
                            <p class="small-text"></p>
                        </li>

                    </ul>
                </div>
            </div>
            <div class="container-logintext" style="display: flex;width: 570px;align-items: center;">
                <div class="login-form">
                    <div class="form-title" style="margin-top:-25px;">
                        <ul id="tab-account" class="tab-account">
                            <li class="current" style="width: 100%;">
                                <a class="active userLogin" href="#" title="login-account">用户登录</a>
                            </li>
                            <!--<li>-->
                            <!--<a href="#" title="login-scan-code-ww" class="codeLogin">企业微信扫码登录</a>-->
                            <!--</li>-->
                        </ul>
                        <p id="tab-phone" style="display: none"><a class="loginPhone" href="javascript:;">手机快捷登录</a></p>
                    </div>
                    <div id="fm1" name="fm1" action="" method="">
                        <div id="error-message" class="eer"></div>
                        <div id="login-account" class="item show">
                            <form id="formid" class="formid" action="/sso/login" method="post">
                                <div class="input-k"><i class="iconfont icon-touxiang">
                                </i> <i class="line"></i><input type="text" placeholder="请输入工号或学号" id='username'
                                                                name="username"/>
                                </div>
                                <div class="input-k"><label> <i class="iconfont icon-suo"></i> <i class="line"></i>
                                    <input type="password" placeholder="请输入密码" id='userpwd' name="userpwd"/> </label>
                                </div>
                                <div class="input-k" style="display: none" id="login_code_img_container">
                                    <label>
                                        <input type="text" placeholder="请输入验证码" id="verifcation_code_2"
                                               style="width: 115px;">
                                        <img src="" id="code_img_2" style="margin-bottom: 4px">
                                        <img src="/static/oauth/commons/images/code_refresh.png" alt="" id="code_refresh_2">
                                    </label>
                                </div>
                                <div class="qita-g"><input class="login-submit" value="登录" type="button"
                                                           onclick="loginSubmit()"/></div>
                            </form>
                            <div class="logon-type">
                                <a class="link" href="https://we.hnzj.edu.cn/active/actiteIndex.html" target="_blank">账号激活</a>
                                <span>|</span>
                                <a class="link" href="https://we.hnzj.edu.cn/active/findBackPasswork.html"
                                   target="_blank">忘记密码</a>
                                <span class="user_agreement" style="display: none">查看用户协议</span>
                            </div>
                            <div style=" text-align: left; color: #333; width: 300px;">各位师生，学校信息门户升级，首次登录请点击上方“账号激活”操作
                            </div>
                        </div>
                        <!-- 手机登录 -->
                        <form id="phone_formid" class="formid" action="/sso/login" method="post">
                            <div id="login-phone" class="item" style="display: none">
                                <div class="input-k">
                                    <i class="iconfont icon-shouji"></i>
                                    <i class="line"></i>
                                    <input id="phone" name="username" type="text" placeholder="手机号"/>
                                </div>
                                <div class="input-k">
                                    <i class="iconfont icon-yanzhengma"></i>
                                    <i class="line"></i>
                                    <input type="text" placeholder="请输入" id="verifcation_code" style="width: 116px">
                                    <img src="" id="code_img" style="margin-bottom: 5px;">
                                </div>
                                <div class="input-k">
                                    <i class="iconfont icon-yanzhengma"></i>
                                    <i class="line"></i>
                                    <input id="form_code" name="userpwd" placeholder="验证码" type="hidden"/>
                                    <input id="code" placeholder="验证码" type="text"/>
                                    <span class="send-message">发送验证码</span>
                                    <span class="wait_code"
                                          style="display:none; color: #219afe; margin: 0 24px;"></span>
                                </div>
                                <div class="qita-g">
                                    <input type="button" class="login-submit" id="phone-submit" value="登 录"/>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div>
                    <!-- 微信扫一扫登录 -->
                    <div id="login-scan-code-wx"
                         style='position: relative;max-height: 160px;overflow: hidden;    margin-left: -55px;'>
                        <!--<img src="/commons/images/jqerma.jpg" alt="">-->
                        <img src="" alt="">
                        <p>扫一扫登录</p>
                        <div class='code_back'
                             style='display:none;width: 76%;height: 100%;position: absolute;left: 34px;top: 0;background: rgba(0, 0, 0, 0.50);'>
                            <p style='margin-top: 50px;color: #fff;font-size: 22px;font-family: "微软雅黑";font-weight: 500;'></p>
                            <span click=''
                                  style='display: inline-block;color: #fff;background: #1f95ff; padding: 7px 35px;margin-top: 30px; border-radius: 3px;letter-spacing: 5px;font-size: 16px'>刷新</span>
                        </div>
                    </div>
                    <!-- 企业微信扫一扫登录 -->
                    <div id="login-scan-code-ww" 
                         style='position: relative;max-height: 160px;overflow: hidden;margin-left: -55px;margin-top: 20px;'>
                        <!--<img src="/commons/images/jqerma.jpg" alt="">-->
                        <img src="" alt="">
                        <p>扫一扫登录</p>
                        <div class='code_back'
                             style='display:none;width: 76%;height: 100%;position: absolute;left: 34px;top: 0;background: rgba(0, 0, 0, 0.50);'>
                            <p style='margin-top: 50px;color: #fff;font-size: 22px;font-family: "微软雅黑";font-weight: 500;'></p>
                            <span click=''
                                  style='display: inline-block;color: #fff;background: #1f95ff; padding: 7px 35px;margin-top: 30px; border-radius: 3px;letter-spacing: 5px;font-size: 16px'>刷新</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <style>
        .verification-code {
            width: 269px;
            height: 200px;
            margin: 0 auto;
            background: #fff;
            text-align: center;
            border-radius: 5px;
            position: absolute;
            left: 780px;
            top: 284px;
            right: 0;
        }

        html, body, .verification-code-mask {
            height: 100%;
        }

        .verification-code-mask {
            background: #04040480;
            filter: alpha(opacity=151);
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
        }

        h5 {
            margin: 18px auto;
            font-size: 16px;
            color: #333333;
        }

        .ipt-code-refresh {
            overflow: hidden;
            padding: 0 21px;
            margin-top: 25px;
        }

        .ipt-code:hover {
            border: 1px solid #1f95ff;
        }

        .ipt-code {
            float: left;
            width: 83%;
            height: 40px;
            overflow: hidden;
            border: 1px solid #a5a5a5;
            border-radius: 25px;
            position: relative;
        }

        .code_actives {
            border: 1px solid #1f95ff;
        }

        .ipt-code input {
            outline: none;
            border: navajowhite;
            width: 100%;
            line-height: 40px;
            text-indent: 23px;
            background: #fff;
        }

        .ipt-code img {
            position: absolute;
            display: block;
            background: #999;
            width: 90px;
            height: 100%;
            right: 0;
            top: 0;
        }

        .refresh, .code_refresh {
            line-height: 40px;
            cursor: pointer;
        }

        .code_refresh img {
            margin-left: 10px;
        }

        .close {
            position: absolute;
            right: -22px;
            top: -27px;
            display: block;
            width: 20px;
            height: 19px;
            text-align: center;
        }

        .btn {
            width: 82%;
            display: block;
            padding: 13px 0;
            color: #fff;
            background: #1f95ff;
            margin: 25px auto;
            border-radius: 25px;
            font-size: 16px;
        }

        .tip {
            color: red;
            text-align: left;
            padding: 0 28px;
            margin-top: 10px;
            display: none;
            position: absolute;
            top: 32px;
        }

        #verifcation_code::-moz-placeholder {
            color: #bababa;
        }

        #verifcation_code::-webkit-input-placeholder {
            color: #bababa;
        }

        #verifcation_code::-ms-input-placeholder {
            color: #bababa;
        }
    </style>
</div>
<footer id="footer">
    <div class="content type-area">
        <cite></cite>
        <br>
        <span></span>
        <a href="#" target="_blank" style="color: #fff;">技术支持：深圳市云尚教育科技有限公司</a>
    </div>
</footer>
<div class="modal fade" tabindex="-1" role="dialog" id="user_protocol">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h2 class="modal-title">许可及服务协议</h2>
            </div>
            <div class="modal-body">
                <h4>一 用户须知</h4>
                <p>1.1 学校是处理通过本网站（简称“网站”）收集的所有个人信息的管理者。学校尊重您的隐私，遵照中华人民共和国相关处理网络个人信息的规定来处理您的信息。</p>
                <p>1.2 本声明将介绍我们如何处理通过网站收集的所有个人信息，以及访问和更正这些个人信息的权利。</p>
                <p>1.3 学校享有变更本声明的权利，这些变更信息在更改的声明发布时立即生效。建议您定期阅读声明，了解声明变更的情况。</p>
                <p>1.4 若不同意本协议内容，请停止填写信息行为。</p>
                <h4>二 个人信息的范围和收集</h4>
                <p>2.1 服务，优化并丰富您的用户体验，这些个人信息系能够单独或者与其他信息结合识别您的个人身份的信息，包括：</p>
                <p>2.1.1 姓名</p>
                <p>2.1.2 移动电话</p>
                <p>2.1.3 您在网站的表格上输入的其他信息（电子邮箱、职工号、学生号、住址等）</p>
                <p>2.1.4 在您上载到网站的内容中包含的任何个人信息</p>
                <p>2.2 以上个人信息均是您自愿提供。您有权拒绝提供，但如果您拒绝提供某些个人信息，您将可能无法使用我们提供的产品、服务，或者可能对您使用产品或服务造成一定的影响。</p>
                <p>2.3 对于不满 18 岁的用户，须在其法定监护人已经阅读本声明并且许可的情况下，通过网站提交个人信息。</p>
                <h4>三 个人信息的使用和披露</h4>
                <p>3.1 您同意，学校可以通过以下方式对个人信息进行使用和披露（包含对于个人信息的存储和处理）：</p>
                <p>3.1.1 我们自行使用；</p>
                <p>3.1.2 我们向关联公司（包括但不限于学校等）披露并由其使用；</p>
                <p>3.1.3 我们及关联公司会定期或不定期向您发送有关产品、服务或相关活动的信息，您同意接收上述信息。</p>
                <p>3.2 您同意免除上述个人信息的接收和/或使用方在按照本法律声明所述情形下进行信息披露和使用而导致的或可能导致的所有索赔、责任和损失。</p>
                <h4>四 更正或投诉</h4>
                <p>4.1 如果您需要查询、修改或更正您的个人信息，或对个人信息保护问题有任何疑问或投诉，您可以周一至周日（ 9:00 – 21:00）联系我们。</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">已阅读</button>
                <!-- <button type="button" class="btn btn-primary">Save changes</button> -->
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<script type="text/javascript">
    $(document).ready(function () {
        localStorage.clear();
        var submitBool = false;
        //获取二维码
        $(".code_back").hide();
        scanCode();
        wxScanCode();
        $("#username").focus();
        $("#code_refresh_2,#code_img_2").click(function (e) {
            $("#code_img_2").attr("src", "/sso/api/validateCode?t=" + new Date().getTime());
        });
        if (!placeholderSupport()) {
            var iptuser = $("input#username");
            iptuser.val("请输入账号").css("color", "#b7bdc7");
            iptuser.on("click", function () {
                $(this).val("");
            });
            iptuser.blur(function () {
                if ($(this).val() == "") {
                    $(this).val("请输入账号").css("color", "#b7bdc7");
                }
            });
            var iptpass = $("input#userpwd");
            iptpass.val("请输入密码").css("color", "#b7bdc7");
            iptpass.on("click", function () {
                $(this).val("");
            });
            iptpass.blur(function () {
                if ($(this).val() == "") {
                    $(this).val("请输入密码").css("color", "#b7bdc7");
                }
            });
            var iptphone = $("input#phone");
            iptphone.val("请输入手机号码").css("color", "#b7bdc7");
            iptphone.on("click", function () {
                $(this).val("");
            });
            iptphone.blur(function () {
                if ($(this).val() == "") {
                    $(this).val("请输入手机号码").css("color", "#b7bdc7");
                }
            });
            var iptcode = $("input#code");
            iptcode.val("验证码").css("color", "#b7bdc7");
            iptcode.on("click", function () {
                $(this).val("");
            });
            iptcode.blur(function () {
                if ($(this).val() == "") {
                    $(this).val("验证码").css("color", "#b7bdc7");
                }
            });
        }


        // 兼容IE9下的placeholder
        function placeholderSupport() {
            return 'placeholder' in document.createElement('input');
        };
        var _detrat, _time;

        function detract() {
            _time;
            $('.wait_code').html(_time + 's');
            settime(_time)
        };

        function settime(_time) {
            var count = _time;
            var timer = null;
            timer = setInterval(function () {
                if (count > 0) {
                    count = count - 1;
                    $('.wait_code').html(count + 's');
                } else {
                    clearInterval(timer);
                    $('.send-message').html('重新发送验证码');
                }
            }, 1000);
        };

        // 验证码发送时间
        var showcode = function (v) {
            if (v) {
                $('.send-message').css({"display": "none"});
                $('.wait_code').css({"display": "inline-block"});
                _detrat = setInterval(detract(), 1000);
            } else {
                $('.send-message').css({"display": "inline-block"})
                $('.wait_code').css({"display": "none"});
                clearInterval(_detrat);
            }
        };
        $("#code").blur(function () {
            var phone = $("#phone").val();
        });

        $('.formid').on('click', 'input', function (e) {
            e.stopPropagation();
            $(this).parents('.input-k').addClass('actives').siblings().removeClass('actives');
        });
        $(document).on('click', function () {
            $('.input-k').removeClass('actives');
            $(".ipt-code").removeClass('code_actives');
        });
        $(".ipt-code input").click(function (e) {
            e.stopPropagation();
            $(".ipt-code").addClass("code_actives")
        })
        $("#login-submit").click(function () {
            loginSubmit()
        });
        $(document).keydown(function (event) {
            if (event.keyCode == 13) {
                if (submitBool) {
                    phoneSubject()
                } else {
                    loginSubmit()
                }
            }
        });
        $('.logon-type .user_agreement').click(function () {
            $('#user_protocol').modal('show');
        });
        $(".logon-type a").unbind("click").click(function () {

        });

        $("#phone-submit").click(function loginSubmit() {
            phoneSubject();
        });
        var isModilePhone = function (v) {
            var regex = /^1(3|4|5|6|7|8|9)[0-9]{9}$/;
            return regex.test(v);
        };

        function phoneSubject() {
            localStorage.clear();
            $("#msg").hide();
            $("#error-message").html(' ');
            $("#error-message").hide();
            var phone = $("#phone").val();
            var code = $("#code").val();

            if (!phone) {
                $("#msg").hide();
                $("#error-message").show();
                $("#msg").fadeOut(5000);
                $("#error-message").html('<div id="msg" class="errors">手机号不能为空</div>');
                getCaptchaImage()
                return;
            }

            if (!isModilePhone(phone)) {
                $("#msg").hide();
                $("#error-message").show();
                $("#msg").fadeOut(5000);
                $("#error-message").html('<div id="msg" class="errors">手机格式不正确</div>');
                getCaptchaImage()
                return;
            }

            if (!code) {
                $("#msg").hide();
                $("#error-message").show();
                $("#msg").fadeOut(5000);
                $("#error-message").html('<div id="msg" class="errors">验证码不能为空</div>');
                getCaptchaImage()
                return;
            }

            var form = document.getElementById('phone_formid');
            $.ajax({
                url: "/sso/api/verify/code?phone=" + phone + "&code=" + code,
                type: "GET",
                success: function (data) {
                    if (data.code != '200') {
                        $("#error-message").html('<div id="msg" class="errors">' + data.msg + '</div>').show();
                    } else {
                        $("#form_code").val(Encrypt($("#code").val()));
                        form.submit();
                    }
                }
            })
        };

        $(".code_refresh,#code_img").click(function (e) {
            if (window.ys_loaded_setting) {
                getCaptchaImage()
            }
        });

        function getCaptchaImage() {
            let me = this
            $.ajax({
                url: window.ys_center_url + "/iapp/api/captchaImage?source=login",
                type: "GET",
                success: function (res) {
                    if (res && res.data) {
                        document.querySelector('#code_img').src = "data:image/png;base64," + res.data.img
                        document.querySelector('#code_img').dataset.uuid = res.data.uuid
                    }
                },
            });
        }

        $("#code_close").click(function () {
            $("#mask").hide();
        });

        function codeRest() {
            if (window.ys_loaded_setting) {
                getCaptchaImage()
                $("#verifcation_code").val("");
            }
        }

        $(".send-message").click(function () {
            var phone = $("#phone").val();
            var code = $("#verifcation_code").val();
            var uuid = $("#code_img").attr('data-uuid');
            if (!isModilePhone(phone)) {
                $("#msg").hide();
                $("#error-message").html('<div id="msg" class="errors">电话号码格式不正确</div>');
                $("#error-message").show();
                $("#msg").fadeOut(5000);
                getCaptchaImage()
                return false;
            }
            if (!code) {
                $("#msg").hide();
                $("#error-message").html('<div id="msg" class="errors">请输入图形验证码</div>');
                $("#error-message").show();
                $("#msg").fadeOut(5000);
                getCaptchaImage()
                return false;
            }
            if (!window.ys_loaded_setting) {
                getCaptchaImage()
                return false;
            }

            let params = {
                phone: phone,
                uuid: uuid,
                captcha: code,
                source: 'login',
            }

            $.ajax({
                url: window.ys_center_url + "/iapp/api/validationcode/send",
                type: "GET",
                data: {
                    phone: phone,
                    uuid: uuid,
                    captcha: code,
                    source: 'login',
                },
                success: function (res) {
                    $("#mask").hide();
                    $("#code_tip").hide();
                    if (res.code != -1) {
                        _time = 90;
                        $('.wait_code').html(_time + 's');
                        showcode(true);
                        setTimeout(showcode, _time * 1000);
                    } else {
                        $("#msg").hide();
                        $("#error-message").html('<div id="msg" class="errors">' + res.msg + '</div>');
                        $("#error-message").show();
                        $("#msg").fadeOut(5000);
                    }
                },
                error: function (res) {
                    codeRest();
                    $("#mask").hide();
                    $("#code_tip").hide();
                    $("#msg").hide();
                    $("#error-message").html('<div id="msg" class="errors">' + res.msg + '</div>');
                    $("#error-message").show();
                    $("#msg").fadeOut(5000);
                }
            });

        });

        $('#tab-account a').click(function (e) {
            e.preventDefault();
            var isScanCode = ($(this).attr('title') == 'login-scan-code-ww') && !$(this).hasClass("current");
            $('#tab-account li a').removeClass("current").removeClass("active");
            $('.third-box a').removeClass("active");
            $(this).addClass("current").addClass("active");
            $(".item").removeClass("show").hide();
            $('#' + $(this).attr('title')).addClass('show').show();
            $('#error-message').children().remove();
            $("#msg").hide();

            if ($(this).attr('title') == 'login-phone') {
                var phone = $('#phone').val();
                if (phone) {
                    $.ajax({
                        url: "/sso/api/switch/operation?phone=" + phone,
                        type: "GET",
                        success: function (data) {

                        }
                    })
                }
                $("#phone").focus();
                submitBool = true;
            } else {

                $("#username").focus();
                submitBool = false;
            }


            //  二维码登录
            // if (isScanCode) {
            //     $(".code_back").hide();
            //     scanCode();
            // }
        });

        //相对地址转绝对
        function relative2absolute(url, base) {
            var ele = document.createElement('a');
            ele.href = (base || '') + url;
            return ele.href;
        }

        function scanCode() {
            $.ajax({
                type: "GET",
                url: "/sso/connect/code",
                success: function (data) {
                    if (data != undefined) {
                        if (data.code && !data.redirect_uri) {
                            document.querySelector('#login-scan-code-ww img').src = "/sso/connect/qrcode/" + data.code
                        }
                        else {
                            var wwLogin = new WwLogin({
                                "id": "login-scan-code-ww",
                                "appid": data.appid,
                                "agentid": data.agentid,
                                "redirect_uri": encodeURIComponent(data.redirect_uri),
                                "state": data.code,
                                'href': relative2absolute('/static/oauth/commons/css/wwLogin_hzy.css'),
                            });
                        }

                        /*$.ajax({
                            type: "GET",
                            url: "/connect/qrcode/" + data,
                            success: function (data) {
                                /!*$("#login-scan-code-ww img").attr("src","/connect/qrcode/" + code);
                                $("#login-scan-code-ww p").html("请使用校耘App扫描二维码登录");*!/

                                /!*setTimeout(function(){
                                    inspectPool(code);
                                },100);*!/
                            },

                            error: function (e) {
                                $("#msg").hide();
                                $("#error-message").html('<div id="msg" class="errors">' + obj + '</div>');
                                $("#error-message").show();
                                $("#msg").fadeOut(5000);
                            }
                        });*/
                    }
                },
                error: function (obj) {
                    $("#msg").hide();
                    $("#error-message").html('<div id="msg" class="errors">' + obj + '</div>');
                    $("#error-message").show();
                    $("#msg").fadeOut(5000);
                }
            });
        };

        function inspectPool(code) {
            $.post("/sso/connect/inspect", {
                token: code,
            }, function (data) {
                if (data.code == 200) {
                    $("#login-scan-code-ww p").html(data.msg);
                    scanSuccess(data.data.token);
                } else if (data.code == 201) {
                    $("#login-scan-code-ww p").html("");
                    $(".code_back").show();
                    $(".code_back p").html(data.msg);
                } else {
                    inspectPool(code);
                }
            });
        };

        $(".code_back").unbind("click").click(function () {
            $(".code_back").hide();
            scanCode();
        });

        function scanSuccess(code) {
            $.post("/sso/connect/auth", {
                token: code,
            }, function (data) {
                if (data.code == 200) {
                    var userpwd = Encrypt(data.data.userpwd);
                    $("#username").val(data.data.username);
                    $("#userpwd").val(userpwd);
                    $('form#formid').submit();
                } else if (data.code == 201) {
                    $("#login-scan-code-ww p").html("");
                    $(".code_back").show();
                    $(".code_back p").html(data.msg);
                } else {
                    scanSuccess(code);
                }
            });
        };

        function setCookie(c_name, value, expiredays) {
            var exdate = new Date()
            exdate.setDate(exdate.getDate() + expiredays)
            document.cookie = c_name + "=" + escape(value) +
                ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString())
        };

        // 登录页面页头导航
        function loginHader() {
            var opt_url = "http://we.hnzj.edu.cn";
            $.ajax({
                // url: "http://192.168.0.176:8086/api/service/settings",
                url: opt_url + "/api/service/settings",
                type: "GET",
                success: function (data) {
                	var unit = '', optName = '', ssoName = '';
                    if (data && data.length > 0) {
                        $.each(data, function (i, v) {
                            if (v.key == "commons.WEBSITE_HOME_LOGO") {
                                $(".logo img").attr("src", opt_url + "/api/service/image/" + v.value);
                            }
                            if (v.key == "commons.WEBSITE_BACKGR_IMG" && v.name == 'Img') {
                                var tpl = '<img src="' + opt_url + '/api/service/file/' + v.value + '" style="width: 100%;height:100%;">';
                                $(".BackgSwitc").html(tpl);
                            }
                            if (v.key == "commons.WEBSITE_BACKGR_IMG" && v.name == 'Vid') {
                                var tpl = '<video id="video" width="100%" height="auto" autoplay loop="loop" requestFullscreen><source src="' + opt_url + '/api/service/file/' + v.value + '" type=video/mp4"><source src="' + opt_url + '/api/service/file/' + v.value + '" type="video/ogg">您的浏览器不支持Video标签。</video>';
                                $(".BackgSwitc").html(tpl);
                            }
                            //if (v.key == "commons.WEBSITE_TITLE_INTRODUCE") {
                            //$(".logo .logo-grade").html(v.value);
                        	//}
                        	if (v.key == "commons.SSO_TITLE_NAME") {
                            	$(".logo .logo-grade").html(v.value);
                            	ssoName = v.value;
                        	}
                            if (v.key == "commons.SCHOOL_WEBSITE") {
                                $(".container li:eq(0) a").attr('href', v.value);
                            }
                            if (v.key == "commons.APP_CENTER") {
                                $(".container li:eq(1) a").attr('href', v.value);
                            }
                            if (v.key == "commons.DATA_BRAIN") {
                                $(".container li:eq(3) a").attr('href', v.value);
                            }
                            if (v.key == "commons.OPEN_PLATFORM") {
                                $(".container li:eq(2) a").attr('href', v.value);
                            }
                            if (v.key == "commons.SLOGAN_Field_1") {
                                $(".text ul li .Chinese").html(v.value);
                            }
                            if (v.key == "commons.SLOGAN_Field_2") {
                                $(".small-text").html(v.value);
                            }
                            if (v.key == "commons.SLOGAN_Field_2") {
                                $(".small-text").html(v.value);
                            }

                            if (v.key == "commons.WEBSITE_COPYRIGHT") {
                                $("#footer .type-area cite").html(v.value);
                            }
                            if (v.key == "commons.WEBSITE_TECHNICAL_SUPPORT") {
                                $("#footer .type-area a").html(v.value);
                            }
                            if (v.key == "commons.WEBSITE_TECHNICAL_SUPPORT_LINK") {
                                $("#footer .type-area a").attr('href', v.value);
                            }
                            if (v.key == 'commons.WEBSITE_TITLE_NAME') {
                            	unit = v.value;
                            }
                            //if (v.key == 'commons.WEBSITE_TITLE_INTRODUCE') {
                            //titleIntroduce = v.value;
                        	//}
                        	if (v.key == 'commons.OPT_TITLE_NAME') {
                        		optName = v.value;
                        	}
                            if (v.key == 'commons.WEBSITE_CENTER_URL') {
                                window.ys_center_url = v.value;
                            }
                            if (v.key == 'commons.WEBSITE_COLOR') {
                                var head = document.head || document.getElementsByTagName('head')[0];
                                var style = document.createElement('style');
                                style.type = 'text/css';
                                if (v.value) {
                                    style.innerHTML = "#login-account .qita-g .login-submit{" + "background:" + v.value + ";}" + ".active{" + "border-bottom:4px solid " + v.value + ";color:" + v.value + " !important;}.loginPhone{border-bottom:4px solid " + v.value + ";color:" + v.value + ";}input[type=\"button\"]{background:" + v.value + ";}";
                                } else {
                                    style.innerHTML = "#login-account .qita-g .login-submit{" + "background:#1e96ff;}" + ".active{" + "border-bottom:4px solid #1e96ff;color:#1e96ff !important;}.loginPhone{border-bottom:4px solid #1e96ff;color:#1e96ff;}input[type=\"button\"]{background:#1e96ff;}";
                                }
                                head.appendChild(style);
                            }
                            if (v.key == "commons.LOGIN_BUTTON") {
                                if (v.value == 'true') {
                                    $('.container').hide();
                                    //$(".logo .logo-grade").hide();
                                } else {
                                    $('.container').show();
                                    //$(".logo .logo-grade").show();
                                }
                            }
                        });
                        
                        document.title = ssoName + '_' + unit;
                        
                        window.ys_loaded_setting = true;
                        getCaptchaImage()
                        var storage = window.localStorage;
                        storage.setItem("Title", optName + "_" + unit);
                    }
                },
                error: function (obj) {
                }
            });
        };
        loginHader();


        //微信登录
        function wxScanCode() {
            $.ajax({
                type: "GET",
                url: "/sso/connect/wx/code",
                success: function (data) {
                    if (data != undefined) {
                        if (data.code && !data.redirect_uri) {
                            document.querySelector('#login-scan-code-wx img').src = "/sso/connect/qrcode/" + data.code
                        }
                        else {
                            var wxLogin = new WxLogin({
                                "id": "login-scan-code-wx",
                                "appid": data.appid,
                                "scope": "snsapi_login",
                                "redirect_uri": encodeURIComponent(data.redirect_uri),
                                "state": data.code,
                                'href': relative2absolute('/static/oauth/commons/css/wxLogin_hzy.css'),
                            });
                        }
                    }
                },
                error: function (obj) {
                    $("#msg").hide();
                    $("#error-message").html('<div id="msg" class="errors">' + obj + '</div>');
                    $("#error-message").show();
                    $("#msg").fadeOut(5000);
                }
            });
        }

        $("#third-weixin,#third-qiyeweixin").click(function () {
            $('#tab-account li a').removeClass("current").removeClass("active");
            $('.third-box a').removeClass("active");
            $('#login-phone').hide()
            $('#tab-phone').hide()
            $('#tab-account').show()
            $(".item").removeClass("show").hide();
            $('#' + $(this).attr('title')).addClass('show').show();
            $('#error-message').children().remove();
            $(this).addClass("active")
        })
    });

</script>
</body>
</html>

