Commit b6139a9b by doszhang

dos

parent 733121a0
......@@ -139,46 +139,42 @@ $(document).ready(function () {
$('.page7 .btn-close-second').on('click', hideSecond)
$('.page7 .btn-share').on('click', showShare)
$('.share-block').on('click', hideShare)
$('.btn-close-first').on('click',hideFirst)
$('.btn-submit').on('click',submitInfo)
$('.page').on('click', function () {
$('.btn-close-first').on('click', hideFirst)
$('.btn-submit').on('click', submitInfo)
$('.page').on('touchstart', function () {
var audio = document.getElementById('music');
audio.play();
})
});
function submitInfo(){
if(!submitLock) {
function submitInfo() {
if (!submitLock) {
submitLock = true;
const name = $('input[name=name]').val()
const tel = $('input[name=tel]').val()
const address = $('input[name=address]').val()
if(name.match(/^\s*$/))
{
if (name.match(/^\s*$/)) {
$('#notification_area').remove();
my_notify('请输入姓名')
return false;
}
if(tel.match(/^\s*$/))
{
if (tel.match(/^\s*$/)) {
$('#notification_area').remove();
my_notify('请输入电话')
return false;
}
if(!tel.match(/^1\d{10}$/))
{
if (!tel.match(/^1\d{10}$/)) {
$('#notification_area').remove();
my_notify('电话号码输入有误')
return false;
}
if(address.match(/^\s*$/))
{
if (address.match(/^\s*$/)) {
$('#notification_area').remove();
my_notify('请输入地址')
return false;
}
$.ajax({
url: '/index/submitInfo',
type: 'POST',
......@@ -187,30 +183,28 @@ function submitInfo(){
tel: tel,
address: address
},
success: function(resp){
if(resp.status == 1)
{
success: function (resp) {
if (resp.status == 1) {
$('#notification_area').remove();
my_notify('信息已成功提交',2000);
setTimeout(function(){
my_notify('信息已成功提交', 2000);
setTimeout(function () {
$('.first-block').hide();
$('#notification_area').remove();
my_notify('请长按页面保存海报');
submitLock = false;
},2000)
}else {
$('#notification_area').remove();
}, 2000)
} else {
$('#notification_area').remove();
my_notify('网络错误,请重试');
}
}
})
})
}
}
function hideFirst(){
if(!submitLock)
{
function hideFirst() {
if (!submitLock) {
$('.first-block').hide();
$('#notification_area').remove();
my_notify('请长按页面保存海报');
......@@ -277,7 +271,7 @@ function showIntro() {
// introScrolltop = $('.wrap-inner').scrollTop();
$('.wrap-inner').scrollTop(0);
$('.page1').hide();
$('.intro-page').css('height','100%').show();
$('.intro-page').css('height', '100%').show();
$('.wrap-inner').css({
height: '100%',
overflow: 'hidden',
......@@ -342,7 +336,7 @@ function toscene(event) {
}
function toPage2() {
$('.wrap-inner').css({
height: fixHeight + 'px',
overflowX: 'scroll',
......@@ -350,8 +344,8 @@ function toPage2() {
marginTop: '-619px',
top: '50%'
});
$('.maruko').css('top',837 - parseInt(getTranslateDistance()) + 'px')
$('.maruko').css('top', 837 - parseInt(getTranslateDistance()) + 'px')
$('.page1').hide();
$('.page2').show();
......@@ -378,14 +372,14 @@ function showResult(event) {
success: function (resp) {
if (resp.status == 1) {
resultFlag = 10
setTimeout(function(){
$('.page7 .first-block').show();
},1000);
setTimeout(function () {
$('.page7 .first-block').show();
}, 1000);
window.pt = '1'
} else {
setTimeout(function(){
$('.page7 .second-block').show();
},1000);
setTimeout(function () {
$('.page7 .second-block').show();
}, 1000);
window.pt = '2'
}
createPoster(resultFlag)
......@@ -517,8 +511,8 @@ function getTranslateDistance(cardinal = 0, abs = false) {
function init() {
inited = true;
$('input[name=name]').attr('maxLength',10)
$('input[name=tel]').attr('maxLength',11).attr('type','number')
$('input[name=name]').attr('maxLength', 10)
$('input[name=tel]').attr('maxLength', 11).attr('type', 'number')
$('.page6').append('<div class="leaves leaves-1"></div><div class="leaves leaves-2"></div><div class="leaves leaves-3"></div>');
$('.page1').show();
resizeCanvas();
......
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