Google reCAPTCHA V3

如旧

现在可以很方便的为页面添加Google reCAPTCHA V3
只需要在一个页面上添加如下JS代码

    $.ajax({
        type: "get",
        url: "https://recaptcha.net/recaptcha/api.js?render={$Think.config.reCAPTCHA_SITE_KEY}",
        dataType: 'script',
        success: function () {
            grecaptcha.ready(function () {
                    grecaptcha.execute('{$Think.config.reCAPTCHA_SITE_KEY}', {action: 'homepage'}).then(function (token) {
                        console.log(token);
                        $.ajax({
                            type: "post",
                            url: "{:url('index/reCAPTCHA_Verify')}",
                            data: 'token=' + token,
                            dataType: 'json',
                            success: function (data) {
                                console.log(data);
                                // if (data.score < 0.5) {
                                //     alert("您可能是机器人");
                                // }
                                $("body").append($("<div></div>").attr("style", "background-color: #FFFFFF;width: 10rem;height: 1rem;position: fixed;bottom: 1rem;left: 0;box-shadow: 0px 0px 5px gray;font-size: 0.625rem;").text("您的reCAPTCHA得分:" + data.score));
                            }
                        });
                    });
                }
            )
        }
    });