Commit d78a521c by doszhang

dos

parent ff42db25
......@@ -66,6 +66,8 @@ let answerArr = [];
let watchedQuestion = [1];
//结果
let resultType = 8;
//提交信息按钮防抖
let submit = true;
//记录初始状态下fontsize
const fontSize = parseFloat($('html').css('fontSize'));
......@@ -146,33 +148,42 @@ $(document).ready(function () {
});
function submit() {
const name = $('input[name=name]').val();
const tel = $('input[name=tel]').val();
if (name.match(/^\s*$/)) {
$('#notification_area').remove();
my_notify('请填写姓名');
return false;
} else if (!tel.match(/^1\d{10}$/)) {
$('#notification_area').remove();
my_notify('电话填写有误');
return false;
}
$.ajax({
url: '/index/commit',
type: 'POST',
data: {
name: name,
tel: tel
},
success: function () {
$('.prize-page').hide();
$('.poster-page').show();
$('input[name=name]').val('');
$('input[name=tel]').val('');
if (submit) {
submit = false;
const name = $('input[name=name]').val();
const tel = $('input[name=tel]').val();
if (name.match(/^\s*$/)) {
$('#notification_area').remove();
my_notify('请填写姓名');
return false;
} else if (!tel.match(/^1\d{10}$/)) {
$('#notification_area').remove();
my_notify('电话填写有误');
return false;
}
})
$.ajax({
url: '/index/commit',
type: 'POST',
data: {
name: name,
tel: tel
},
success: function () {
$('#notification_area').remove();
my_notify('提交成功', 1500);
setTimeout(function () {
$('.prize-page').hide();
$('.poster-page').show();
$('input[name=name]').val('');
$('input[name=tel]').val('');
submit = true;
}, 1500);
}
})
}
}
function tryprize() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment