@{
    Layout = "~/Areas/Member/Views/_LoginLayoutPage.cshtml";
    ViewBag.Title = "找回密码";
    PageAdmin.Common.FindAccountTask findUser = (PageAdmin.Common.FindAccountTask)ViewBag.FindUser;
}
<div class="login-box find-pass-box clearfix" id="loginbox" v-cloak>
    <a class="login-logo" href="@ViewBag.HomeLink"><img src="/Areas/Member/Css/images/Loginlogo.png"/></a>
    <div class="login-sign">重设密码</div>
    <el-form ref="form" label-position="top">
        <!--解决浏览器自动填充账户-->
        <input type="text" style="position:fixed;bottom:-9999px" />
        <input type="password" style="position:fixed;bottom:-9999px" />
        <el-form-item label="用户名：">
            <el-input v-model.trim="formData.Username" placeholder="用户名" disabled></el-input>
            <span class="help-block validate-tips-box"></span>
        </el-form-item>
        <el-form-item label="重设密码：">
            <el-input v-model.trim="formData.Password" type="password" autocomplete="off" placeholder="请填写密码" v-validate="{data:formData.Password,dataType:'password',nullMsg:'请填写密码!',errorMsg:'密码长度控制在2到16位字符之间！'}" maxlength="16"></el-input>
            <span class="help-block validate-tips-box"></span>
        </el-form-item>
        <el-form-item label="密码确认：">
            <el-input v-model.trim="formData.Password1" id="password1" autocomplete="off" type="password" placeholder="请填写确认密码" v-validate="{data:formData.Password1,focusTarget:'#password1',nullMsg:'请填写确认密码!',errorMsg:'两次输入的密码不一致!',compare:formData.Password}" maxlength="16"></el-input>
            <span class="help-block validate-tips-box"></span>
        </el-form-item>
        <el-form-item>
            <div class="controls button-spacing">
                <el-button type="primary" v-on:click="postSubmit">下一步</el-button>
            </div>
        </el-form-item>

    </el-form>
</div>

<script type="text/javascript">
    var formData = { Username: "@findUser.Username", Password: "", Password1: "" };
    //vue实例化
    var vue = new Vue({
        el: "#loginbox",
        data: {
            formData: formData,
        },
        methods: {
            postSubmit: function () {
                var validated = this.validateForm({ });//表单验证
                if (validated) {
                    this.submit({ url: "@Url.ActionUrl("ModifyPassword")", data: formData, showSuccessMsg: false, success: loginSuccess });
                }
            },
        },
    });
    function loginSuccess(result)
    {
        location.href = "@Url.ActionUrl("Success")?username=" + urlEncode(formData.Username);
    }
    addEvent(window, 'keyup', function (event) {
        if (event.keyCode == 13) {
            vue.postSubmit();
        }
    });
</script>