ARBITER.init('LANDING', ['ajax','layerpopup'], function(dom, arbi) { var publicObj, view; var body = $('body').get(0); var scrollPosition = 0; /** * ¿ÜºÎ¿¡¼­ ÂüÁ¶ ÇØ¾ß ÇÒ ÇÔ¼ö°¡ ÀÖ´Â °æ¿ì ÀÌ°÷¿¡ Á¤ÀÇ ÇϽʽÿÀ. * ex) arbi.get('MEMBER_LISTS').test(); */ publicObj = { }; function initialize() { initView(); attachEventHandler(); } function initView() { /* ·Ñ¸µ¹è³Ê °ü·Ã */ new Swiper('.section01_slide', { autoplay : { delay : 2000, disableOnInteraction : false, }, onSlideChangeEnd : true, loop : true, resistance : false, allowTouchMove : false, direction: 'vertical', slidesPerView : 1, spaceBetween: 5 }); new Swiper('.section04_slide', { autoplay : { delay : 2000, disableOnInteraction : false, }, onSlideChangeEnd : true, loop : true, resistance : false, allowTouchMove : false, direction: 'vertical', slidesPerView : 1, spaceBetween : 12, }); new Swiper('.section05_slide , .section07_slide', { autoplay: { delay: 0, disableOnInteraction: false, }, speed: 100000, onSlideChangeEnd: true, loop: true, resistance: false, allowTouchMove: false, direction: 'horizontal', slidesPerView: 'auto', spaceBetween: 18, slidesPerGroup: 10, observer: true, observeParents: true, }); /* ·Ñ¸µ¹è³Ê °ü·Ã */ } function attachEventHandler() { /* ·Î±×ÀÎ */ $("header a#btnLogin").on('click', function() { location.href = "https://www.elsd.co.kr/Member/login"; return false; }); /* ºñµð¿À Àç»ý */ $(".thisVid").mouseenter(function() { if(this.paused) $(this).trigger('play'); }); /* ºñµð¿À Àç»ý */ $(".show_popUp").on('click', function() { act(); }); $(".popUp_box").click(function() { $(".popUp").removeClass("act"); body.style.removeProperty('overflow'); body.style.removeProperty('position'); body.style.removeProperty('top'); body.style.removeProperty('width'); window.scrollTo(0, scrollPosition); }); $(".section04 .con .go_application , .bottom_banner .con a").click(function(){ var offset = $('.section10 .con .application_wrap').offset(); $('html').animate({scrollTop : offset.top}, 400); }); $(".section05 .depth03 .vid_wrap .opacity_wrap").click(function(){ $(this).addClass("hide"); $(".thisVid")[0].play(); }); $("select.area").change(function(e) { if($(this).hasClass('city')) { return false; } setCity(e.target.value); }); $("select[name=consultTimeS]").on('change', function() { var startTimeIdx = $(this)[0].selectedIndex; var endTimeIdx = $("select[name=consultTimeE]").find(":selected").index(); if(endTimeIdx <= startTimeIdx) { $("select[name=consultTimeE] option:eq("+(startTimeIdx)+")").attr('selected', 'selectecd'); } }); $("select[name=consultTimeE]").on('change', function() { var endTimeIdx = $(this)[0].selectedIndex; var startTimeIdx = $("select[name=consultTimeS]").find(":selected").index(); if(endTimeIdx <= startTimeIdx) { $("select[name=consultTimeS] option:eq("+(endTimeIdx)+")").attr('selected', 'selectecd'); } }); $("button#submit").on('click', function() { var sName = $.trim($("input#name").val()); var sPhone = $.trim($("input#tel1").val()+"-"+$("input#tel2").val()+"-"+$("input#tel3").val()); var sAreaDo = $.trim($("select.area.do option:selected").text()); var sAreaCity = $.trim($("select.area.city option:selected").val()); var sSchoolName = $.trim($("input[name=schoolName]").val()); var sConsultTimeS = $.trim($("select[name=consultTimeS] option:selected").text()); var sConsultTimeE = $.trim($("select[name=consultTimeE] option:selected").text()); var cPrivacyAgreeYn = $.trim($('input#privacyAgree').is(":checked") ? "Y" : "N"); var cMarketingMsgYn = $.trim($('input#marketingMsg').is(":checked") ? "Y" : "N"); var data = { 'sName' : sName, 'sPhone' : sPhone, 'sAreaDo' : sAreaDo, 'sAreaCity' : sAreaCity, 'sSchoolName' : sSchoolName, 'sConsultTimeS' : sConsultTimeS, 'sConsultTimeE' : sConsultTimeE, 'cPrivacyAgreeYn' : cPrivacyAgreeYn, 'cMarketingMsgYn' : cMarketingMsgYn } var chkResult = checkData(data); if(chkResult) { var modal = arbi.layerpopup({ id : 'loading', width : 278 + 'px', height : 278 + 'px', content : 'div', //'div', 'ajax', 'iframe', modalClose : false, opacity : .0, zIndex : 9995, html : '
' }); var sUrl = '/Landing/landing/saveConsultInfo'; arbi.ajax(sUrl, data, function(ret) { var ret = JSON.parse(ret); if(ret.code == '0000') { location.href = "/Landing/landing/complete"; return false; alert("½ÅûÀÌ ¿Ï·áµÇ¾ú½À´Ï´Ù."); //location.reload(); } if(ret.code == '0001') { alert("¸Å°³º¯¼ö ¿¡·¯"); } if(ret.code == '0002') { alert("½ÅûÀÌ ½ÇÆÐÇÏ¿´½À´Ï´Ù."); } modal.close(); }); } }); } function checkData(data) { var chkResult = true; $.each(data, function(idx, val) { // À̸§ if(idx == 'sName') { if(val == "") { chkResult = false; alert("À̸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä."); return chkResult; } chkResult = regexCheck(idx, val); console.log(chkResult); if(!chkResult) { alert("ÇÑ±Û ¶Ç´Â ¿µ¹® À̸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä (°ø¹é, Ư¼ö¹®ÀÚ, ¼ýÀÚ ÀÔ·Â ºÒ°¡)."); return chkResult; } } // ¿¬¶ôó if(idx == 'sPhone') { var phone = val.replace(/\-/g, ""); if(phone == "") { chkResult = false; alert("¿¬¶ôó¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä."); return chkResult; } else if(phone.length < 10) { chkResult = false; alert("¿¬¶ôó¸¦ Á¤È®ÇÏ°Ô ÀÔ·ÂÇØ ÁÖ¼¼¿ä."); return chkResult; } else { chkResult = regexCheck(idx, phone); if(!chkResult) { alert("¿¬¶ôó¿¡ ¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä."); return chkResult; } } } // Çпø¸í if(idx == "sSchoolName") { if( val == "" ) { chkResult = false; alert("Çпø¸íÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä."); return chkResult; } chkResult = regexCheck(idx, val); if(!chkResult) { alert("Çпø¸í¿¡ ÇѱÛ, ¿µ¹® ¶Ç´Â ¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä."); return chkResult; } } // Áö¿ª if(idx == "sAreaDo") { if($("select.area.do option:selected").val() == "none") { chkResult = false; alert("Áö¿ªÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä."); return chkResult; } } // °³ÀÎÁ¤º¸ Ãë±Þ¹æħ if(idx == "cPrivacyAgreeYn") { if(val == "N") { chkResult = false; alert("°³ÀÎÁ¤º¸ Ãë±Þ¹æħ¿¡ µ¿ÀÇÇÏ¼Å¾ß ½ÅûÀÌ °¡´ÉÇÕ´Ï´Ù."); return chkResult; } } }); return chkResult; } function setCity(target) { var aCity = area(target); var eleOption = ""; if(aCity != undefined) { aCity.forEach(element => { eleOption += ""; }); $("select.area.city").empty(); $("select.area.city").append(eleOption); } } function regexCheck(target, value) { const regexName = /^[¤¡-¤¾|\uac00-\ud7a3|a-z|A-Z]+$/; const regexSchoolName = /^[¤¡-¤¾|\uac00-\ud7a3|a-z|A-Z|0-9|\s]+$/; const regexPhone = /^[0-9]+$/; if(target == 'sName') { return regexName.test(value); } if(target == 'sSchoolName') { return regexSchoolName.test(value); } if(target == 'sPhone') { return regexPhone.test(value); } } // °³ÀÎÁ¤º¸Ã³¸®¹æħ °ü·Ã function act() { $('.popUp').addClass("act"); scrollPosition = window.pageYOffset; body.style.overflow = 'hidden'; body.style.position = 'fixed'; body.style.top = `-${scrollPosition}px`; body.style.width = '100%'; }; initialize(); });