-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlingqutyk-services.js
117 lines (105 loc) · 3.81 KB
/
lingqutyk-services.js
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(){
//领取体验课
jQuery(".receiveCourse").click(function(){
var name = $("#name").val();
var phone = $("#phone").val();
var code = $("#code").val();
if(!name || name == null){
jQuery("#myModal").modal();
jQuery(".modal-body").html("请输入姓名");
return false;
}
if(!phone || phone == null){
jQuery("#myModal").modal();
jQuery(".modal-body").html("请输入手机号码");
return false;
}
if(!code || code == null){
jQuery("#myModal").modal();
jQuery(".modal-body").html("请输入验证码");
return false;
}
if(name && phone && code){
jQuery.ajax(getBasePath()+"trial_course/index", {
data: {
name:name,
phone:phone,
code:code,
},
type:"POST",
crossDomain: true,
success: function(response) {
// console.log(response);
jQuery("#myModal").modal();
jQuery(".modal-body").html(response.msg);
jQuery(".receiveCourseForm input[type=reset]").trigger("click");
},
error: function (e) {
jQuery("#myModal").show();
jQuery(".modal-body").html(e.msg)
}
});
}
})
var countdown = 60;
function settime(obj) {
if (countdown == 0) {
obj.removeAttribute("disabled");
obj.style.backgroundColor= "-webkit-linear-gradient(left,#f67f4c, #fc9f38)!important";
obj.innerHTML = "获取验证码";
countdown = 60;
return;
} else {
obj.setAttribute("disabled", true);
obj.style.backgroundColor= "rgba(111,111,111)";
obj.innerHTML = "" + countdown + "秒后再获取";
countdown--;
}
setTimeout(function () {
settime(obj)
}, 1000)
}
var a = document.getElementsByClassName("first-none");
// console.log(a[0]);
// var str="[object Object]";
// a = str.match("[object Object]");
// x[0].innerHTML = str.match("[object Object]");
// console.log("----", $(".first-none").html());
$("#draw").bind('click', sendCode);
//});
//$(".first-none").html =$(".first-none").html(($(".first-none").html()).replace('[object Object]',''))
function sendCode() {
var name = $("#name").val();
var phone = $("#phone").val();
if(!name || name == null){
jQuery("#myModal").modal();
jQuery(".modal-body").html("请输入手机号码");
return false;
}
if(!phone || phone == null){
jQuery("#myModal").modal();
jQuery(".modal-body").html("请输入姓名");
}
if(name && phone){
//获取验证码
// $("#draw").click(function () {
settime(this);
jQuery.ajax(getBasePath()+"sms/sendcode", {
data: {
phone:phone,
},
type:"POST",
crossDomain: true,
success: function(response) {
jQuery("#myModal").modal();
jQuery(".modal-body").html(response.msg);
jQuery("#getlessons input[type=reset]").trigger("click");
},
error: function (e) {
jQuery("#myModal").modal();
jQuery(".modal-body").html(e.msg);
}
});
}
}
})