|
@@ -58,19 +58,31 @@ function detectBrowser(agent){
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
function renderSec00(data) {
|
|
|
let temp = data[0]['data'];
|
|
|
+ renderBullet(temp);
|
|
|
renderBannerStr('sec-00__slider', temp);
|
|
|
$(".sec-00__slider").slick({
|
|
|
dots: false,
|
|
|
- speed: 800,
|
|
|
+ speed: 500,
|
|
|
autoplay: true,
|
|
|
- autoplaySpeed: 5000,
|
|
|
+ autoplaySpeed: 4000,
|
|
|
arrows: true,
|
|
|
prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 32px;color: white;transform: translateY(-10px);"></i></button>',
|
|
|
nextArrow: '<button type="button" class="slick-next"><i class="fas fa-chevron-right" style="font-size: 32px;color: white;transform: translateY(-10px);"></i></button>'
|
|
|
});
|
|
|
+ $('.sec-00__bullet').removeClass('bullet-active');
|
|
|
+ $('.sec-00__bullet').eq($('.slick-active').data('slick-index')).addClass('bullet-active');
|
|
|
+ // $('.sec-00__slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){
|
|
|
+ // console.log(currentSlide);
|
|
|
+ // console.log($('.slick-active').data('slick-index'));
|
|
|
+ // });
|
|
|
+ $('.sec-00__slider').on('afterChange', function(event, slick, currentSlide){
|
|
|
+ console.log(currentSlide);
|
|
|
+ console.log($('.slick-active').data('slick-index'));
|
|
|
+ $('.sec-00__bullet').removeClass('bullet-active');
|
|
|
+ $('.sec-00__bullet').eq(currentSlide).addClass('bullet-active');
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function renderSec02(data) {
|
|
@@ -87,6 +99,15 @@ function detectBrowser(agent){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ function renderBullet(data) {
|
|
|
+ let str = '';
|
|
|
+ for(let i = 0; i < data.length; i++){
|
|
|
+ str += '<div class="sec-00__bullet"></div>'
|
|
|
+ }
|
|
|
+ console.log('bullet');
|
|
|
+ $('.sec-00__bulletList').html(str);
|
|
|
+ }
|
|
|
+
|
|
|
function renderBannerStr(sec, data) {
|
|
|
let str = '';
|
|
|
for(let i = 0; i < data.length; i++){
|
|
@@ -532,17 +553,153 @@ document.addEventListener('lazybeforeunveil', function(e){
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+var stop = 0;
|
|
|
+
|
|
|
$('.container_match2').hide();
|
|
|
$('.match__next').click(function() {
|
|
|
- $('.container_match').fadeOut(0);
|
|
|
- $('.container_match2').fadeIn(500);
|
|
|
- $('.last-step').show();
|
|
|
+ console.log($('#area').val());
|
|
|
+ console.log($('#type').val());
|
|
|
+ if ($('#area').val() == '' || $('#area').val() == null) {
|
|
|
+ $('#area-error').text('請選擇地區');
|
|
|
+ stop = 1;
|
|
|
+ } else {
|
|
|
+ $('#area-error').text('');
|
|
|
+ stop = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($('#type').val() == ''|| $('#type').val() == null) {
|
|
|
+ $('#type-error').text('請選擇房屋類型');
|
|
|
+ stop = 1;
|
|
|
+ } else {
|
|
|
+ $('#type-error').text('');
|
|
|
+ stop = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($('#square').val() == ''|| $('#square').val() == null) {
|
|
|
+ $('#square-error').text('請選擇房屋坪數');
|
|
|
+ stop = 1;
|
|
|
+ } else {
|
|
|
+ $('#square-error').text('');
|
|
|
+ stop = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($('#pattern').val() == ''|| $('#pattern').val() == null) {
|
|
|
+ $('#pattern-error').text('請選擇房屋格局');
|
|
|
+ stop = 1;
|
|
|
+ } else {
|
|
|
+ $('#pattern-error').text('');
|
|
|
+ stop = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($('#style').val() == ''|| $('#style').val() == null) {
|
|
|
+ $('#style-error').text('請選擇喜愛的風格');
|
|
|
+ stop = 1;
|
|
|
+ } else {
|
|
|
+ $('#style-error').text('');
|
|
|
+ stop = 0
|
|
|
+ }
|
|
|
+ console.log(stop);
|
|
|
+ if(stop === 0) {
|
|
|
+ $('.container_match').fadeOut(0);
|
|
|
+ $('.container_match2').fadeIn(500);
|
|
|
+ $('.last-step').show();
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
|
|
|
$('.last-step').hide();
|
|
|
|
|
|
+var name = 0;
|
|
|
+var phone = 0;
|
|
|
+var sex = 0;
|
|
|
+var readPolicy = 0;
|
|
|
+
|
|
|
$('.match__next2').click(function() {
|
|
|
- window.open('./index_match.html');
|
|
|
+ if ($('#name').val() == ''|| $('#name').val() == null) {
|
|
|
+ $('#name-error').text('請填寫您的姓名');
|
|
|
+ name = 1;
|
|
|
+ } else {
|
|
|
+ $('#name-error').text('');
|
|
|
+ name = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($('#phone').val() == ''|| $('#phone').val() == null) {
|
|
|
+ $('#phone-error').text('請以手機格式填寫(格式:0987654321)');
|
|
|
+ phone = 1;
|
|
|
+ } else {
|
|
|
+ $('#phone-error').text('');
|
|
|
+ phone = 0;
|
|
|
+ }
|
|
|
+ console.log($('#phone').val());
|
|
|
+
|
|
|
+ if ($('#sex').val() == ''|| $('#sex').val() == null) {
|
|
|
+ $('#sex-error').text('請選擇性別');
|
|
|
+ sex = 1;
|
|
|
+ } else {
|
|
|
+ $('#sex-error').text('');
|
|
|
+ sex = 0;
|
|
|
+ }
|
|
|
+ if(!$('#readPolicy').prop('checked')) {
|
|
|
+ $('#readPolicy-error').text('必須同意免責聲明與隱私使用政策');
|
|
|
+ readPolicy = 1;
|
|
|
+ } else {
|
|
|
+ $('#readPolicy-error').text('');
|
|
|
+ readPolicy = 0;
|
|
|
+ }
|
|
|
+ var obj = document.getElementsByName("time");
|
|
|
+ var time = [];
|
|
|
+ for (k in obj) {
|
|
|
+ if (obj[k].checked)
|
|
|
+ time.push(obj[k].value);
|
|
|
+ }
|
|
|
+ console.log(time);
|
|
|
+ if(name== 0 && phone == 0 && sex == 0 && readPolicy == 0) {
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "",
|
|
|
+ data:
|
|
|
+ {
|
|
|
+ data: JSON.stringify(
|
|
|
+ {
|
|
|
+ name: $('#name').val(),
|
|
|
+ sex: $('#sex').val(),
|
|
|
+ phone: $('#phone').val(),
|
|
|
+ time: $('#datepicker').val(),
|
|
|
+ area: $('#area').val(),
|
|
|
+ type: $('#type').val(),
|
|
|
+ square: $('#square').val(),
|
|
|
+ pattern: $('#pattern').val(),
|
|
|
+ style: $('#style').val(),
|
|
|
+ time: time.toString(),
|
|
|
+ })
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ if (res.status == "Success") {
|
|
|
+ // gaEvent('功能 - 軟裝需求單 - 送出', '經紀人');
|
|
|
+ Swal.fire({
|
|
|
+ html: '<h5 class="text-primary font-weight-bold">' + res.error + '</h5>',
|
|
|
+ showConfirmButton: true,
|
|
|
+ confirmButtonText: '確定',
|
|
|
+ confirmButtonColor: '#EE7800'
|
|
|
+ }).then(function (result) {
|
|
|
+ if (result.value) {
|
|
|
+ location.reload();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ Swal.fire({
|
|
|
+ title: '似乎出了什麼問題 請稍後再試',
|
|
|
+ showConfirmButton: false,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.error(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ window.open('./index_match.html');
|
|
|
+ }
|
|
|
+
|
|
|
})
|
|
|
|
|
|
$('.last-step').click(function() {
|
|
@@ -550,6 +707,32 @@ $('.last-step').click(function() {
|
|
|
$('.container_match2').fadeOut(0);
|
|
|
$('.last-step').hide();
|
|
|
});
|
|
|
+
|
|
|
+function submit() {
|
|
|
+
|
|
|
+ if ($('#name').val() == '') {
|
|
|
+ $('#name-error').text('請填寫您的姓名');
|
|
|
+ stop = 1;
|
|
|
+ } else {
|
|
|
+ $('#name-error').text('');
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($('#phone').val() == '' || !/^[09]{2}[0-9]{8}$/.test($('#phone').val())) {
|
|
|
+ $('#phone-error').text('請以手機格式填寫(格式:0987654321)');
|
|
|
+ stop = 1;
|
|
|
+ } else {
|
|
|
+ $('#phone-error').text('');
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($('#sex').val() == '') {
|
|
|
+ $('#sex-error').text('請選擇軟裝預算');
|
|
|
+ stop = 1;
|
|
|
+ } else {
|
|
|
+ $('#sex-error').text('');
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
// city result
|
|
|
let cityResult;
|
|
|
$.ajax({
|