1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <script src="/base/js/jquery-2.1.1.min.js"></script>
- <script src="https://static.geetest.com/static/tools/gt.js"></script>
- <div id="{{ $captchaid }}"></div>
- <p id="wait-{{ $captchaid }}" class="show">正在加载验证码...</p>
- @define use Illuminate\Support\Facades\Config
- <script>
- var geetest = function(url) {
- var handlerEmbed = function(captchaObj) {
- $("#{{ $captchaid }}").closest('form').submit(function(e) {
- var validate = captchaObj.getValidate();
- if (!validate) {
- alert('{{ Config::get('geetest.client_fail_alert')}}');
- e.preventDefault();
- }
- });
- captchaObj.appendTo("#{{ $captchaid }}");
- captchaObj.onReady(function() {
- $("#wait-{{ $captchaid }}")[0].className = "hide";
- });
- if ('{{ $product }}' == 'popup') {
- captchaObj.bindOn($('#{{ $captchaid }}').closest('form').find(':submit'));
- captchaObj.appendTo("#{{ $captchaid }}");
- }
- };
- $.ajax({
- url: url + "?t=" + (new Date()).getTime(),
- type: "get",
- dataType: "json",
- success: function(data) {
- initGeetest({
- gt: data.gt,
- challenge: data.challenge,
- product: "{{ $product?$product:Config::get('geetest.product', 'float') }}",
- offline: !data.success,
- new_captcha: data.new_captcha,
- lang: '{{ Config::get('geetest.lang', 'zh-cn') }}',
- http: '{{ Config::get('geetest.protocol', 'http') }}' + '://'
- }, handlerEmbed);
- }
- });
- };
- (function() {
- geetest('{{ $url?$url:Config::get('geetest.url', 'geetest') }}');
- })();
- </script>
- <style>
- .hide {
- display: none;
- }
- </style>
|