$(function () {
// IOS 微信浏览器开启点击事件
$("body>*").bind("click",function(){});
//修复移动端 date 不支持placeholder
$('#scan-integral input[type="date"]').focus(function () {
$(this).addClass('full')
});
/*--------------------签到弹出框初始化-------------------------------------*/
$('.popup-modal').magnificPopup({
type:'inline',
midClick: true
});
})
/*-------------------校验表单提示错误框------------------------------------*/
function messageModal(message) {
setTimeout(() => {
$.magnificPopup.open({
items: {
src: '
', // can be a HTML string, jQuery object, or CSS selector
type: 'inline'
}
});
}, 20);
$(document).on('click', '#popup .confirm-button', function () {
$.magnificPopup.close();
})
}
function messageCheckModal(message,icon,callback,button) {
var title="";
if(icon=="check-success") title="有缘分"
else if(icon=="check-fail") title="很遗憾"
// if(icon=="check-un") title="无法识别"
var nocoverUrl="";
if(icon=="check-fail") nocoverUrl="点击进入定制专区"
setTimeout(() => {
$.magnificPopup.open({
items: {
src: '', // can be a HTML string, jQuery object, or CSS selector
type: 'inline'
}
});
}, 20);
$(document).on('click', '#popup .confirm-button', function () {
$.magnificPopup.close();
if(callback!=null) callback();
})
}
function messageCheckFailModal(message,callback,address) {
var nocoverUrl ="点击进入定制专区"
setTimeout(() => {
$.magnificPopup.open({
items: {
src: '', // can be a HTML string, jQuery object, or CSS selector
type: 'inline'
}
});
}, 20);
$(document).on('click', '#popup .confirm-button', function () {
$.magnificPopup.close();
if(callback!=null) callback();
})
}
function messageNoCoverModal(message,callback) {
setTimeout(() => {
$.magnificPopup.open({
items: {
src: '', // can be a HTML string, jQuery object, or CSS selector
type: 'inline'
}
});
}, 20);
$(document).on('click', '#popup .confirm-button', function () {
$.magnificPopup.close();
if(callback!=null) callback();
})
}
function confirmCancel(message, callbackOK,callbackCancel) {
setTimeout(() => {
$.magnificPopup.open({
items: {
src: '', // can be a HTML string, jQuery object, or CSS selector
type: 'inline'
}
});
}, 20);
$(document).on('click', '#popup .btnOK', function () {
$.magnificPopup.close(); callbackOK();
$(document).off('click', '#popup .confirm-button')
});
$(document).on('click', '#popup .btnCancel', function () {
$.magnificPopup.close();
callbackCancel();
$(document).off('click', '#popup .confirm-button')
})
}
/*----------------------获取今天日期-----------------------------------------*/
function getCurrenTime() {
var date = new Date();
var getMonth=date.getMonth()+1
if(date.getMonth()<10){
getMonth='0'+getMonth
}
var dateString = date.getFullYear()+"-"+getMonth+"-"+date.getDate();
return dateString
}
/*--------------------发送短信验证码--------------------------------*/
var countdown=60;
function sendEmail(obj) {
setTime(obj)
}
function setTime(obj) { //发送验证码倒计时
if (countdown == 0) {
obj.attr('disabled',false);
obj.removeClass('gray');
obj.val("点击获取");
countdown = 60;
return;
} else {
obj.attr('disabled',true);
obj.addClass('gray')
obj.val("重新发送(" + countdown + ")");
countdown--;
}
setTimeout(function(){setTime(obj)},1000);
}