@{
    Layout = "~/Areas/Member/Views/_LoginLayoutPage.cshtml";
    ViewBag.Title = "找回密码";
    PageAdmin.Common.FindAccountTask findUser = (PageAdmin.Common.FindAccountTask)ViewBag.FindUser;
    string mobile = findUser.Mobile;
    string mobileXxx = "";
    if (StringHelper.IsMobile(mobile))
    {
        mobileXxx = mobile.Substring(0,3) + "******" + mobile.Substring(9);
    }
    string email = findUser.Email;
    string emailXxx = "";
    if (StringHelper.IsEmail(email))
    {
        int secondStart = email.IndexOf("@");
        emailXxx = email.Substring(0,2) + "******"+email.Substring(secondStart-1);
    }
}
<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" v-if="Open==1">
        <el-form-item label="找回方式">
            <el-select v-model="formData.FindType" placeholder="请选择" style="width:100%" v-validate="{data:formData.FindType,dataType:'*',nullMsg:'请选择身份验证方式'}">
                @if (ViewBag.FindByMobile == 1 && !string.IsNullOrEmpty(mobileXxx))
                {
                    <el-option key="mobile" label="手机验证 @mobileXxx" value="mobile"></el-option>
                }
                @if (ViewBag.FindByEmail == 1 && !string.IsNullOrEmpty(emailXxx))
                {
                    <el-option key="email" label="邮箱验证 @emailXxx" value="email"></el-option>
                }
                <el-option key="else" label="人工申诉" value="else"></el-option>
            </el-select>
            <span class="help-block validate-tips-box">请填写要找回的帐号、或账号绑定的邮箱或手机</span>
        </el-form-item>

        <el-form-item label="邮箱账户" v-show="formData.FindType=='email'">
            <el-input placeholder="" v-model.trim="formData.Email" id="email" v-validate="{data:formData.Email,dataType:'email',nullMsg:'请填写邮箱账户!',errorMsg:'邮箱账户填写错误!',ignore:(formData.FindType=='email'?false:true)}"></el-input>
            <span class="help-block validate-tips-box">请填写账户绑定的邮箱账户</span>
        </el-form-item>

        <el-form-item label="邮件验证码" v-show="formData.FindType=='email'">
            <ui-input-code placeholder="点击右侧按钮获取邮件验证码" v-model.trim="formData.EmailCode" focus-target="#email" :account="formData.Email" url-api="/E/EmailCode/Send" v-validate="{data:formData.EmailCode,dataType:'numeric',minLength:6,minLengthErrorMsg:'邮件验证码为6位数字！',nullMsg:'请填写邮件验证码',ignore:(formData.FindType=='email'?false:true)}"></ui-input-code>
            <span class="help-block validate-tips-box"></span>
        </el-form-item>

        <el-form-item label="手机号码" v-show="formData.FindType=='mobile'">
            <el-input placeholder="" v-model.trim="formData.Mobile" id="mobile" v-validate="{data:formData.Mobile,dataType:'mobile',nullMsg:'请填写手机号码!',errorMsg:'手机号码填写错误!',ignore:(formData.FindType=='mobile'?false:true)}"></el-input>
            <span class="help-block validate-tips-box">请填写账户绑定的手机号码</span>
        </el-form-item>

        <el-form-item label="手机验证码" v-show="formData.FindType=='mobile'">
            <ui-input-code placeholder="点击右侧按钮获取邮件验证码" v-model.trim="formData.SmsCode" focus-target="#mobile" type="mobile" :account="formData.Mobile" url-api="/E/SmsCode/Send" v-validate="{data:formData.SmsCode,dataType:'numeric',minLength:6,minLengthErrorMsg:'验证码为6位数字！',nullMsg:'请填写手机验证码',ignore:(formData.FindType=='mobile'?false:true)}"></ui-input-code>
            <span class="help-block validate-tips-box"></span>
        </el-form-item>
        <el-form-item label="找回说明" v-show="formData.FindType=='else'">
            <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" :disabled="formData.FindType=='else'">下一步</el-button>
            </div>
        </el-form-item>


        <div style="margin-top:15px;">
            没有账户？<a href="@Url.ActionUrl("Index", "Reg")" class="text-primary">去注册</a>
        </div>
    </el-form>
</div>

<script type="text/javascript">
    @{
      string findType = "else";
      if (ViewBag.FindByMobile == 1 && !string.IsNullOrEmpty(mobileXxx))
        {
            findType = "mobile";
        }
       else if (ViewBag.FindByEmail ==1 && !string.IsNullOrEmpty(emailXxx))
        {
            findType = "email";
        }
    }
    var formData = {FindType: "@findType", EmailCode: "", SmsCode: "",VerificationCode: "",Email:"",Mobile:""};
    //vue实例化
    var vue = new Vue({
        el: "#loginbox",
        data: {
            formData: formData,
            Open:@ViewBag.Open,
        },
        methods: {
            postSubmit: function () {
                var validated = this.validateForm({ });//jquery表单验证
                if (validated) {
                    this.submit({ url: "@Url.ActionUrl("Confirm")", data: formData, showSuccessMsg: false, failTipsType: "message", success: loginSuccess });
                }
            },
        },
    });
    function loginSuccess(result)
    {
        location.href = "@Url.ActionUrl("ModifyPassword")";
    }
    addEvent(window, 'keyup', function (event) {
        if (event.keyCode == 13) {
            vue.postSubmit();
        }
    });
</script>
