JS를 사용하여 60 초 동안 타이밍을 판단하고, 이벤트를 트리거 할 때, 마지막 요청 시간이 60 초 이상인지 확인하십시오.
그렇지 않으면 요청이 성공하면 현재 시간이 새로 고침 및 특정 구현 방법에 할당됩니다.
다음과 같이 코드 코드를 복사하십시오.
UsingNamespace ( "biz.accountCounder") [ "ClomphoneValidation"] = {
새로 고침 : 0, // 변수
CheckReshget : function (timelimit) // 시간을 확인하십시오. Timelimit은 다음과 같은 요청을 요구하는 시간 (단위 초)입니다.
{{
var nowtime = 새 날짜 ();
var nowminitePoint = nowtime.gethours ()*3600+nowtime.getMinutes ()*60+nowtime.getSeconds ();
if (nowminitepoint-biz.accountcenter.cellphonevalidation.refreshtime <Timelimit) <Timelimit)
{{
거짓을 반환합니다.
}
진실을 반환하십시오.
},
ResetRefreshget : function () // 요청이 성공한 후 호출 메소드가 현재 시간으로 재설정됩니다.
{{
var nowtime = 새 날짜 ();
var nowminitePoint = nowtime.gethours ()*3600+nowtime.getMinutes ()*60+nowtime.getSeconds ();
biz.accountcenter.cellphonevalidation.refreshtime = nowminitepoint;
},
DynamicMessage : 함수 (Timesecond) // 카운트 다운 메소드 시간은 다음과 같은 몇 초입니다. 60
{{
var showtimmer;
if (showtimmer) {
클리어 타임 아웃 (showtimmer);
}
ifsecond == DynamicValidate.refreshtimelimit)
{{
var messagerefresh = $.
$ ( "#spanrefresh").
$ ( "#spanrefresh").
Timesecond-;
}
showtimmer = settimeout (function () {
var messagerefresh = $.
$ ( "#spanrefresh").
Timesecond-;
if (timesecond <0) {
클리어 타임 아웃 (showtimmer);
$ ( "#spanrefresh").
$ ( "#spanrefresh").
} 또 다른 {
biz.accountcenter.cellphonevalidation.dynamicmessage (timesecond);
$ ( "#spanrefresh").
}
}, 1000);
},
생성 : 기능 (OOJ, PAGE, ISCANCELPHONE) //
{{
if (! biz.accountcenter.cellphonevalidation.checkrefreshget (dynamicvalidate.refreshtimelimit)) // 각 요청은 60 년대 시간 간격을 60 년대 시간 간격 사이에서 확인합니다.
{{
$ ( "#ValiateError"). span> "). show ();
$ ( "#mobilewarning");
반품;
}
$ .get ( "url", data, function () {{) {
// 성공한 경우
biz.accountcenter.cellphonevalidation.dynamicmessage (dynamicvalidate.refreshtimelimit);
biz.accountcenter.cellphonevalidation.resetreshget ();
});
}
}