define(["knockout"],function(ko){
return function(context){
var me = this;
var countdown;
var flag = false;
me.phone = ko.observable("");
me.verificationcode = ko.observable("");
me.downPhone = function(){
$("#showDownPhone").addClass("firstdown");
}
me.getValidateCode = function(val){
if(!util.isMobile(me.phone())){
$("#vaildPhone").html("手机号码不可用!");
return false;
} else {
$("#vaildPhone").html("");
if(!flag){
util.sendAjax({
url:'safe/sms/bindMobile?mobile='+me.phone(),
data:{mobile:me.phone()},
async:true,
loadFlag:true,
type:'GET',
cache:false,
success:function(json){
if(json.rc==0){
countdown = 60;
settime();
}else{
// layer.tips("获取验证码失败:"+json.rc+"错误信息:"+json.msg, '#phone', {
// tips: [1, '#049D5E'],
// time: 5000
// });
layer.msg("获取验证码失败:"+json.rc+"错误信息:"+json.msg);
}
}
});
}
}
}
me.getTime = function(){
var time = 60;
util.sendAjax({
url:'open/getCacheTime',
data:{mobile:me.phone()},
async:false,
loadFlag:true,
type:'GET',
cache:false,
success:function(json){
if(json.rc==0){
time = json.data.time;
if(0