@{
    Layout = "~/Areas/Member/Views/_LoginLayoutPage.cshtml";
    ViewBag.Title = "OAuth2.0授权注册";
}
<div class="login-box" id="loginbox" v-cloak>
    <a class="login-logo" href="@ViewBag.HomeLink"><img src="/Areas/Member/Css/images/Loginlogo.png"/></a>
    <div class="login-sign">OAuth2.0授权</div>
            <div id="LoginBox">
                <div class="form-group">
                    <span :style="msgStyle">{{msg}}</span>
                </div>
                <div class="form-group">
                    <div class="text-left">
                        <a href="@Url.ActionUrl("Index","Reg")" class="text-primary">注册用户</a> / <a href="@Url.ActionUrl("Index","Login")" class="text-primary">转到登录</a>
                    </div>
                </div>
            </div>
        </div>
<script type="text/javascript">
    //vue实例化
    var vue = new Vue({
        el: "#loginbox",
        data: {
            state: 1,
            msg: "授权成功！",
        },
        computed: {
            msgStyle: function () {
                if (this.state == 0) {
                    return { color: "#f56c6c" };
                }
                else {
                    return { color: "#67c23a" };
                }
            }
        },
        methods: {
            autoReg: function () {
                var openId = request("openId");
                var _this = this;
                vue.submit({
                    url: "@Url.ActionUrl("Auto", "Reg")",
                    data: { openId: openId },
                    showFailMsg: false,
                    showSuccessMsg: false,
                    success: function (responseData) {
                        var redirectURL = request("redirectURL");
                        if (isNullOrEmpty(redirectURL)) {
                          redirectURL = "@Url.ActionUrl("Index","Default")";
                        }
                        location.href = redirectURL;
                    },
                    failCallback: function (responseData) {
                        _this.state = 0;
                        _this.msg = responseData.Msg;
                    }
                });
            },
        },
    });
    vue.autoReg();
</script>
