استخدم JS للحكم على 60 ثانية للتوقيت ، حدد أولاً وقتًا متغيرًا.
خلاف ذلك ، يتم السماح بالطلب.
نسخ رمز رمز على النحو التالي:
باستخدام namespace ("biz.AccountCounder") ["الهاتف المحمول"] = {
RefreshTime: 0 ، // variable
CheckRefreshget: وظيفة (timelimit) // تحقق من الوقت ، timelimit هو الوقت (وحدة ثانية) التي تتطلب تقديم الطلب ، مثل: 60
{{
var nowtime = new date () ؛
var nowminitepoint = nowtime.gethours ()*3600+nowtime.getMinutes ()*60+nowtime.getSeconds () ؛
if (nowminitepoint-biz.accountcenter.cellphonevalidation.refreshtime <timelimit) <timelimit)
{{
العودة كاذبة
}
العودة الحقيقية.
} ،
ResetRefreshget: Function () // بعد نجاح الطلب ، يتم إعادة تعيين طريقة الاتصال إلى الوقت الحالي
{{
var nowtime = new date () ؛
var nowminitepoint = nowtime.gethours ()*3600+nowtime.getMinutes ()*60+nowtime.getSeconds () ؛
Biz.AccountCenter.CellphoneValidation.RefreshTime = nowminitePoint ؛
} ،
DynamicMessage: Function (TimeSecond) // Countdown Method TimeScond هو من عدد الثواني التي تبدأ ، مثل: 60
{{
var showtimmer ؛
إذا (showtimmer) {
ClearTimeout (ShowTimmer) ؛
}
ifSecond == DynamicValidate.RefreshTimeLimit)
{{
var messagerefresh = $.
$ ("#spanrefresh").
$ ("#spanrefresh").
مرة واحدة-؛
}
showtimmer = setTimeout (function () {
var messagerefresh = $.
$ ("#spanrefresh").
مرة واحدة-؛
if (TimeSecond <0) {
ClearTimeout (ShowTimmer) ؛
$ ("#spanrefresh").
$ ("#spanrefresh").
} آخر {
Biz.AccountCenter.CellPhoneValidation.DynamicMessage (TimeSecond) ؛
$ ("#spanrefresh").
}
} ، 1000) ؛
} ،
إنشاء: وظيفة (ooj ، صفحة ، iscancelphone) //
{{
if (! biz.accountcenter.cellphonevalidation.checkrefreshget (DynamicValidate.RefreshTimeLimit)) // كل طلب ، يتحقق JS من الفاصل الزمني الستينيات بين 60s زمني.
{{
$ ("#ValiateRror"). span> "). show () ؛
$ ("#Mobilewarning").
يعود؛
}
$ .ge ("url" ، البيانات ، الدالة () {{) {
// إذا نجحت
Biz.AccountCenter.CellphoneValidation.DynamicMessage (DynamicValidate.RefreshTimeLimit) ؛
Biz.AccountCenter.CellphoneValidation.ResetReshget () ؛
}) ؛
}
}