blob: e0214abca63770d328eb54f9dd1a25b9cc46a0df [file] [log] [blame]
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
onDeviceReady: function() {
var uid = window.localStorage.getItem("uid");
},
doRegister: function() {
var phone = $("#phone").val();
var code = $("#code").val();
if(isEmpty(phone)||isEmpty(code)){
return;
}
var agree = $("input[type=checkbox]:checked").val();
if(isEmpty(agree)){
$.alert("请同意用户协议与隐私条款", "提示");
return;
}
$.showLoading("正在处理");
var param={
"phone":phone,
"code":code,
"platform":device.name+","+device.platform+","+device.version,
"uuid":device.uuid
}
console.log(param)
ICheckCode(param,function(ok,ret){
if(ok){
$.hideLoading();
console.log(ret)
if(ret.code==200){
window.localStorage.setItem("phone",phone);
window.localStorage.setItem("uid",ret.uid);
window.localStorage.setItem("code",ret.randcode);
window.localStorage.removeItem("name");
window.location="pwdset.html";
}else{
$.alert(ret.msg, "错误");
}
}else{
$.hideLoading();
$.alert("请求失败了"+ret.status+",请稍后再试", "错误");
}
})
},
getCode :function(){
var phone = $("#phone").val();
if(isEmpty(phone)){
return;
}
$.showLoading("请求中");
var param={
"phone":phone
}
IGetCode(param,function(ok,ret){
if(ok){
$.hideLoading();
if(ret.code==200){
$("#codebtn").attr("disabled","disabled")
$("#codebtn").addClass("vcodedisabled")
btnTime('codebtn');
}else{
$.alert(ret.msg, "错误");
}
}else{
$.hideLoading();
$.alert("请求失败了"+ret.status+",请稍后再试", "错误");
}
})
}
};
app.initialize();