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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
function sendmoblie(img){
    if($("#send").val()=="1"){
        return false;
    }
    var moblie=$("input[name=moblie]").val();
    var authcode=$("input[name=authcode]").val();
    if(moblie==''){
        showToast('手机号不能为空!',2);return false;
    }else if(!isjsMobile(moblie)){
        showToast('手机号码格式错误!',2);return false;
    }
    if(!authcode){
        showToast('请输入图片验证码!',2);return false;
    }
    showLoading();
    $.post(wapurl+"/index.php?c=ajax&a=mobliecert", {str:moblie,code:authcode},function(data) {
        hideLoading();
        if(data){
            var res = JSON.parse(data);
            showToast(res.msg, 2, function(){
                if(res.error == 1){
                    sends(121);
                }else if(res.error == 106){
                    checkCode(img);
                }
            });
        }
    })
}
function sends(i){
    i--;
    if(i==-1){
        $("#time").html("重新获取");
        $("#send").val(0);
    }else{
        $("#send").val(1);
        $("#time").html(i+"秒");
        setTimeout("sends("+i+");",1000);
    }
}
 
 
function check_moblie(img){
 
    var moblie=$("input[name=moblie]").val();
    var authcode=$("input[name=authcode]").val();
    var code=$("#moblie_code").val();
    
    if(moblie==""){ 
        showToast('请输入手机号码!',2);return false;
    }else if(code==""){ 
        showToast('请输入短信验证码!',2);return false;
    }else if(!authcode){
        showToast('请输入验证码!',2);return false;
    }
    
    showLoading();
    
    $.post("index.php?c=binding",{moblie:moblie,code:code},function(data){
 
        hideLoading();
        
        if(data==1){
            if(usertype=='4'){
                showToast('手机绑定成功!',2,function(){window.location.href = 'index.php?c=binding'}); 
            }else{
                showToast('手机绑定成功!',2,function(){window.location.href = 'index.php?c=set'}); 
            }                
        }else if(data==4){
            showToast('短信验证码已过期,请重新发送!',2);
        }else if(data==3){
            showToast('短信验证码不正确!',2);
        }else{
            showToast('请先获取短信验证码!',2); 
        }
    })
}
 
function check_email(img){
    
    var email=$("input[name='email']").val();
    var authcode=$("input[name='authcode']").val();
    var myreg = /^([a-zA-Z0-9\-]+[_|\_|\.]?)*[a-zA-Z0-9\-]+@([a-zA-Z0-9\-]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    
    if(email==''){
        showToast('邮箱不能为空!',2);return false;
    }else if(!myreg.test(email)){
        showToast('邮箱格式错误!',2);return false;
    }else if(!authcode){
        showToast('验证码不能为空!',2);return false;
    }
    
    showLoading();
 
    $.post(wapurl + '/index.php?c=ajax&a=emailcert',{email:email,authcode:authcode},function(data){
        hideLoading();
        if(data){
            if(data=="3"){
                showToast('邮件没有配置,请联系管理员!',2);
            }else if(data=="2"){
                showToast('邮件通知已关闭,请联系管理员!',2);
            }else if(data=="1"){
                if(usertype=='4'){
                    showToast('邮件已发送到您邮箱,请注意查收验证!',2,function(){window.location.href = 'index.php?c=binding'});
                }else{
                    showToast('邮件已发送到您邮箱,请注意查收验证!',2,function(){window.location.href = 'index.php?c=set'});
                }                
            }else if(data=="5"){
                showToast('验证码不能为空!',2);
            }else if(data=="4"){
                showToast('验证码不正确!',2,function(){checkCode(img)});
            }
        }else{
            showToast('请重新登录!',2);
        } 
    })
}