<%@ Page Language="C#" AutoEventWireup="true" Inherits="Web.inherits.ViewPage" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
    <title>用户登录-<%=WebSiteConfig.SiteTitle%></title>
    <link href="/Aspx/blue/Css/common.css" rel="stylesheet" />
    <link href="/Aspx/blue/Css/web.css" rel="stylesheet" />
    <link href="/Aspx/blue/Css/user.css" rel="stylesheet" />
    <script src="/Js/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Js/bx.library.js"></script>
    <script src="/Js/data.js"></script> 
    <script src="/Aspx/blue/js/web.js" type="text/javascript"></script>
    <script src="/Aspx/blue/js/user.js"></script>
</head>
<body>
<!--Create Time: 2015/1/2 22:43:01-->
    <!--head-->
    <div class="head">
    <div class="head_top">
        <div class="main bar">
            <span id="LoginStatus"><a href="/login/Default/">登录</a> | <a href="/login/register/">注册</a></span>
            <span class="right"><a href="javascript:void(0);" onclick="AddFavorite();">加入收藏</a>&nbsp;&nbsp;&nbsp;<a href="/Ashx/Desktop.ashx" target="_blank">桌面图标</a></span>
        </div>
    </div>
    <div class="main center">
        <div class="logo">
            <a href="<%=WebSiteConfig.DomainName%>">
                <img src="/Aspx/blue/images/common_logo.png" title="<%=WebSiteConfig.SiteName%>" alt="<%=WebSiteConfig.SiteName%>" /></a>
        </div>
        <div class="search">
            <div class="searchinput">
                <span>
                    <input class="searchbtn" id="btnSearch" type="button" value="" onclick="search();" />
                    <input class="releasebtn" id="Button2" type="button" value="" onclick="location.href = '/info/category'" />
                </span>
                <span>
                    <input id="txtKeywords" maxlength="10" class="keywordInput" type="text" />
                </span>

            </div>
            <div>热门搜索:
            <%foreach(var hword in GetSearchHotWordList()){%>
                <a href="/search/?keywords=<%=hword%>"><%=hword%></a> 
            <%}%>
            </div>
        </div>
    </div>
    <div class="menu">
        <div class="main">
            <ul>
                <li id="HeadMenuList">
                    <a href="/" matchstatus="home">首 页</a>
                    <a href="/gangcai/" matchstatus="gangcai">冶金钢材</a>
                    <a href="/suliao/" matchstatus="suliao">橡胶塑料</a>
                    <a href="/pige/" matchstatus="pige">纺织皮革</a>
                    <a href="/baozhuang/" matchstatus="baozhuang">包 装</a>
                    <a href="/wujin/" matchstatus="wujin">五 金</a>
                    <a href="/jixie/" matchstatus="jixie">机械工业</a>
                </li>
            </ul>

        </div>

    </div>
</div>
<div class="split">&nbsp;</div>
<script type="text/javascript">if (typeof (loadLoginStatus) != null) { loadLoginStatus(); }
    UrlStatus.changeDomSelectStatus("HeadMenuList", 1);
