@{
    Layout = null;
}<!DOCTYPE html>
<html>
<head>
    <title>管理员登录</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="Author" content="http://www.pageadmin.net" />
    <link rel="stylesheet" href="~/Incs/elementUi/2.13/element-ui.css">
    <link rel="stylesheet" href="~/Incs/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/Areas/Admin/Css/login.css?v4.0.10.6" type="text/css">
    <script src="~/Incs/vue/2.6.11/vue.js" type="text/javascript"></script>
    <script src="~/Incs/elementUi/2.13/element-ui.js" type="text/javascript"></script>
    <script src="~/FrameUi/1.0/basic.js?v4.0.11" type="text/javascript"></script>
    <script src="~/FrameUi/1.0/vueExtend.js?v4.0.11" type="text/javascript"></script>
    <script src="~/FrameUi/1.0/validateForm.js?v4.0.10" type="text/javascript"></script>
</head>
<body>
    <!--[if lte IE 9]>
      <div class="alert alert-warning text-center">
          <a href="#" class="close" data-dismiss="alert">
              &times;
          </a>
          您好！ 您使用的IE浏览器版本过低，建议你使用谷歌(chrome)，火狐(Firefox)等标准浏览器，或升级到IE10+以上版本！
      </div>
       <![endif]-->
    <div class="main clearfix">
        <div class="login-box" id="loginbox" v-cloak>
            <div class="header"></div>
            <el-form method="post" id="myForm" autocomplete="off">
                <!--解决浏览器自动填充账户-->
                <input type="text" style="position:fixed;bottom:-9999px" />
                <input type="password" style="position:fixed;bottom:-9999px" />
                <div class="login-title">管理登录</div>
                <el-form-item>
                    <el-input v-model.trim="account" maxlength="50" placeholder="管理员账户" v-validate="{data:account,dataType:'*',nullMsg:'请填写管理员账户!'}"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="password" autocomplete="off" type="password" maxlength="50" placeholder="密码" v-validate="{data:password,dataType:'password',nullMsg:'请填写密码!'}"></el-input>
                </el-form-item>
                @{
                    string AuthenticationCode = Model;
                    if (!string.IsNullOrWhiteSpace(AuthenticationCode))
                    {
                        <el-form-item>
                            <el-input v-model.trim="code" id="code" maxlength="50" placeholder="认证码" v-validate="{data:code,dataType:'*',nullMsg:'请填写认证码!'}"></el-input>
                        </el-form-item>
                    }
                }
                <el-form-item>
                    <el-input v-model.trim="verificationCode" ref="verificationCode" maxlength="50" placeholder="验证码" v-validate="{data:verificationCode,dataType:'*',nullMsg:'请填写验证码!'}">
                        <template slot="append">
                            <ui-verification-code-image ref="verificationCodeImage" src="/E/VerificationCode/?width=100&height=30"></ui-verification-code-image>
                        </template>
                    </el-input>
                </el-form-item>

                <el-form-item>
                    <div class="controls clearfix">
                        <el-checkbox v-model="saveCookie">保存信息</el-checkbox>
                        <a href="@ViewBag.HomeUrl" class="pull-right" target="_blank">返回首页</a>
                    </div>
                </el-form-item>
                <el-form-item>
                    <div class="controls">
                        <el-button type="primary" v-on:click="postSubmit">登录</el-button>
                    </div>
                </el-form-item>
            </el-form>
            <div class="footer"></div>
        </div>
        <div class="copyright"><a href="http://www.pageadmin.net" target="_pageadmin"> PageAdmin内容管理系统 &copy @DateTime.Now.Year</a></div>
    </div>

    <script type="text/javascript">
        var formData = { account: "", password: "", code: "", saveCookie: false, verificationCode: "" };
        var localStorageKey = "loginInfo40101";
        var saveInfo = getLocalStorage(localStorageKey);
        if (saveInfo != "") {
            formData = JSON.parse(saveInfo);
        }
        formData.verificationCode = "";

        if (self != top) { top.location = self.location; }

        function loginSuccess() {
            if (formData.saveCookie) {
                setLocalStorage(localStorageKey, JSON.stringify(formData));
            }
            else {
                removeLocalStorage(localStorageKey);
            }
            vue.$message.success("登录成功!")
            var loadingInstance = vue.$loading();
            location.href = "@(Url.ActionUrl("index","Default"))";
        }

        var vue= new Vue({
          el: "#loginbox",
          data: formData,
          methods: {
              postSubmit: function () {
                  var _this = this;
                  var validated = this.validateForm();//基础数据验证
                  if (!validated) {
                      return;
                  }
                  this.submit({ url: "@Url.ActionUrl()", data: formData, success: loginSuccess, showFailMsg: false, showSuccessMsg: false, failCallback: failLogin, });
              }
          },
        });

        function failLogin(data) {
            vue.$message.error(data.Msg);
            vue.$refs.verificationCodeImage.change();
        }
        function init() {
            var bgNum = Math.floor(Math.random() * 5 + 1);
            var $body = document.querySelector("body");
            $body.style.backgroundImage = "url(/Areas/Admin/Css/images/login/" + bgNum + ".jpg?" + Math.random()+")";
        }
        document.ready(function () {
            init()
        });
        addEvent(window,'keyup',
            function (event) {
                if (event.keyCode == 13) {
                    vue.postSubmit();
                }
            });
    </script>
</body>
</html>