define(["knockout"],function(ko){
return function(context){
var me = this;
var countdown;
var flag = false;
me.newMobile = ko.observable("");
me.verificationCode = ko.observable("");
me.getValidateCode = function(){
if(!util.isMobile(me.newMobile())){
$("#vaildPhone").html("手机号码不可用!");
return false;
} else {
if(!flag){
$("#vaildPhone").html("手机号格式正确!");
util.sendAjax({
url:'userCenter/sendVerificationCode/changeMobile/new?mobile='+me.newMobile(),
async:true,
loadFlag:true,
type:'GET',
cache:false,
success:function(json){
if(json.rc==0){
countdown = 60;
settime();
}else{
layer.msg("获取验证码失败:"+json.rc+"错误信息:"+json.msg);
}
}
});
}
}
}
me.getTime = function(){
var time = 60;
util.sendAjax({
url:'open/getCacheTime',
async:false,
loadFlag:true,
type:'GET',
cache:false,
success:function(json){
if(json.rc==0){
time = json.data.time;
if(0