var clientHeight = 0;
$(document).ready(function() {
// 初始化 传入dom id
// var victor = new Victor("container", "output");
// var color = ["#3b5ffc", "#076583"];
// victor(color).set();
// $("#output canvas").eq(0).remove();
getHeight();
});
window.onresize = function() {
getHeight();
}
function getHeight() {
if($(window).height() > $(window).width()) {
clientHeight = $(window).height();
} else {
clientHeight = ($(window).width()) * 1.3;
}
$(".lg-window").height(clientHeight);
}
//60秒倒计时事件
var c = 60;
var setbtn;
function showLogin(url) {
c -= 1;
$("#lgWait").html(c + " s");
if(c <= 0) {
clearInterval(setbtn);
$("#yzmParent").find("#lgWait").remove();
$("#yzmParent").append('');
c = 60;
}
}
//倒计时按钮
function wait(obj) {
alert('操作太过频繁!');
}
//获取验证码
var apiurl = "";
var datastr = {};
window._url = "";
function indentifying(obj) {
if(!(/^1[34578]\d{9}$/.test($("#phone").val()))){
layer.open({
content: '手机号码格式错误!'
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
return false;
}
var authenticate = $(document).find('#authenticate').val();
var send_token_str = $(document).find('#send_token_str').val();
if(authenticate=='' || send_token_str==''){
layer.open({
content: '滑块验证失败,请重新验证!'
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
return false;
}
sendSms($(obj).data('url'));
window._url = $(obj).data('url');
// 验证码发送
$(obj).remove();
$("#yzmParent").append('');
setbtn = setInterval("showLogin()", 1000);
}
function sendSms(url) {
var _mobile = $(document).find('#phone').val();
var authenticate = $(document).find('#authenticate').val();
var send_token_str = $(document).find('#send_token_str').val();
$.ajax({
type: "post",
url: url,
dataType: 'json',
data: {
phone: _mobile,
send_token_str: send_token_str,
authenticate: authenticate,
_token: $("#_token").val()
},
success:function (data) {
if( data.code*1 == 1 ){
layer.open({
content: '发送成功'
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
}else{
layer.open({
content: data.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
}
}
});
}