chengkun
2025-05-23 a6f7b382623096b6a00924f418447cf5204e825e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$(document).ready(function(){
 
 
var handlerPopupMobile = function (captchaObj) {
    // 成功的回调
    captchaObj.appendTo("#popup-captcha-mobile");
 
    captchaObj.onSuccess(function () {
        
        var validate = captchaObj.getValidate();
        
        if(validate){
            
    
 
            $("input[name='verify_token']").val(validate.geetest_challenge+'*'+validate.geetest_validate+'*'+validate.geetest_seccode);
            //提交操作
            var type = $('#bind-captcha').attr('data-type');
            var dataid = $('#bind-captcha').attr('data-id');
            //提交表单
            if(type=='submit'){
                $('#'+dataid).submit();
            }else{
                //模拟点击
                $("#"+dataid).trigger("click");
            }
        }
 
    });
    
    $("#bind-submit").click(function(){
        
        captchaObj.verify();
    });
    $("#popup-submit").click(function(){
        $("input[name='verify_token']").val('');
        
        captchaObj.reset();
    });
    
 
};
 
if($("#bind-captcha").length>0){
 
    $.ajax({
            url: wapurl+"/index.php?c=geetest&t=" + (new Date()).getTime(), 
            type: "get",
            dataType: "json",
            success: function (data) {
                
                initGeetest({
                    
                    gt: data.gt,
                    challenge: data.challenge,
                    offline: !data.success,
                    product:'bind',
                    width:"100%",
                    new_captcha: data.new_captcha
                }, handlerPopupMobile);
            }
    });
}
 
});