Commit b6139a9b by doszhang

dos

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