</script>

    <!--body-->
    <div class="body main">
        <div class="login bordershadow">
            <div class="content">
                <div class="logintitle">登录</div>
                <div class="logincontent">
                    <table>
                        <tr>
                            <td class="itemtitle">用户名:</td>
                            <td class="itemcontent"><input class="logininput" id="txtAccount" maxlength="20" type="text" onkeyup="enterSubmit(event);" placeholder="账号/邮箱" /></td>
                            <td>可使用账号或邮箱</td>
                        </tr>
                        <tr>
                            <td class="itemtitle">密 码:</td>
                            <td class="itemcontent"><input class="logininput" id="txtPassword" maxlength="20" type="password" onkeyup="enterSubmit(event);" placeholder="密码" /></td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td class="itemtitle">&nbsp;</td>
                            <td>
                                <input id="ckbAccount" type="checkbox" checked="checked" />记住账号
                                <a href="/Login/ForgotPassword" target="_blank">忘记密码</a>
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;
                            </td>
                            <td class="itembutton">
                                <input class="loginbutton" id="btnEnterSubmit" type="button" value="登录" onclick="SubmitUserLogin(this)" />
                                &nbsp;没有账号，<a href="/Login/Register" target="_blank">从这里注册</a>
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <!--foot-->
        <div class="split">&nbsp;</div>
    <div class="foot main">
        <div class="menu">
            <ul>
                <li><a href="/about/home" target="_blank" rel="nofollow">关于我们</a></li>
                <li>|</li>
                <li><a href="/about/message" target="_blank" rel="nofollow">建议意见</a></li>
                <li>|</li>
                <li><a href="/about/Contact" target="_blank" rel="nofollow">联系我们</a></li>
                <li>|</li>
                <li><a href="/about/Privacy" target="_blank" rel="nofollow">免责声明</a></li>
            </ul>
        </div>
        <div><%=WebSiteConfig.RecordNo%><%=WebSiteConfig.Copyright%></div>
        <div><%=WebSiteConfig.StatisticalCode%></div>
    </div>
<!--隐藏内容-->
<div id="winpop" style="display:none;">
    <div class="rightwindow">
        <div class="title">公告<span class="close" onclick="win.slideWindow()">X</span></div>
        <div class="content">
            @msg
        </div>
    </div>
</div>
    <script type="text/javascript">
    var codeUrl = "";
    function SubmitUserLogin(obj) {
        SaveOrClearAccount(true);
        var userName = document.getElementById("txtAccount").value;
        var userPassword = document.getElementById("txtPassword").value;
        var code = "aaa";
        if (userName == "") {
            Alert("用户名不能为空!");
            return false;
        }
        if (userPassword == "") {
            Alert("密码不能为空!");
            return false;
        }
        if (code == "") {
            Alert("验证码不能为空!");
            return false;
        }
        var isLogin = false;
        User.login({ "account": userName, "password": userPassword, "code": code }, function (result) {//成功
            if (result.status == "success") {
                if (result.message != "") {
                    window.location.href = decodeURI(result.message);
                }
                else {
                    if ('<%=Request["ReturnUrl"]%>' !== "") {
                        window.location.href ='<%=Request["ReturnUrl"]%>';
                    } else {
                        window.location.href = "/Manage/default";
                    }
                }
                isLogin = true;
            }
            else if (result.error == "code") {
                Alert("验证码错误!");
            }
            else if (result.error == "email") {
                window.location.href = result.message;
            }
            else if (result.error == "password") {
                Alert("用户名或密码错误!");
            }
            else if (result.error == "limit") {
                Alert("登录失败,当前账号受到登录限制，请与网站管理员联系!");
            }
            else {
                Alert("登录失败,请重试!");
            }
            //RefreshVerification();
        }, function (result) {//失败
            Alert("登录失败,请重试!");
        });

        return isLogin;
    }
    function SaveOrClearAccount(op) {
        if (op == null || op == false) {
            var v = bx.store.cookie.get("_loginaccount");
            if (v != "") {
                document.getElementById("txtAccount").value = v;
                document.getElementById("ckbAccount").checked = true;
            }
        } else {
            if (document.getElementById("ckbAccount").checked) {
                bx.store.cookie.set("_loginaccount", document.getElementById("txtAccount").value, 365 * 24 * 60 * 60 * 1000);
            } else {
                bx.store.cookie.clear("_loginaccount");
            }
        }

    }
    function enterSubmit(evt) {
        evt = evt ? evt : (window.event ? window.event : null);
        if (evt.keyCode == 13) {
            document.getElementById("btnEnterSubmit").click();
        }
    }
    window.onload = function () {
        SaveOrClearAccount();
    }
    </script>

</body>
</html>
