74 lines
2.2 KiB
JavaScript
74 lines
2.2 KiB
JavaScript
var product_swiper = new Swiper(".product-swiper", {
|
|
loop: true,
|
|
slidesPerView: 4,
|
|
spaceBetween: 20,
|
|
centeredSlides: true,
|
|
grabCursor: true,
|
|
breakpoints: {
|
|
0: {
|
|
slidesPerView: 1,
|
|
centeredSlides: true,
|
|
},
|
|
700: {
|
|
slidesPerView: 2,
|
|
centeredSlides: true,
|
|
},
|
|
1050: {
|
|
slidesPerView: 3,
|
|
centeredSlides: false,
|
|
},
|
|
1450: {
|
|
slidesPerView: 4,
|
|
centeredSlides: false,
|
|
},
|
|
1920: {
|
|
slidesPerView: 4,
|
|
centeredSlides: false,
|
|
},
|
|
},
|
|
});
|
|
|
|
$(document).ready(() => {
|
|
$(".product-prev-button").click(() => {
|
|
console.log("1")
|
|
product_swiper.slidePrev()
|
|
})
|
|
$(".product-next-button").click(() => {
|
|
product_swiper.slideNext()
|
|
})
|
|
})
|
|
|
|
$('#contactus-submit-button').click(() => {
|
|
let comment_title = $('#contactus-first').val() + $('#contactus-last').val()
|
|
let comment_contact = $('#contactus-phone').val() + '|' + $('#contactus-address').val()
|
|
let comment_content = $('#contactus-content').val()
|
|
if ($('#contactus-first').val().length < 1) {
|
|
alert('请输入姓')
|
|
} else if ($('#contactus-last').val().length < 1) {
|
|
alert('请输入名')
|
|
} else if ($('#contactus-phone').val().length < 1) {
|
|
alert('请输入电话')
|
|
} else if ($('#contactus-address').val().length < 1) {
|
|
alert('请输入地址')
|
|
} else if ($('#contactus-content').val().length < 1) {
|
|
alert('请输入您的需求内容')
|
|
} else {
|
|
$.ajax({
|
|
"url": base_url + "/site/comment/add?auth_id=" + "1" + "&auth_key=" + "97a73b7e-9fde-474f-ba2b-ae4703d1e7bb",
|
|
"method": "POST",
|
|
"timeout": 0,
|
|
"headers": {
|
|
"Content-Type": "application/json"
|
|
},
|
|
"data": JSON.stringify({
|
|
comment_title: comment_title,
|
|
comment_contact: comment_contact,
|
|
comment_content: comment_content
|
|
}),
|
|
}).done(function (response) {
|
|
alert(response.errorMessage)
|
|
}).catch(() => {
|
|
alert('网络错误')
|
|
});
|
|
}
|
|
}) |