Initial commit

This commit is contained in:
2025-06-05 14:46:21 +08:00
commit 89e6faffb8
325 changed files with 57267 additions and 0 deletions
+170
View File
@@ -0,0 +1,170 @@
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
function namelist(list){
var dalist=[]
list.forEach(element => {
var obj={}
obj.id = element
obj.name = element
dalist.push(obj)
})
return dalist
}
const options={
method:'GET',//请求模式get
headers:{
'lang':localStorage.getItem('lang')?localStorage.getItem('lang'): 'en'//设置请求标头数据为json格式
},
};
const baseURL='https://server.orzar.shop/'
// const baseURL='https://usedcar.server.hnxinyouhe.com/'
// 定义AJAX工具类
const AjaxUtils = {
// 基础配置
config: {
baseURL: baseURL, // 替换为实际的API基础URL
timeout: 30000, // 请求超时时间
headers: {'lang':localStorage.getItem('lang')?localStorage.getItem('lang'): 'en'}
},
// 设置基础URL
setBaseURL: function(url) {
this.config.baseURL = url;
},
// 设置请求头
setHeaders: function(headers) {
this.config.headers = $.extend({}, this.config.headers, headers);
},
// 获取请求头
getHeaders: function() {
const token = localStorage.getItem('auth_token');
if (token) {
return $.extend({}, this.config.headers, {
'Authorization': `Bearer ${token}`
});
}
return this.config.headers;
},
// 处理响应
handleResponse: function(response) {
if (response.code !== 0) {
throw new Error(response.message || '请求失败');
}
$("#preloader").hide("slow")
return response.data;
},
// GET请求
get: function(url, params = {}) {
$("#preloader").show("slow");
return $.ajax({
url: this.config.baseURL + url,
type: 'GET',
data: params,
headers: this.getHeaders(),
timeout: this.config.timeout,
success: this.handleResponse,
error: function(xhr, status, error) {
$("#preloader").hide("slow")
alert(xhr.responseJSON.message)
// console.error('POST请求错误:', xhr.responseJSON.message);
// throw error;
}
});
},
// POST请求
post: function(url, data = {}) {
// $("#preloader").show("slow");
return $.ajax({
url: this.config.baseURL + url,
type: 'POST',
data: data,
headers: this.getHeaders(),
timeout: this.config.timeout,
success: this.handleResponse,
error: function(xhr, status, error) {
$("#preloader").hide("slow")
alert(xhr.responseJSON.message)
// console.error('POST请求错误:', xhr.responseJSON.message);
// throw error;
}
});
},
// PUT请求
put: function(url, data = {}) {
return $.ajax({
url: this.config.baseURL + url,
type: 'PUT',
data: JSON.stringify(data),
headers: this.getHeaders(),
timeout: this.config.timeout,
success: this.handleResponse,
error: function(xhr, status, error) {
// console.error('POST请求错误:', xhr.responseJSON.message);
// throw error;
}
});
},
// DELETE请求
delete: function(url) {
return $.ajax({
url: this.config.baseURL + url,
type: 'DELETE',
headers: this.getHeaders(),
timeout: this.config.timeout,
success: this.handleResponse,
error: function(xhr, status, error) {
// console.error('POST请求错误:', xhr.responseJSON.message);
// throw error;
}
});
},
// 文件上传
upload: function(url, file, data = {}) {
const formData = new FormData();
formData.append('file', file);
// 添加其他数据
$.each(data, function(key, value) {
formData.append(key, value);
});
return $.ajax({
url: this.config.baseURL + url,
type: 'POST',
data: formData,
processData: false,
contentType: false,
headers: this.getHeaders(),
timeout: this.config.timeout,
success: this.handleResponse,
error: function(xhr, status, error) {
console.error('文件上传错误:', error);
throw error;
}
});
},
// 设置请求拦截器
setRequestInterceptor: function(interceptor) {
this.requestInterceptor = interceptor;
},
// 设置响应拦截器
setResponseInterceptor: function(interceptor) {
this.responseInterceptor = interceptor;
}
};
+662
View File
@@ -0,0 +1,662 @@
// =================== ****************** ================== //
// Template Name: Soccer Club
// Description: Soccer Club Html Template
// Version: 1.0.0
// =================== ****************** ================== //
var MyScroll = "";
(function (window, document, $, undefined) {
"use strict";
// ==========================================================
// Detect mobile device and add class "is-mobile" to </body>
// ==========================================================
// Detect mobile device (Do not remove!!!)
var isMobile =
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Nokia|Opera Mini/i.test(
navigator.userAgent
)
? true
: false;
var Scrollbar = window.Scrollbar;
// Add class "is-mobile" to </body>
var Init = {
i: function (e) {
Init.s();
Init.methods();
},
s: function (e) {
(this._window = $(window)),
(this._document = $(document)),
(this._body = $("body")),
(this._html = $("html"));
},
methods: function (e) {
Init.w();
Init.preloader();
Init.BackToTop();
Init.header();
Init.dropdown();
Init.slick();
Init.categoryToggle();
Init.filterSearch();
Init.passwordIcon();
Init.priceRangeSlider();
Init.niceSelect();
Init.quantityHandle();
Init.countdownInit(".countdown", "2024/12/01");
Init.formValidation();
Init.contactForm();
Init.bookingForm();
},
w: function (e) {
if (isMobile) {
$("body").addClass("is-mobile");
}
},
// Preloader
preloader: function () {
setTimeout(function () {
// $("#preloader").hide("slow");
}, 100);
},
BackToTop: function () {
var scrollToTopBtn = document.querySelector(".scrollToTopBtn");
var rootElement = document.documentElement;
function handleScroll() {
var scrollTotal = rootElement.scrollHeight - rootElement.clientHeight;
if (rootElement.scrollTop / scrollTotal > 0.05) {
scrollToTopBtn.classList.add("showBtn");
} else {
scrollToTopBtn.classList.remove("showBtn");
}
}
function scrollToTop() {
rootElement.scrollTo({ top: 0, behavior: "smooth" });
}
scrollToTopBtn.addEventListener("click", scrollToTop);
document.addEventListener("scroll", handleScroll);
},
dropdown: function () {
const selectedAll = document.querySelectorAll(".wrapper-dropdown");
selectedAll.forEach((selected) => {
const optionsContainer = selected.children[2];
const optionsList = selected.querySelectorAll(
"div.wrapper-dropdown li"
);
selected.addEventListener("click", () => {
let arrow = selected.children[1];
if (selected.classList.contains("active")) {
handleDropdown(selected, arrow, false);
} else {
let currentActive = document.querySelector(
".wrapper-dropdown.active"
);
if (currentActive) {
let anotherArrow = currentActive.children[1];
handleDropdown(currentActive, anotherArrow, false);
}
handleDropdown(selected, arrow, true);
}
});
// update the display of the dropdown
for (let o of optionsList) {
o.addEventListener("click", () => {
selected.querySelector(".selected-display").innerHTML = o.innerHTML;
});
}
});
// check if anything else ofther than the dropdown is clicked
window.addEventListener("click", function (e) {
if (e.target.closest(".wrapper-dropdown") === null) {
closeAllDropdowns();
}
});
// close all the dropdowns
function closeAllDropdowns() {
const selectedAll = document.querySelectorAll(".wrapper-dropdown");
selectedAll.forEach((selected) => {
const optionsContainer = selected.children[2];
let arrow = selected.children[1];
handleDropdown(selected, arrow, false);
});
}
// open all the dropdowns
function handleDropdown(dropdown, arrow, open) {
if (open) {
arrow.classList.add("rotated");
dropdown.classList.add("active");
} else {
arrow.classList.remove("rotated");
dropdown.classList.remove("active");
}
}
},
// Header
header: function () {
function dynamicCurrentMenuClass(selector) {
let FileName = window.location.href.split("/").reverse()[0];
selector.find("li").each(function () {
let anchor = $(this).find("a");
if ($(anchor).attr("href") == FileName) {
$(this).addClass("current");
}
});
selector.children("li").each(function () {
if ($(this).find(".current").length) {
$(this).addClass("current");
}
});
if ("" == FileName) {
selector.find("li").eq(0).addClass("current");
}
}
if ($(".main-menu__list").length) {
let mainNavUL = $(".main-menu__list");
dynamicCurrentMenuClass(mainNavUL);
}
if ($(".main-menu__nav").length && $(".mobile-nav__container").length) {
let navContent = document.querySelector(".main-menu__nav").innerHTML;
let mobileNavContainer = document.querySelector(
".mobile-nav__container"
);
mobileNavContainer.innerHTML = navContent;
}
if ($(".sticky-header__content").length) {
let navContent = document.querySelector(".main-menu").innerHTML;
let mobileNavContainer = document.querySelector(
".sticky-header__content"
);
mobileNavContainer.innerHTML = navContent;
}
if ($(".mobile-nav__container .main-menu__list").length) {
let dropdownAnchor = $(
".mobile-nav__container .main-menu__list .dropdown > a"
);
dropdownAnchor.each(function () {
let self = $(this);
let toggleBtn = document.createElement("BUTTON");
toggleBtn.setAttribute("aria-label", "dropdown toggler");
toggleBtn.innerHTML = "<i class='fa fa-angle-down'></i>";
self.append(function () {
return toggleBtn;
});
self.find("button").on("click", function (e) {
e.preventDefault();
let self = $(this);
self.toggleClass("expanded");
self.parent().toggleClass("expanded");
self.parent().parent().children("ul").slideToggle();
});
// console.log($(this).hasClass('branditems'))
if($(this).hasClass('branditems')){
self.toggleClass("expanded");
self.children().toggleClass("expanded");
// self.parent().parent().children("ul").slideToggle();
// $(".flex-layout").css('display','none')
}else{
self.find("button").click()
}
});
}
if ($(".mobile-nav__toggler").length) {
$(".mobile-nav__toggler").on("click", function (e) {
e.preventDefault();
$(".mobile-nav__wrapper").toggleClass("expanded");
$("body").toggleClass("locked");
});
}
$(window).on("scroll", function () {
if ($(".stricked-menu").length) {
var headerScrollPos = 130;
var stricky = $(".stricked-menu");
if ($(window).scrollTop() > headerScrollPos) {
stricky.addClass("stricky-fixed");
} else if ($(this).scrollTop() <= headerScrollPos) {
stricky.removeClass("stricky-fixed");
}
}
});
},
// Slick Slider
slick: function () {
if ($(".blog-slider").length) {
$(".blog-slider").slick({
slidesToShow: 3,
slidesToScroll: 1,
infinite: true,
autoplay: false,
dots: false,
draggable: true,
arrows: false,
lazyLoad: "progressive",
speed: 800,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 2,
},
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
},
},
],
});
}
if ($(".highlights-slider").length) {
$(".highlights-slider").slick({
slidesToShow: 3,
slidesToScroll: 1,
infinite: true,
autoplay: true,
dots: false,
draggable: true,
arrows: false,
lazyLoad: "progressive",
speed: 800,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 2,
},
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
},
},
],
});
}
if ($(".brand-slider").length) {
$(".brand-slider").slick({
infinite: true,
slidesToShow: 6,
arrows: false,
autoplay: true,
cssEase: "linear",
autoplaySpeed: 0,
speed: 8000,
pauseOnFocus: false,
pauseOnHover: false,
responsive: [
{
breakpoint: 1699,
settings: {
slidesToShow: 5,
},
},
{
breakpoint: 1599,
settings: {
slidesToShow: 4,
},
},
{
breakpoint: 769,
settings: {
slidesToShow: 3,
},
},
{
breakpoint: 576,
settings: {
slidesToShow: 2,
},
},
{
breakpoint: 450,
settings: {
slidesToShow: 1,
},
},
],
});
}
if ($(".shop-slider").length) {
$(".shop-slider").slick({
slidesToShow: 4,
slidesToScroll: 1,
infinite: true,
autoplay: false,
dots: false,
draggable: true,
arrows: false,
lazyLoad: "progressive",
speed: 800,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 1025,
settings: {
slidesToShow: 3,
},
},
{
breakpoint: 992,
settings: {
slidesToShow: 2,
},
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
},
},
],
});
}
if ($(".testimonials-slider").length) {
$(".testimonials-slider").slick({
slidesToShow: 4,
slidesToScroll: 1,
infinite: true,
autoplay: true,
dots: false,
draggable: true,
arrows: false,
cssEase: "linear",
lazyLoad: "progressive",
speed: 800,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 3,
},
},
{
breakpoint: 1025,
settings: {
slidesToShow: 2,
},
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
},
},
],
});
}
$(".btn-prev").click(function () {
var $this = $(this).attr("data-slide");
$("." + $this).slick("slickPrev");
});
$(".btn-next").click(function () {
var $this = $(this).attr("data-slide");
$("." + $this).slick("slickNext");
});
},
// Filter Toggle Button
categoryToggle: function () {
if ($(".category-block").length) {
$(".category-block .title").on("click", function (e) {
var count = $(this).data("count");
if (
$(".category-block.box-" + count + " .content-block").is(":visible")
) {
$(".category-block.box-" + count + " i").removeClass(
"fa-horizontal-rule"
);
$(".category-block.box-" + count + " i").addClass("fa-plus");
$(".category-block.box-" + count + " .content-block").hide("slow");
} else {
$(".category-block.box-" + count + " i").removeClass("fa-plus");
$(".category-block.box-" + count + " i").addClass(
"fa-horizontal-rule"
);
$(".category-block.box-" + count + " .content-block").show("slow");
}
});
}
if ($(".customer-container").length) {
$(".signin-button").click(function () {
$(".sign-form").slideToggle();
});
}
if ($("#shipAddress").length) {
$(".billing-address").hide();
$("#shipAddress").change(function () {
if ($(this).is(":unchecked")) {
$(".billing-address").hide("slow");
} else {
$(".billing-address").show("slow");
}
});
}
},
filterSearch: function () {
if ($("#searchInput").length) {
$("#searchInput").on("keyup", function () {
var value = $(this).val().toLowerCase();
$(".blogs-block").filter(function () {
var hasMatch =
$(this).find(".blog-title").text().toLowerCase().indexOf(value) >
-1;
$(this).toggle(hasMatch);
});
});
}
},
// Password Icon
passwordIcon: function () {
$("#eye , #eye-icon").click(function () {
if ($(this).hasClass("fa-eye-slash")) {
$(this).removeClass("fa-eye-slash");
$(this).addClass("fa-eye");
$(".password-input").attr("type", "text");
} else {
$(this).removeClass("fa-eye");
$(this).addClass("fa-eye-slash");
$(".password-input").attr("type", "password");
}
});
},
priceRangeSlider: function () {
const priceGap = 1000;
$(".price-input input").on("input", function () {
let minPrice = parseInt($(".price-input .input-min").val()),
maxPrice = parseInt($(".price-input .input-max").val());
if (
maxPrice - minPrice >= priceGap &&
maxPrice <= $(".range-input .range-max").attr("max")
) {
if ($(this).hasClass("input-min")) {
$(".range-input .range-min").val(minPrice);
$(".slider .progress").css(
"left",
(minPrice / $(".range-input .range-min").attr("max")) * 100 + "%"
);
} else {
$(".range-input .range-max").val(maxPrice);
$(".slider .progress").css(
"right",
100 -
(maxPrice / $(".range-input .range-max").attr("max")) * 100 +
"%"
);
}
}
});
$(".range-input input").on("input", function () {
let minVal = parseInt($(".range-input .range-min").val()),
maxVal = parseInt($(".range-input .range-max").val());
if (maxVal - minVal < priceGap) {
if ($(this).hasClass("range-min")) {
$(".range-input .range-min").val(maxVal - priceGap);
} else {
$(".range-input .range-max").val(minVal + priceGap);
}
} else {
$(".price-input .input-min").val(minVal);
$(".price-input .input-max").val(maxVal);
$(".slider .progress").css(
"left",
(minVal / $(".range-input .range-min").attr("max")) * 100 + "%"
);
$(".slider .progress").css(
"right",
100 -
(maxVal / $(".range-input .range-max").attr("max")) * 100 +
"%"
);
}
});
},
// Nice Select
niceSelect: function () {
if ($(".has-nice-select").length) {
$(".has-nice-select, .contact-form select").niceSelect();
}
},
// Quantity Controller
quantityHandle: function () {
$(".decrement").on("click", function () {
var qtyInput = $(this).closest(".quantity-wrap").children(".number");
var qtyVal = parseInt(qtyInput.val());
if (qtyVal > 0) {
qtyInput.val(qtyVal - 1);
}
});
$(".increment").on("click", function () {
var qtyInput = $(this).closest(".quantity-wrap").children(".number");
var qtyVal = parseInt(qtyInput.val());
qtyInput.val(parseInt(qtyVal + 1));
});
},
// Countdown Timer
countdownInit: function (countdownSelector, countdownTime, countdown) {
var eventCounter = $(countdownSelector);
if (eventCounter.length) {
eventCounter.countdown(countdownTime, function (e) {
$(this).html(
e.strftime(
"<li><h2>%D</h2><h6>Days</h6></li>\
<li><h2>%H</h2><h6>Hrs</h6></li>\
<li><h2>%M</h2><h6>Mins</h6></li>\
<li><h2>%S</h2><h6>Secs</h6></li>"
)
);
});
}
},
// Form Validation
formValidation: function () {
if ($(".contact-form").length) {
$(".contact-form").validate();
}
if ($(".car-booking-form").length) {
$(".car-booking-form").validate();
}
if ($(".login-form").length) {
$(".login-form").validate();
}
},
// Contact Form
contactForm: function () {
$(".contact-form").on("submit", function (e) {
e.preventDefault();
if ($(".contact-form").valid()) {
var _self = $(this);
_self
.closest("div")
.find('button[type="submit"]')
.attr("disabled", "disabled");
var data = $(this).serialize();
$.ajax({
url: "./assets/mail/contact.php",
type: "post",
dataType: "json",
data: data,
success: function (data) {
$(".contact-form").trigger("reset");
_self.find('button[type="submit"]').removeAttr("disabled");
if (data.success) {
document.getElementById("message").innerHTML =
"<h4 class='color-primary mt-16 mb-16'>Email Sent Successfully</h4>";
} else {
document.getElementById("message").innerHTML =
"<h4 class='color-primary mt-16 mb-16'>There is an error</h4>";
}
$("#messages").show("slow");
$("#messages").slideDown("slow");
setTimeout(function () {
$("#messages").slideUp("hide");
$("#messages").hide("slow");
}, 4000);
},
});
} else {
return false;
}
});
},
bookingForm: function(){
$(".bookingProcced").on("click", function () {
$('.stepone').hide('slow');
$('.steptwo').show('slow');
});
}
};
Init.i();
})(window, document, jQuery);
+175
View File
@@ -0,0 +1,175 @@
$(function() {
// facetwp-radio 点击切换效果
// $(document).on('click', '.facetwp-radio', function() {
// $('.facetwp-radio').removeClass('checked');
// $(this).addClass('checked');
// });
var id = getQueryString("id")
var vm = new Vue({
el: '#brandapp',
data: {
currentPage: 1, // 当前页码
pageSize: 12, // 每页条数
totalItems: 0, // 总数据量(后端分页用)
energy:'',
dataList: [],
energylist:[]
},
computed: {
// 当前页数据(前端分页)
currentPageData() {
const start = (this.currentPage - 1) * this.pageSize;
return this.allData.slice(start, start + this.pageSize);
},
// 总页数
totalPages() {
return Math.ceil(this.totalItems / this.pageSize);
},
// 动态页码范围
visiblePages() {
const maxVisible = 5;
let start = Math.max(1, this.currentPage - 2);
let end = Math.min(start + maxVisible - 1, this.totalPages);
return Array.from({
length: end - start + 1
}, (_, i) => start + i);
}
},
watch: {
currentPage() {
this.fetchData(); // 后端分页时触发数据更新
}
},
created: function() {
this.fetchData()
this.energylistfn()
},
methods: {
fetchData() {
var that = this
AjaxUtils.get('apis/vehicle/new/list', {
page: this.currentPage,
per_page: this.pageSize,
brand:id,
energy:this.energy,
}).done(function(data) {
that.dataList = data.data.list
that.allData = data.data.list; // 前端分页时存储所有数据
that.totalItems = data.data.meta.total; // 后端分页时更新总数
// if(that.dataList.length<=0){
// that.isshow = true
// that.licklistfn()
// }else{
// that.isshow = false
// }
// console.log(data.data.list);
}).fail(function(error) {
// console.error(error);
});
},
energylistfn() {
var that = this
AjaxUtils.get('apis/vehicle/energy', {
brand:id,
}).done(function(data) {
that.energylist = data.data
}).fail(function(error) {
// console.error(error);
});
},
energyclick(item){
if(item==''){
this.energy =''
}else{
this.energy = item.id
}
this.fetchData()
},
prevPage() {
if (this.currentPage > 1) this.currentPage--;
$('html, body').animate({
scrollTop: $('.navs').offset().top - 0
}, 0);
},
nextPage() {
if (this.currentPage < this.totalPages) {
this.currentPage++
};
$('html, body').animate({
scrollTop: $('.navs').offset().top - 0
}, 0);
},
gotoPage(page) {
this.currentPage = page;
},
godetil(item) {
window.location.href = 'newcar-details.html?id=' + item.id
}
},
})
AjaxUtils.get('apis/brand/detail/'+id, {}).done(function(data) {
var datas = data.data;
$(".brandname").html(datas.name)
$(".dese").html(datas.desc)
$(".topimg").html('<img src="'+datas.toppic_full+'" class="attachment-full size-full" decoding="async" fetchpriority="high" >')
$(".descpicing").html('<img src="'+datas.descpic_full+'" alt="car">')
var bannerhtml=''
$.each(datas.banner,function(){
bannerhtml+= `<div class="col-12"><a href="#"><img src="${this.pic_full}" alt="" /></a> </div>`
});
$(".slider").html(bannerhtml)
initslick()
var traithtml=''
$.each(datas.trait,function(){
traithtml+= `<div class="xz-card-68ae col-lg-4 col-md-6 col-sm-12">
<h4 class="tit">${this.title}</h4><p class="txt">${this.content}</p>
</div>`
});
$(".trait").html(traithtml)
}).fail(function(error) {
// console.error(error);
});
})
function initslick(){
$(".slider").slick({
slidesToShow: 3,
slidesToScroll: 1,
infinite: true,
autoplay: true,
dots: false,
draggable: true,
arrows: false,
cssEase: "linear",
lazyLoad: "progressive",
speed: 800,
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 3,
},
},
{
breakpoint: 1025,
settings: {
slidesToShow: 2,
},
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
},
},
],
});
}
$(function () {
});
+36
View File
@@ -0,0 +1,36 @@
$(function() {
var from_$input = $('.date_from').pickadate(),
from_picker = from_$input.pickadate('picker')
var to_$input = $('.date_to').pickadate(),
to_picker = to_$input.pickadate('picker')
// Check if there’s a “from” or “to” date to start with.
if ( from_picker.get('value') ) {
to_picker.set('min', from_picker.get('select'))
}
if ( to_picker.get('value') ) {
from_picker.set('max', to_picker.get('select'))
}
// When something is selected, update the “from” and “to” limits.
from_picker.on('set', function(event) {
if ( event.select ) {
to_picker.set('min', from_picker.get('select'))
}
else if ( 'clear' in event ) {
to_picker.set('min', false)
}
})
to_picker.on('set', function(event) {
if ( event.select ) {
from_picker.set('max', to_picker.get('select'))
}
else if ( 'clear' in event ) {
from_picker.set('max', false)
}
})
});
+130
View File
@@ -0,0 +1,130 @@
// 同步加载 markers.json 文件
function loadJSONSync(url) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false); // false 表示同步请求
try {
xhr.send(null);
if (xhr.status === 200) {
return JSON.parse(xhr.responseText);
} else {
// console.error('请求失败,状态码:', xhr.status);
return null;
}
} catch (e) {
// console.error('请求过程中出错:', e);
return null;
}
}
// DOM元素
const elements = {
htmlElement: document.documentElement,
bodyElement: document.body
};
// 点击选择框时显示/隐藏选项
$(".select-selected").click(function() {
$(this).toggleClass("select-arrow-active");
$(this).next(".select-items").toggle();
});
// 点击页面其他位置时关闭下拉框
$(document).click(function(e) {
if (!$(e.target).closest(".custom-select").length) {
$(".select-selected").removeClass("select-arrow-active");
$(".select-items").hide();
}
});
const i18n = {
currentLang: 'en', // 默认语言
init: function() {
var that = this
this.currentLang = localStorage.getItem('lang')?localStorage.getItem('lang'): 'en';
this.loadLanguage(this.currentLang);
if (this.currentLang === 'ar') {
elements.htmlElement.lang = 'ar';
elements.htmlElement.dir = 'rtl';
elements.bodyElement.setAttribute('dir', 'rtl');
} else {
elements.htmlElement.lang = this.currentLang;
elements.htmlElement.dir = 'ltr';
elements.bodyElement.removeAttribute('dir');
}
// 点击选项时更新选择
$(".select-items div").click(function() {
// 更新显示文本
const selectedText = $(this).text();
// $(".select-selected").text(selectedText);
// 更新选中状态样式
$(".select-items div").removeClass("same-as-selected");
$(this).addClass("same-as-selected");
// 隐藏选项框
$(".select-selected").removeClass("select-arrow-active");
$(".select-items").hide();
// 显示当前选择
localStorage.setItem('langtext', selectedText);
that.toggleLanguage($(this).attr('data-id'))
localStorage.setItem('lang', $(this).attr('data-id'));
location.reload();
});
},
loadLanguage: function(lang) {
var data = loadJSONSync(`./assets/js/lang/${lang}.json`);
// console.log(data)
// $('[data-i18n]').each(function() {
// const key = $(this).data('i18n');
// $(this).text(data[key]); // 更新文本内容
// });
// 常规文本内容
$('[data-i18n]').each(function() {
const keys = $(this).data('i18n').split('.');
let value = data;
keys.forEach(key => {
value = value[key];
});
$(this).text(value || '');
});
// placeholder翻译
$('[data-i18n-placeholder]').each(function() {
const keys = $(this).data('i18n-placeholder').split('.');
let value = data;
keys.forEach(key => {
value = value[key];
});
$(this).attr('placeholder', value || '');
// console.log($(this).attr('placeholder'))
});
// option文本翻译
$('option[data-i18n]').each(function() {
const keys = $(this).data('i18n').split('.');
let value = data;
keys.forEach(key => {
value = value[key];
});
$(this).text(value || '');
});
},
toggleLanguage: function(selectedText) {
// console.log(selectedText)
// console.log('111')
this.currentLang = selectedText;
this.loadLanguage(this.currentLang);
if (this.currentLang === 'ar') {
elements.htmlElement.lang = 'ar';
elements.htmlElement.dir = 'rtl';
elements.bodyElement.setAttribute('dir', 'rtl');
} else {
elements.htmlElement.lang = this.currentLang;
elements.htmlElement.dir = 'ltr';
elements.bodyElement.removeAttribute('dir');
}
}
};
$(document).ready(() => i18n.init());
+183
View File
@@ -0,0 +1,183 @@
$(function() {
Vue.component('v-select', VueSelect.VueSelect);
var vm = new Vue({
el: '#app',
data: {
reactdata: '222',
name: '',
phone: '',
email: '',
content: '',
emailinput: '',
dataList: [],
model: [],
brandlist: [],
energy: [],
mileage: [],
pricemin: [],
pricemax: [],
mileagemin: [],
mileagemax: [],
score_status: [],
vehicletypes: [],
select: {
brand: '',
model: '',
energy: '',
store_status: '',
min_price: '',
max_price: '',
min_mileage: '',
max_mileage:'',
price:'',
mileage:'',
},
},
created: function() {
this.getbrand()
this.hotList()
this.vehicletypesfn()
},
methods: {
// 热门
hotList() {
var that = this
AjaxUtils.get('apis/vehicle/list', {
page: 1,
per_page: 4,
is_hot: 1
}).done(function(data) {
that.dataList = data.data.list
}).fail(function(error) {
// console.error(error);
});
},
//车辆类型快捷搜索
vehicletypesfn() {
var that = this
AjaxUtils.get('apis/vehicle/types', {}).done(function(data) {
that.vehicletypes = data.data
}).fail(function(error) {
// console.error(error);
});
},
vehicletypesgo(item) {
window.location.href = 'rental-sidebar.html?type=' + item.id
},
godetil(item) {
window.location.href = 'vehicle-details.html?id=' + item.id
},
getbrand(brand_id) {
var that = this
AjaxUtils.get('apis/search/options', {}).done(function(data) {
var datas = data.data
that.brandlist = datas.brand
that.energy = datas.energy
that.mileage = datas.price
that.pricemin = datas.mileage
that.mileagemin = datas.mileage
that.score_status = datas.score_status
that.type = datas.type
}).fail(function(error) {
// console.error(error);
});
},
//获取品牌类型
getmodels(brand_id) {
var that = this
AjaxUtils.get('apis/get/models', {
brand_id: brand_id
}).done(function(data) {
that.model = data.data
}).fail(function(error) {
// console.error(error);
});
// fetch(baseURL+'apis/get/models?brand_id='+brand_id,options)
// .then(response => {
// if (!response.ok) {
// throw new Error('Network response was not ok');
// }
// return response.json();
// })
// .then(data => {
// that.model = data.data
// // console.log(that.model)
// })
// .catch(error => {
// this.error = error.message;
// this.loading = false;
// });
},
//品牌选择
onSelectbrand(item) {
this.select.brand = item
this.getmodels(item)
},
//类型
onSelectmodel(item) {
this.select.model = item
},
onSelectengineType(item) {
this.select.energy = item
},
onSelectinventoryStatus(item) {
this.select.store_status = item
},
onSelectpriceFromLow(item) {
var min=''
var max=''
if (item == null) {
item = ''
}else{
min = item.split(/\s*-\s*/).map(Number)[0];
max = item.split(/\s*-\s*/).map(Number)[1];
}
this.select.min_price = min
this.select.max_price = max
this.select.price = item
},
onSelectmileageRange(item) {
var min=''
var max=''
if (item == null) {
item = ''
}else{
min = item.split(/\s*-\s*/).map(Number)[0];
max = item.split(/\s*-\s*/).map(Number)[1];
}
this.select.min_mileage = min
this.select.max_mileage = max
this.select.mileage = item
},
serchfn() {
const params = new URLSearchParams();
Object.entries(this.select).forEach(([key, value]) => {
if (value !== null && value !== undefined && value !== '') {
params.append(key, value);
}
});
// console.log(params.toString())
// 跳转到rental-sidebar页面并传递参数
window.location.href = `rental-sidebar.html?${params.toString()}`;
},
bookfn() {
if (this.name == '') {
}
AjaxUtils.post('apis/contact/add', {
name: this.name,
phone: this.phone,
email: this.email,
content: this.content,
vehicle_id: 0
}).done(function(result) {
alert(result.data.message)
// console.log(result);
}).fail(function(error) {
// console.error(error);
});
}
},
})
});
+8
View File
@@ -0,0 +1,8 @@
{
"zh": "中文",
"en": "English",
"ru": "Русский",
"ar": "العربية",
"lang":"العربية",
"title":"فقط السيارات المجربة بأسعار شفافة."
}
+181
View File
@@ -0,0 +1,181 @@
{
"home": "Home",
"about": "About Us",
"UsedCar": "Used Cars",
"newcar": "New Cars",
"Contactus": "Contact Us",
"consult": "Contact Us",
"zh": "中文",
"en": "English",
"ru": "Русский",
"ar": "العربية",
"lang":"English",
"Submit":"Submit A Request",
"title":"Certified Quality. Fair Pricing.",
"Subscribe":"Subscribe To Our Newsletter",
"bay":"Buy",
"source":"Source",
"smallprogram":"small program",
"lick":"You May Also Like",
"PrivacyPolicy":"Privacy Policy",
"errors":"Sorry, no suitable car models were found",
"search":{
"brand": "Brand",
"model": "Model",
"Type": "Type",
"engineType": "Engine Type",
"inventoryStatus": "Inventory Status",
"priceFromLow": "Price (Range)",
"priceToHigh": "Price To High",
"startYear": "Start Year",
"endYear": "End Year",
"mileageRangemin": "Kilometers (Range)",
"mileageRangemax": "Kilometers (highest)",
"vehicleType": "Vehicle Type",
"drivetrain": "Drivetrain",
"clearAll": "Clear All"
},
"inventoryStatus":{
"inStock": "In Stock",
"inTransit": "In Transit",
"onOrder": "On Order"
},
"sectionTitles": {
"carIntroduction": "Vehicle Introduction",
"ourServices": "Our Services",
"relatedProducts": "Related Products",
"contactConsultation": "Contact/Inquiry",
"hot":"Hot",
"all":"See all cars",
"QuickLinks":"Quick Links",
"Contactinfo":"Contact info",
"Followus":"Follow us!",
"Location":"Location",
"Locations":"Location:",
"OpeningHours":"Opening Hours",
"Views":"Views:"
},
"carinfo":{
"front45Degree": "45° Front",
"leftFront45Degree": "Left Front 45°",
"leftFrontHeadlight": "Left Front Headlight",
"front": "Front",
"frontLowerPart": "Front Lower Part",
"wheelHub": "Wheel Hub",
"rightFrontSeat": "Right Front Seat",
"rightBottomEdge": "Right Bottom Edge",
"rightRearTaillight": "Right Rear Taillight",
"rightRear45Degree": "Right Rear 45°",
"rearLowerPart": "Rear Lower Part",
"trunk": "Trunk",
"leftBottomEdge": "Left Bottom Edge",
"rearSeat": "Rear Seat",
"console": "Console",
"controlPanel": "Control Panel",
"gearLever": "Gear Lever",
"key": "Key",
"steeringWheel": "Steering Wheel",
"dashboard": "Dashboard",
"displayedMileage": "Displayed Mileage",
"leftFrontDoorPanel": "Left Front Door Panel",
"leftFrontDoorFunctionArea": "Left Front Door Function Area",
"leftFrontSeat": "Left Front Seat",
"ceiling": "Ceiling",
"brand": "Brand",
"price": "Price (¥)",
"status": "Status",
"vehicle_type": "Type",
"vehicle_energy": "Energy Type",
"mileage": "Mileage (km)",
"vehicle_age": "Age (years)"
},
"exhibitionhall":{
"title":"Minsk Exhibition Hall",
"text":"We are pleased to meet you at the Minsk exhibition hall. We will answer all questions and select your car.",
"position":"Republic of Belarus Minsk City Leonidas Beida 46",
"time":"Monday to Friday: 9am to 6pm",
"time1":"Saturday: 9:00am to 5:00pm",
"time2":"Sunday: Rest Day"
},
"companyinfo":{
"companyname":"Orzar",
"tel":"+375(29)524803",
"phone":"+86-18603858592",
"position":"Republic of Belarus Minsk City Leonidas Beida 46",
"time":"Mon-Sat (09 AM - 06PM)",
"Phonenumber":"Phone number",
"title1":"Annual export of 436,000 used cars worldwide, with over 60% market share in Central Asia — Our Belarus showroom delivers premium Chinese vehicles directly to Central Asian clients!",
"title2":"6 out of 10 imported cars in Kazakhstan are from China! Leveraging Khorgos Port as a hub, we ensure efficient delivery across Central Asia.",
"title3":"81% of Uzbekistan’s imported vehicles originate from China. We provide one-stop cross-border services for seamless car procurement in Central Asia."
},
"placeholder":{
"describe":"Describe information...",
"Phone":"Phone number *",
"Name":"Your name *",
"email":"Email",
"youremali":" Your email address"
},
"button":{
"Seeallcars":"See all cars",
"cheapcar":"Inquiry Now"
},
"Hear":{
"name":"Ahmed – UAE",
"Vehicle":"Mercedes-Benz GLE 450 2020",
"Review":"Smooth ride and powerful engine. The car was delivered in excellent condition, and all electronics are working perfectly. Worth every dollar.",
"name1":"Faisal – Saudi Arabia",
"Vehicle1":"Toyota Land Cruiser 5.7 V8 2019",
"Review1":"This LC is a beast. Clean inside out, no engine noise, and ready for desert terrain. Couldn’t have asked for a better vehicle.",
"name2":"Carlos – Peru",
"Vehicle2": "BYD Song Plus EV 2022",
"Review2":"I've been using this car for three months now, and it’s impressive. Silent, powerful, and the range is real. Chinese EVs have come a long way.",
"name3":"Lucas – Brazil",
"Vehicle3": "Toyota Corolla Altis 1.8 Hybrid 2020",
"Review3":"Low fuel consumption and very comfortable interior. AC works great, suspension is tight. Perfect for daily driving in São Paulo.",
"name4":"Mateo – Ecuador",
"Vehicle4": "Mercedes-Benz C200 AMG Line 2019",
"Review4":"The interior still smells like new. The infotainment system is smooth, and engine performance is solid. A real premium experience.",
"name5":"Aidos – Kazakhstan",
"Vehicle5": "BYD Yuan Plus EV 2023",
"Review5":"This is my first EV and I love it. Charging at home is easy, and it drives like a much more expensive SUV. Excellent features.",
"name6":"Juan – Mexico",
"Vehicle6": "Toyota RAV4 2.5 AWD 2018",
"Review6":"Solid SUV for family trips. AWD handles well in rain and hills. Everything works, no check lights. Would recommend.",
"name7":"Emeka – Nigeria",
"Vehicle7": "Mercedes-Benz GLK 350 4MATIC 2015",
"Review7":"Bought this for long-distance travel. Clean engine, very stable on the road, and luxury feel is still there. Happy customer!"
},
"content":{
"TopPick":"Top Pick Vehicles This Month",
"TopPicktxt":"Lorem ipsum dolor sit amet consectetur. Ut porttitor proin id sem",
"TopPicktxt1":" lacus volutpat. Bibendum metus in imperdiet sed habitant.",
"WideRange":"Wide Range Of Vehicles",
"WideRangetext":"Lorem ipsum dolor sit amet consectetur. Velit amet quam tristique aliquet urna proin nam pellentesque risus",
"HearFrom":"Hear From Our Customers",
"HearFromtxt":"Lorem ipsum dolor sit amet consectetur. Suspendisse urna in gravida",
"HearFromtxt1":"fames bibendum ornare viverra.",
"BookACar":"Book A Car",
"BookACartxt":"Lorem ipsum dolor sit amet consectetur. Velit amet quam tristique aliquet",
"BookACartxt1":"urna proin nam pellentesque risus."
},
"GetInTouch":{
"title":"Get In Touch",
"memo":"Complete control over products allows us to ensure our customers receive the best quality prices and service.",
"Country":"Country/Region*"
},
"newcars":{
"phone":"Phone / Whatsapp / Wechat",
"SendEmail":"Send Email",
"Tel":"Tel",
"Address":"Address",
"Introduction":"Introduction",
"Highlighted":"Highlighted Features",
"video":"video",
"FAQ":"FAQ",
"Fast":"Fast Delivery",
"Diverse":"Diverse Product Range",
"Competitive":"Competitive Pricing",
"Quality":"Quality Assurance",
"Operation":"Integrity-based Operation"
}
}
+181
View File
@@ -0,0 +1,181 @@
{
"home": "Главная",
"about": "О нас",
"UsedCar": "Подержанные авто",
"newcar": "Новые авто",
"Contactus": "Контакты",
"consult": "Консультация",
"zh": "中文",
"en": "English",
"ru": "Русский",
"ar": "العربية",
"lang": "Русский",
"Submit": "Отправить",
"title": "Только проверенные авто по честной цене",
"Subscribe": "Подписка на почту",
"bay":"Покупка",
"source":"Источник",
"smallprogram":"Небольшие программы",
"lick":"Вам может понравиться",
"PrivacyPolicy":"Политика конфиденциальности",
"errors":"Извините, подходящие модели автомобилей не найдены.",
"search": {
"brand": "Марка",
"model": "Модель",
"Type": "Тип",
"engineType": "Тип двигателя",
"inventoryStatus": "Наличие",
"priceFromLow": "Цена (диапазон)",
"priceToHigh": "Цена до",
"startYear": "Год от",
"endYear": "Год до",
"mileageRangemin": "Километры (диапазон)",
"mileageRangemax": "км (максимум)",
"vehicleType": "Кузов",
"drivetrain": "Привод",
"clearAll": "Очистить все"
},
"inventoryStatus": {
"inStock": "В наличии",
"inTransit": "В пути",
"onOrder": "Под заказ"
},
"sectionTitles": {
"carIntroduction": "Описание авто",
"ourServices": "Наши услуги",
"relatedProducts": "Сопутствующие товары",
"contactConsultation": "Обратная связь",
"hot": "Горячий",
"all": "Смотреть все",
"QuickLinks": "Быстрые ссылки",
"Contactinfo": "Контактная информация",
"Followus": "Заботьтесь о нас!",
"Location": "Местоположение",
"Locations": "Местоположение:",
"OpeningHours": "Время работы",
"Views":"Замечания:"
},
"carinfo": {
"front45Degree": "45° спереди",
"leftFront45Degree": "45° слева спереди",
"leftFrontHeadlight": "Левая фара",
"front": "Вид спереди",
"frontLowerPart": "Нижняя часть передка",
"wheelHub": "Колёсные диски",
"rightFrontSeat": "Переднее правое сиденье",
"rightBottomEdge": "Правая нижняя кромка",
"rightRearTaillight": "Правый задний фонарь",
"rightRear45Degree": "45° справа сзади",
"rearLowerPart": "Нижняя часть задка",
"trunk": "Багажник",
"leftBottomEdge": "Левая нижняя кромка",
"rearSeat": "Задние сиденья",
"console": "Центральная консоль",
"controlPanel": "Панель управления",
"gearLever": "Рычаг КПП",
"key": "Ключ",
"steeringWheel": "Руль",
"dashboard": "Приборная панель",
"displayedMileage": "Пробег на одометре",
"leftFrontDoorPanel": "Панель левой передней двери",
"leftFrontDoorFunctionArea": "Функциональная зона левой передней двери",
"leftFrontSeat": "Левое переднее сиденье",
"ceiling": "Потолок салона",
"brand": "Марка",
"price": "Цена (¥)",
"status": "Статус",
"vehicle_type": "Тип",
"vehicle_energy": "Тип топлива",
"mileage": "Пробег (км)",
"vehicle_age": "Возраст (лет)"
},
"exhibitionhall": {
"title": "Шоурум в Минске",
"text": "Мы всегда рады видеть Вас в нашем шоуруме в Минске. Ответим на все вопросы и подберем ваш Отличный Авто.",
"position": "Республика Беларусь, г. Минск, ул. Леонида Беды 46",
"time": "ПН-ПТ: с 9.00 до 18.00",
"time1": "СБ: с 9.00 до 17.00",
"time2": "ВС: выходной"
},
"companyinfo": {
"companyname": "Orzar",
"tel": "+375(29)524803",
"phone": "+86-18603858592",
"position": "Республика Беларусь, г. Минск, ул. Леонида Беды 46",
"time": "С понедельника по субботу (с 9: 00 до 18: 00)",
"Phonenumber": "Номер телефона",
"title1":"Годовой экспорт 436 000 подержанных автомобилей по всему миру, с долей рынка в Центральной Азии более 60% — Наш выставочный зал в Беларуси обеспечивает прямые поставки качественных китайских авто!",
"title2":"6 из 10 ввезённых в Казахстан автомобилей — из Китая! Используя Хоргос как логистический хаб, мы гарантируем быструю доставку по Центральной Азии.",
"title3":"81% импортируемых в Узбекистан автомобилей — китайского производства. Мы предлагаем комплексные услуги для удобных покупок в регионе."
},
"placeholder": {
"describe": "Описание информации...",
"Phone": "Номер телефона *",
"Name": "Ваше имя *",
"email": "Почтовый ящик",
"youremali": " Ваш адрес электронной почты"
},
"button": {
"Seeallcars": "Смотреть все",
"cheapcar": "Думаю, машина дешевле."
},
"Hear": {
"name": "Алексей – Россия",
"Vehicle": "Mercedes-Benz GLE 450 2020",
"Review": "Взял для ежедневных поездок по городу и трассе. Комфорт отличный, коробка не пинается, салон как новый. Машина радует.",
"name1": "Данияр – Казахстан",
"Vehicle1": "Toyota Land Cruiser 5.7 V8 2019",
"Review1": "Очень доволен покупкой. Расход топлива низкий, едет мягко, кондиционер холодит моментально. Отличный вариант для семьи.",
"name2": "Азиз – Узбекистан",
"Vehicle2": "BYD Song Plus EV 2022",
"Review2": "Современная, тихая, очень комфортная. Разгон быстрый, хватает на 450 км по Ташкенту. Китайцы реально научились делать машины.",
"name3": "Наталья – Беларусь",
"Vehicle3": "Toyota Corolla Altis 1.8 Hybrid 2020",
"Review3": "Идеальный вариант для поездок на дачу и по городу. Полный привод работает чётко, подвеска мягкая, ничего не гремит.",
"name4": "Иван – Россия",
"Vehicle4": "Mercedes-Benz C200 AMG Line 2019",
"Review4": "Гибрид оказался очень экономичным. По городу на электричестве, по трассе бензин почти не тратит. Комфортно и стильно.",
"name5": "Баатыр – Кыргызстан",
"Vehicle5": "BYD Yuan Plus EV 2023",
"Review5": "Крепкий внедорожник. По горам идёт уверенно, мотор не греется, коробка работает мягко. Всё как надо.",
"name6": "Аружан – Казахстан",
"Vehicle6": "Toyota RAV4 2.5 AWD 2018",
"Review6": "Компактный и удобный. Для девушки — идеально. Камера заднего вида и парктроники работают отлично, дизайн нравится.",
"name7": "З Рустам – Узбекистан",
"Vehicle7": "Mercedes-Benz GLK 350 4MATIC 2015",
"Review7": "Электромобиль для города — супер. Заряжаю раз в 5 дней, ездит тихо, климат-контроль работает отлично. Не пожалел ни разу."
},
"content": {
"TopPick": "Топ-модели месяца",
"TopPicktxt": "Экспертный выбор лучших автомобилей. Идеальное сочетание инновационных технологий и проверенного",
"TopPicktxt1": " качества для самых взыскательных клиентов.",
"WideRange": "Широкий выбор автомобилей",
"WideRangetext": "Весь спектр моделей для любых потребностей. Мы тщательно отбираем каждый автомобиль, чтобы обеспечить превосходное качество и комфорт вашего путешествия.",
"HearFrom": "Отзывы наших клиентов",
"HearFromtxt": "Реальные истории довольных владельцев. Каждый отзыв — это проверенный опыт ",
"HearFromtxt1": "эксплуатации и искренняя благодарность за качество.",
"BookACar": "Забронировать автомобиль",
"BookACartxt": "Гарантия лучшего выбора: мы лично проверяем каждый автомобиль перед выдачей. ",
"BookACartxt1": "Ваше путешествие начинается с безупречного сервиса."
},
"GetInTouch": {
"title": "Связаться с нами",
"memo": "Полный контроль над продукцией позволяет нам гарантировать нашим клиентам лучшее качество, цены и сервис.",
"Country": "Страна/Регион*"
},
"newcars": {
"phone": "Телефон / WhatsApp / WeChat",
"SendEmail": "Отправить письмо",
"Tel": "Тел.",
"Address": "Адрес",
"Introduction": "Введение",
"Highlighted": "Основные характеристики",
"video": "Видео",
"FAQ": "Частые вопросы",
"Fast": "Быстрая доставка",
"Diverse": "Широкий ассортимент",
"Competitive": "Конкурентные цены",
"Quality": "Гарантия качества",
"Operation": "Честное ведение бизнеса"
}
}
+168
View File
@@ -0,0 +1,168 @@
{
"home":"首页",
"about":"关于我们",
"UsedCar":"二手车",
"newcar":"新车",
"Contactus":"联系我们",
"consult":"咨询",
"zh": "中文",
"en": "English",
"ru": "Русский",
"ar": "العربية",
"lang":"中文",
"Submit":"提交",
"title":"只卖经过验证的汽车,价格公道",
"Subscribe":"订阅我们的电子报",
"bay":"购买",
"source":"来源:",
"smallprogram":"小程序",
"lick":"猜你喜欢",
"PrivacyPolicy":"隐私协议",
"search":{
"brand": "品牌",
"model": "型号",
"engineType": "能源类型",
"Type": "类型",
"inventoryStatus": "库存状态",
"priceFromLow": "价格(范围)",
"priceToHigh": "最高价",
"startYear": "开始年份",
"endYear": "结束年份",
"mileageRangemin": "公里(范围)",
"mileageRangemax": "公里(最高)",
"vehicleType": "车辆类型",
"drivetrain": "车辆驱动",
"clearAll": "清除全部"
},
"inventoryStatus":{
"inStock": "现货",
"inTransit": "在途",
"onOrder": "订购"
},
"sectionTitles": {
"carIntroduction": "汽车简介",
"ourServices": "我们的服务",
"relatedProducts": "相关产品",
"contactConsultation": "留言/咨询",
"hot":"热门",
"all":"查看所有",
"QuickLinks":"快速链接",
"Contactinfo":"联系信息",
"Followus":"跟我们来!",
"Location":"地址",
"Locations":"地址:",
"OpeningHours":"营业时间",
"Views":"查看:"
},
"carinfo":{
"front45Degree": "45°正脸",
"leftFront45Degree": "左前45°",
"leftFrontHeadlight": "左前大灯",
"front": "正前",
"frontLowerPart": "车头下部",
"wheelHub": "车辆轮毂",
"rightFrontSeat": "右侧前排座椅",
"rightBottomEdge": "右侧底大边",
"rightRearTaillight": "右后尾灯",
"rightRear45Degree": "右后45°",
"rearLowerPart": "车尾下部",
"trunk": "后备厢",
"leftBottomEdge": "左侧底大边",
"rearSeat": "后排座椅",
"console": "中控台",
"controlPanel": "中控面板",
"gearLever": "档把",
"key": "钥匙",
"steeringWheel": "方向盘",
"dashboard": "仪表盘",
"displayedMileage": "表显里程",
"leftFrontDoorPanel": "左前门内饰板",
"leftFrontDoorFunctionArea": "左前门功能区",
"leftFrontSeat": "左侧前排座椅",
"ceiling": "车内顶棚",
"brand":"品牌",
"price":"售价(¥)",
"status":"状态",
"vehicle_type":"类型",
"vehicle_energy":"能源",
"mileage":"里程(公里数)",
"vehicle_age":"车龄(年)"
},
"exhibitionhall":{
"title":"明斯克展览馆",
"text":"我们很高兴在明斯克展览馆与您见面。我们将回答所有问题并选择您的汽车。",
"position":"白俄罗斯共和国明斯克市Leonidas Beida 46",
"time":"周一至周五:上午9点至下午6点",
"time1":"周六:上午9:00至下午5:00",
"time2":"周日:休息日"
},
"companyinfo":{
"companyname":"Orzar",
"tel":"+375(29)524803",
"phone":"+86-18603858592",
"position":"白俄罗斯共和国明斯克市Leonidas Beida 46",
"time":"周一至周六(上午9点至下午6点)",
"Phonenumber":"电话号码"
},
"placeholder":{
"describe":"描述信息...",
"Phone":"电话号码 *",
"Name":"你的姓名 *",
"email":"邮箱",
"youremali":"您的电子邮件地址"
},
"button":{
"Seeallcars":"查看所有",
"cheapcar":"我想要这辆车更便宜"
},
"Hear":{
"name":"Ahmed – UAE",
"Vehicle":"Mercedes-Benz GLE 450 2020",
"Review":"行驶平顺动力强劲,交车时状态完美,所有电子设备运行正常,物超所值。",
"name1":"Faisal – Saudi Arabia",
"Vehicle1":"Toyota Land Cruiser 5.7 V8 2019",
"Review1":"这辆陆巡是真正的猛兽!内外洁净如新,发动机静音,沙漠地形轻松驾驭,无可挑剔。",
"name2":"Carlos – Peru",
"Vehicle2": "BYD Song Plus EV 2022 ",
"Review2":"使用三个月表现惊艳:静音、动力充沛,续航真实可靠,中国电动车进步显著。",
"name3":"Lucas – Brazil",
"Vehicle3": "Toyota Corolla Altis 1.8 Hybrid 2020",
"Review3":"低油耗表现优异,内饰舒适,空调强劲,悬架紧实,完美适应圣保罗日常通勤。",
"name4":"Mateo – Ecuador",
"Vehicle4": "Mercedes-Benz C200 AMG Line 2019",
"Review4":"内饰仍保持新车质感,娱乐系统流畅,引擎性能稳定,真正的高端驾乘体验。",
"name5":"Aidos – Kazakhstan",
"Vehicle5": "BYD Yuan Plus EV 2023",
"Review5":"我的首台电动车,家用充电便捷,驾驶感受媲美高端SUV,配置出色令人惊喜。",
"name6":"Juan – Mexico",
"Vehicle6": "Toyota RAV4 2.5 AWD 2018",
"Review6":"家庭出游首选,四驱系统雨天山路表现稳健,无故障灯提示,强烈推荐。",
"name7":"Emeka – Nigeria",
"Vehicle7": "Mercedes-Benz GLK 350 4MATIC 2015",
"Review7":"长途旅行首选,发动机状态良好,行驶稳定,豪华质感历久弥新,非常满意!"
},
"content":{
"TopPick":"本月精选推荐车型",
"TopPicktxt":"甄选本月最具潜力座驾,以卓越工艺诠释移动美学,为品味生活家打造专属驾乘体验。",
"TopPicktxt1":"匠心之选,非凡驾驭。",
"WideRange":"丰富车型 多元之选",
"WideRangetext":"全系车型,纵享驾驭。从经典到前沿,我们以严苛标准甄选每一款座驾,为您开启个性化出行篇章。",
"HearFrom":"客户心声",
"HearFromtxt":"每一份口碑沉淀,都是我们以匠心雕琢的永恒承诺。",
"HearFromtxt1":"聆听真实回响,品质自有共鸣。",
"BookACar":"立即预订",
"BookACartxt":"我们将以严苛标准为您甄选爱车,开启非凡驾乘之旅。",
"BookACartxt1":"尊享专属礼遇,臻选品质座驾。"
},
"newcars":{
"phone":"Phone / Whatsapp / Wechat",
"SendEmail":"Send Email",
"Tel":"Tel",
"Address":"Address"
},
"GetInTouch":{
"title":"Get In Touch",
"memo":"Complete control over products allows us to ensure our customers receive the best quality prices and service.",
"Country":"Country/Region*"
}
}
+47
View File
@@ -0,0 +1,47 @@
$(function() {
$("#subbtn").click(function() {
var name = $("#name").val()
var phone = $("#phone").val()
var content = $("#content").val()
var Email = $("#Email").val()
AjaxUtils.post('apis/contact/add', {
name: name,
phone: phone,
content: content,
email: Email,
vehicle_id: 0
}).done(function(result) {
alert(result.data.message)
// console.log(result);
}).fail(function(error) {
// console.error(error);
});
})
$("#subscribeFn").click(function() {
var email = $("#emailinput").val()
// if (email == '') {
// return false
// }
AjaxUtils.post('apis/email/subscribe', {
email: email,
}).done(function(result) {
alert(result.message)
// console.log(result);
}).fail(function(error) {
// console.error(error);
});
})
AjaxUtils.get('apis/brand/letterAll', {
is_hot:'1',
}).done(function(data) {
var brandList = data.data;
var html=''
$.each(brandList,function(){
html+='<li id="menu-item-'+this.id+'" class="menu-item"><a href="brand.html?id='+this.id+'"><img src="'+this.logo_full+'" alt="" />'+this.name+'</a></li>'
});
$(".has_lv3 .flex-layout").html(html)
}).fail(function(error) {
// console.error(error);
});
})
+206
View File
@@ -0,0 +1,206 @@
$(function() {
// 轮播图
var id = getQueryString("id")
function initSlick() {
$(".rental-slider").slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: ".as-nav-slider",
});
$(".as-nav-slider").slick({
slidesToShow: 5,
slidesToScroll: 1,
// slide: true,
asNavFor: ".rental-slider",
dots: false,
arrows: false,
centerMode: false,
variableWidth: true,
focusOnSelect: true,
responsive: [{
breakpoint: 1200,
settings: {
slidesToShow: 4,
},
},
{
breakpoint: 1025,
settings: {
slidesToShow: 3,
},
},
],
});
}
// 生成HTML
function generateslide(product) {
if (product.pic_full == '') {
return ''
}
return `
<div class="rental-slide">
<img src="${product.pic_full}" alt="banner">
</div>
`;
}
function generateslide1(product) {
if (product.pic_full == '') {
return ''
}
return `
<div class="img-box">
<img src="${product.pic_full}" alt="car">
</div>
`;
}
// 渲染轮播图
function renderbanner(lbdata) {
const rentalslider = document.getElementById('rental-slider');
rentalslider.innerHTML = lbdata.map(product =>
generateslide(product)
).join('');
const asnavslider = document.getElementById('as-nav-slider');
asnavslider.innerHTML = lbdata.map(product =>
generateslide1(product)
).join('');
initSlick()
}
// Introduction
function Introductionhtml(data){
var html='';
$.each(data,function(){
html+="<li>"+this.content+"</li>"
});
$("#section1 ul").html(html)
}
// Highlighted
function Highlightedhtml(data){
var html='';
$.each(data,function(){
html+="<li><strong>"+this.title+"</strong><br>"+this.content+"</li>"
});
$("#section2 ul").html(html)
}
// video
function videohtml(data){
var html=`<iframe width="100%" src="${data}" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>`
$("#section3").append(html)
}
// FAQ
function FAQhtml(data){
var html='';
$.each(data,function(){
html+=`<div class="schema-faq-section" >
<strong class="schema-faq-question">${this.title}</strong>
<p class="schema-faq-answer">${this.content}</p>
</div>`
});
$("#faqs").html(html)
}
AjaxUtils.get('apis/vehicle/new/'+id+'/detail', {
id: id
}).done(function(data) {
var carinfo = data.data
$(".carname").html(carinfo.name)
$(".carpice").html(carinfo.price)
$(".carbrand").html(carinfo.brand_name)
$(".carstype").html(carinfo.type_name)
$(".careng").html(carinfo.energy_name)
$(".carstatus").html(carinfo.store_status_name)
$(".carkm").html(carinfo.mileage)
// $(".carage").html(carinfo.start_use)
$(".carage").html(carinfo.vehicle_age)
$(".condition_desc").html(carinfo.condition_desc)
$(".Locations").html(carinfo.location_name)
$(".views").html(carinfo.views)
$("#brands").html('<a href="brand.html?id='+carinfo.brand+'">'+carinfo.brand_name+'</a>')
videohtml(carinfo.video)
Introductionhtml(carinfo.content)
Highlightedhtml(carinfo.trait)
renderbanner(carinfo.album)
FAQhtml(carinfo.asked)
console.log(data);
}).fail(function(error) {
console.error(error);
});
$("#subbtn").click(function() {
var name = $("#name").val()
var phone = $("#Phone").val()
var content = $("#content").val()
var Email = $("#Email").val()
AjaxUtils.post('apis/contact/add', {
name: name,
phone: phone,
content: content,
email: Email,
vehicle_id: id
}).done(function(result) {
alert(result.data.message)
console.log(result);
}).fail(function(error) {
console.error(error);
});
})
// 锚点导航功能
const navItems = document.querySelectorAll('.nav-item');
const contentScroll = document.getElementById('pro-content');
// 点击导航链接时的滚动
navItems.forEach(item => {
const link = item.querySelector('.nav-link');
link.addEventListener('click', function(e) {
// e.preventDefault();
const targetId = this.getAttribute('href').substring(1);
const targetElement = document.getElementById(targetId);
if (targetElement) {
// 滚动到目标位置
// const offset = targetElement.offsetTop - contentScroll.offsetTop;
// contentScroll.scrollTo({
// top: offset,
// behavior: 'smooth'
// });
// 更新选中状态
navItems.forEach(navItem => {
navItem.classList.remove('current');
});
item.classList.add('current');
}
});
});
// 页面加载时激活第一个导航链接
if (navItems.length > 0) {
navItems[0].classList.add('current');
}
var vm = new Vue({
el: '#contapp',
data: {
},
created: function() {
},
methods: {
},
})
})
+251
View File
@@ -0,0 +1,251 @@
$(function() {
// 轮播图
var id = getQueryString("id")
function initSlick() {
$(".rental-slider").slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: ".as-nav-slider",
});
$(".as-nav-slider").slick({
slidesToShow: 5,
slidesToScroll: 1,
// slide: true,
asNavFor: ".rental-slider",
dots: false,
arrows: false,
centerMode: false,
variableWidth: true,
focusOnSelect: true,
responsive: [{
breakpoint: 1200,
settings: {
slidesToShow: 4,
},
},
{
breakpoint: 1025,
settings: {
slidesToShow: 3,
},
},
],
});
}
// 生成HTML
function generateslide(product) {
if (product.pic_full == '') {
return ''
}
return `
<div class="rental-slide">
<img src="${product.pic_full}" alt="banner">
</div>
`;
}
function generateslide1(product) {
if (product.pic_full == '') {
return ''
}
return `
<div class="img-box">
<img src="${product.pic_full}" alt="car">
</div>
`;
}
// 渲染轮播图
function renderbanner(lbdata) {
const rentalslider = document.getElementById('rental-slider');
rentalslider.innerHTML = lbdata.map(product =>
generateslide(product)
).join('');
const asnavslider = document.getElementById('as-nav-slider');
asnavslider.innerHTML = lbdata.map(product =>
generateslide1(product)
).join('');
initSlick()
}
// Introduction
function Introductionhtml(data){
$(".nav-menu").append(
`<li class="nav-item"><a href="#section1" class="nav-link" data-i18n="newcars.Introduction"></a></li>`
);
var html='';
html+='<section id="section1" class="section"> <h2 class="wp-block-heading" data-i18n="newcars.Introduction"></h2> <ul class="wp-block-list unstyled" >'
$.each(data,function(){
html+="<li>"+this.content+"</li>"
});
html+='</ul></section>'
$(".content").append(html)
}
// Highlighted
function Highlightedhtml(data){
var html='';
$(".nav-menu").append(
`<li class="nav-item"><a href="#section2" class="nav-link" data-i18n="newcars.Highlighted"></a></li>`
);
html+='<section id="section2" class="section"> <h2 class="wp-block-heading" data-i18n="newcars.Highlighted"></h2> <ul class="wp-block-list unstyled" >'
$.each(data,function(){
html+="<li><strong>"+this.title+"</strong><br>"+this.content+"</li>"
});
html+='</ul></section>'
$(".content").append(html)
}
// video
function videohtml(data){
$(".nav-menu").append(
`<li class="nav-item"><a href="#section3" class="nav-link" data-i18n="newcars.video"></a></li>`
);
var html=`<section id="section3" class="section"> <h2 class="wp-block-heading" data-i18n="newcars.video"></h2> <iframe width="100%" src="${data}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe></section>`
$(".content").append(html)
}
// FAQ
function FAQhtml(data){
var html='';
$(".nav-menu").append(
`<li class="nav-item"><a href="#section4" class="nav-link" data-i18n="newcars.FAQ"></a></li>`
);
html+='<section id="section4" class="section"> <h2 class="wp-block-heading pcontenth2" data-i18n="newcars.FAQ"></h2> <div class="schema-faq wp-block-yoast-faq-block" id="faqs">'
$.each(data,function(){
html+=`<div class="schema-faq-section" >
<strong class="schema-faq-question">${this.title}</strong>
<p class="schema-faq-answer">${this.content}</p>
</div>`
});
html+='</div></section>'
$(".content").append(html)
}
// 处理导航和滚动
function initNavigation() {
// 获取内容区域
const contentScroll = document.querySelector('.content');
// 更新导航选中状态的函数
function updateNavState(targetId) {
$('.nav-item').removeClass('current');
$(`.nav-link[href="#${targetId}"]`).parent().addClass('current');
}
// 使用jQuery事件委托处理点击事件
$('.nav-menu').off('click', '.nav-link').on('click', '.nav-link', function(e) {
e.preventDefault();
const targetId = $(this).attr('href').substring(1);
const targetElement = document.getElementById(targetId);
if (targetElement) {
// 获取目标元素相对于视口的位置
const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset;
// 立即更新选中状态
updateNavState(targetId);
// 使用window.scrollTo方法实现滚动
window.scrollTo({
top: targetPosition,
behavior: 'smooth'
});
}
});
// 监听滚动事件
let scrollTimeout;
$(window).on('scroll', function() {
// 清除之前的定时器
if (scrollTimeout) {
clearTimeout(scrollTimeout);
}
// 设置新的定时器,避免频繁触发
scrollTimeout = setTimeout(function() {
const sections = document.querySelectorAll('[id^="section"]');
const scrollTop = window.pageYOffset;
// 找到当前可见区域内的section
let currentSection = null;
sections.forEach(section => {
const sectionTop = section.getBoundingClientRect().top + window.pageYOffset;
const sectionBottom = sectionTop + section.offsetHeight;
if (scrollTop >= sectionTop - 100 && scrollTop < sectionBottom) {
currentSection = section;
}
});
// 更新导航选中状态
if (currentSection) {
updateNavState(currentSection.id);
}
}, 100);
});
// 页面加载时激活第一个导航链接
$('.nav-item:first').addClass('current');
}
// 获取数据并初始化
AjaxUtils.get('apis/vehicle/new/'+id+'/detail', {
id: id
}).done(function(data) {
var carinfo = data.data
$(".carname").html(carinfo.name)
$(".carpice").html(carinfo.price)
$(".carbrand").html(carinfo.brand_name)
$(".carstype").html(carinfo.type_name)
$(".careng").html(carinfo.energy_name)
$(".carstatus").html(carinfo.store_status_name)
$(".carkm").html(carinfo.mileage)
$(".carage").html(carinfo.vehicle_age)
$(".condition_desc").html(carinfo.condition_desc)
$(".Locations").html(carinfo.location_name)
$(".views").html(carinfo.views)
$("#brands").html('<a href="brand.html?id='+carinfo.brand+'">'+carinfo.brand_name+'</a>')
renderbanner(carinfo.album)
Introductionhtml(carinfo.content)
Highlightedhtml(carinfo.trait)
if(carinfo.video!=''){
videohtml(carinfo.video)
}
FAQhtml(carinfo.asked)
// 初始化导航
i18n.loadLanguage(localStorage.getItem('lang')?localStorage.getItem('lang'): 'en')
// 确保在内容加载完成后再初始化导航
setTimeout(initNavigation, 100);
// console.log(data);
}).fail(function(error) {
// console.error(error);
});
$("#subbtn").click(function() {
var name = $("#name").val()
var phone = $("#Phone").val()
var content = $("#content").val()
var Email = $("#Email").val()
AjaxUtils.post('apis/contact/add', {
name: name,
phone: phone,
content: content,
email: Email,
vehicle_id: id
}).done(function(result) {
alert(result.data.message)
// console.log(result);
}).fail(function(error) {
// console.error(error);
});
})
})
+187
View File
@@ -0,0 +1,187 @@
$(function() {
// 搜索模块展开收起
const filterToggle = document.querySelector('.filter-toggle');
const filterWrapper = document.querySelector('.filter-wrapper');
if (filterToggle && filterWrapper) {
filterToggle.addEventListener('click', function() {
filterWrapper.classList.toggle('expanded');
});
}
var vm = new Vue({
el: '#app',
data: {
currentPage: 1, // 当前页码
pageSize: 12, // 每页条数
totalItems: 0, // 总数据量(后端分页用)
dataList: [],
brandListAll:[],
selectedLetter: 'hot',
selectedBrand: '',
selectedenergy:'',
letters: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
],
energyList:[],
is_hot:'',
isnone:false,
isFilterOpen: false, // 控制筛选面板的开关状态
},
computed: {
// 当前页数据(前端分页)
currentPageData() {
const start = (this.currentPage - 1) * this.pageSize;
return this.allData.slice(start, start + this.pageSize);
},
// 总页数
totalPages() {
return Math.ceil(this.totalItems / this.pageSize);
},
// 动态页码范围
visiblePages() {
const maxVisible = 5;
let start = Math.max(1, this.currentPage - 2);
let end = Math.min(start + maxVisible - 1, this.totalPages);
return Array.from({
length: end - start + 1
}, (_, i) => start + i);
}
},
watch: {
currentPage() {
this.fetchData(); // 后端分页时触发数据更新
},
isFilterOpen(newVal) {
// 当筛选面板状态改变时,控制body滚动
document.body.style.overflow = newVal ? 'hidden' : '';
}
},
created: function() {
this.getbrand('',1)
this.getenergy()
this.fetchData()
},
mounted() {
// 创建遮罩层
const overlay = document.createElement('div');
overlay.className = 'filter-overlay';
document.body.appendChild(overlay);
// 点击遮罩层关闭
overlay.addEventListener('click', () => {
this.isFilterOpen = false;
});
// 点击其他区域关闭筛选面板
document.addEventListener('click', (e) => {
const filterContainer = document.querySelector('.filter-container');
const filterBtn = document.querySelector('.filter-btn');
// 如果点击的不是筛选面板内部元素,也不是筛选按钮,则关闭面板
if (this.isFilterOpen &&
!filterContainer.contains(e.target) &&
!filterBtn.contains(e.target)) {
this.isFilterOpen = false;
}
});
},
methods: {
toggleFilter() {
this.isFilterOpen = !this.isFilterOpen;
},
getbrand(letter,is_hot){
var that = this
AjaxUtils.get('apis/brand/letterAll', {
letter:letter,
is_hot:is_hot,
}).done(function(data) {
that.brandListAll= data.data
}).fail(function(error) {
// console.error(error);
});
},
getenergy(){
var that = this
AjaxUtils.get('apis/energy/preset', {}).done(function(data) {
that.energyList= data.data
}).fail(function(error) {
// console.error(error);
});
},
fetchData() {
var that = this
AjaxUtils.get('apis/vehicle/new/list', {
page: this.currentPage,
per_page: this.pageSize,
brand:this.selectedBrand,
energy:this.selectedenergy
}).done(function(data) {
that.dataList = data.data.list
that.allData = data.data.list; // 前端分页时存储所有数据
that.totalItems = data.data.meta.total; // 后端分页时更新总数
if(that.dataList.length>0){
that.isnone = false
}else{
that.isnone = true
}
}).fail(function(error) {
// console.error(error);
});
},
filterByLetter(letter) {
this.selectedLetter = letter;
if (this.selectedLetter === 'all') {
this.getbrand('','')
} else if (this.selectedLetter === 'hot') {
this.getbrand('',1)
} else {
this.getbrand(letter,'')
}
},
selectBrand(brand) {
if(this.selectedBrand==brand){
this.selectedBrand = '';
}else{
this.selectedBrand = brand;
}
// window.location.href = 'brand.html?id=' + brand
// 这里可以添加点击后的逻辑,比如跳转到品牌页面
// console.log('选中品牌:', brand);
this.fetchData()
},
selectenergy(item) {
if(item=='all'){
this.selectedenergy =''
}else{
this.selectedenergy = item.id
}
// window.location.href = 'brand.html?id=' + brand
// 这里可以添加点击后的逻辑,比如跳转到品牌页面
// console.log('选中:', item);
this.fetchData()
},
prevPage() {
if (this.currentPage > 1) this.currentPage--;
$('html, body').animate({
scrollTop: $('.navs').offset().top - 0
}, 0);
},
nextPage() {
if (this.currentPage < this.totalPages) {
this.currentPage++
};
$('html, body').animate({
scrollTop: $('.navs').offset().top - 0
}, 0);
},
gotoPage(page) {
this.currentPage = page;
},
godetil(item) {
window.location.href = 'newcar-details.html?id=' + item.id
},
},
})
})
+306
View File
@@ -0,0 +1,306 @@
$(function() {
Vue.component('v-select', VueSelect.VueSelect);
console.log(getQueryString("type"))
var brand = getQueryString("brand") ? Number(getQueryString("brand")) : ''
var model = getQueryString("model") ? Number(getQueryString("model")) : ''
var energy = getQueryString("energy") ? Number(getQueryString("energy")) : ''
var store_status = getQueryString("store_status") ? Number(getQueryString("store_status")) : ''
var min_price = getQueryString("min_price") ? Number(getQueryString("min_price")) : ''
var max_price = getQueryString("max_price") ? Number(getQueryString("max_price")) : ''
var price = getQueryString("price") ? getQueryString("price") : ''
var mileage = getQueryString("mileage") ? getQueryString("mileage") : ''
var min_mileage=getQueryString("min_mileage") ? Number(getQueryString("min_mileage")) : ''
var max_mileage=getQueryString("max_mileage") ? Number(getQueryString("max_mileage")) : ''
var types = getQueryString("type") ? Number(getQueryString("type")) : ''
var vm = new Vue({
el: '#app',
data: {
currentPage: 1, // 当前页码
pageSize: 12, // 每页条数
totalItems: 0, // 总数据量(后端分页用)
dataList: [],
isshow:false,
model: [],
brandlist: [],
energy: [],
mileage: [],
pricemin: [],
pricemax: [],
mileagemin: [],
mileagemax: [],
score_status: [],
licklist:[],
type: [],
select: {
brand: brand,
model: model,
energy: energy,
store_status: store_status,
min_price: min_price,
max_price: max_price,
price:price,
mileage:mileage,
start_year: '',
end_year: '',
min_mileage: min_mileage,
max_mileage:max_mileage,
type: types,
},
},
computed: {
// 当前页数据(前端分页)
currentPageData() {
const start = (this.currentPage - 1) * this.pageSize;
return this.allData.slice(start, start + this.pageSize);
},
// 总页数
totalPages() {
return Math.ceil(this.totalItems / this.pageSize);
},
// 动态页码范围
visiblePages() {
const maxVisible = 5;
let start = Math.max(1, this.currentPage - 2);
let end = Math.min(start + maxVisible - 1, this.totalPages);
return Array.from({
length: end - start + 1
}, (_, i) => start + i);
}
},
watch: {
currentPage() {
this.fetchData(); // 后端分页时触发数据更新
}
},
created: function() {
this.getbrand()
this.fetchData()
},
methods: {
getbrand(brand_id) {
var that = this
AjaxUtils.get('apis/search/options', {}).done(function(data) {
var datas = data.data
that.brandlist = datas.brand
that.energy = datas.energy
that.mileage = datas.price
that.pricemin = datas.mileage
that.mileagemin = datas.mileage
that.score_status = datas.score_status
that.type = datas.type
}).fail(function(error) {
// console.error(error);
});
},
licklistfn(){
var that = this
that.licklist=[]
AjaxUtils.get('apis/vehicle/random', {}).done(function(data) {
var data = data.data
that.licklist.push(data)
}).fail(function(error) {
// console.error(error);
});
},
//获取品牌类型
getmodels(brand_id) {
var that = this
AjaxUtils.get('apis/get/models', {
brand_id: brand_id
}).done(function(data) {
that.model = data.data
}).fail(function(error) {
// console.error(error);
});
// fetch(baseURL+'apis/get/models?brand_id='+brand_id,options)
// .then(response => {
// if (!response.ok) {
// throw new Error('Network response was not ok');
// }
// return response.json();
// })
// .then(data => {
// that.model = data.data
// // console.log(that.model)
// })
// .catch(error => {
// this.error = error.message;
// this.loading = false;
// });
},
//品牌选择
onSelectbrand(item) {
if (item == null) {
item = ''
}
this.select.brand = item
this.fetchData()
if (item != '') {
this.getmodels(item)
}
// console.log('Selected item:', item);
},
//类型
onSelectmodel(item) {
if (item == null) {
item = ''
}
this.select.model = item
this.fetchData()
},
onSelectengineType(item) {
if (item == null) {
item = ''
}
// min_price:'',
// max_price:'',
this.select.energy = item
this.fetchData()
},
onSelectinventoryStatus(item) {
if (item == null) {
item = ''
}
this.select.store_status = item
this.fetchData()
},
onSelectpriceFromLow(item) {
var min=''
var max=''
if (item == null) {
item = ''
}else{
min = item.split(/\s*-\s*/).map(Number)[0];
max = item.split(/\s*-\s*/).map(Number)[1];
}
this.select.min_price = min
this.select.max_price = max
this.select.price = item
this.fetchData()
},
onSelectmileageRange(item) {
var min=''
var max=''
if (item == null) {
item = ''
}else{
min = item.split(/\s*-\s*/).map(Number)[0];
max = item.split(/\s*-\s*/).map(Number)[1];
}
this.select.min_mileage = min
this.select.max_mileage = max
this.select.mileage = item
this.fetchData()
},
onSelectvehicleType(item) {
if (item == null) {
item = ''
}
this.select.type = item
this.fetchData()
},
onSelectstartYear(item) {
this.fetchData()
},
onSelectendYear(item) {
this.fetchData()
},
fetchData() {
// 新的参数对象
const newParams = {
param2: 'value2'
};
// 创建新的查询字符串
const newQueryString = new URLSearchParams(this.select).toString();
// 新的完整URL
const newUrl = `${window.location.pathname}?${newQueryString}`;
// console.log(newUrl)
// 使用pushState改变URL
history.pushState(null, null, newUrl);
// console.log(params.toString())
// window.location.search = `?${params.toString()}`;
var that = this
AjaxUtils.get('apis/vehicle/list', {
page: this.currentPage,
per_page: this.pageSize,
brand: this.select.brand,
model: this.select.model,
energy: this.select.energy,
store_status: this.select.store_status,
min_price: this.select.min_price,
max_price: this.select.max_price,
start_year: this.select.start_year,
end_year: this.select.end_year,
min_mileage: this.select.min_mileage,
max_mileage: this.select.max_mileage,
type: this.select.type,
}).done(function(data) {
that.dataList = data.data.list
that.allData = data.data.list; // 前端分页时存储所有数据
that.totalItems = data.data.meta.total; // 后端分页时更新总数
if(that.dataList.length<=0){
that.isshow = true
that.licklistfn()
}else{
that.isshow = false
}
// console.log(data.data.list);
}).fail(function(error) {
// console.error(error);
});
},
prevPage() {
if (this.currentPage > 1) this.currentPage--;
$('html, body').animate({
scrollTop: $('.navs').offset().top - 0
}, 0);
},
nextPage() {
if (this.currentPage < this.totalPages) {
this.currentPage++
};
$('html, body').animate({
scrollTop: $('.navs').offset().top - 0
}, 0);
},
gotoPage(page) {
this.currentPage = page;
},
godetil(item) {
window.location.href = 'vehicle-details.html?id=' + item.id
},
clearfn() {
for (const key in this.select) {
if (this.select.hasOwnProperty(key)) {
this.select[key] = '';
}
}
this.fetchData()
},
contentbtn(){
var name = $("#name").val()
var phone = $("#phone").val()
var content = $("#content").val()
var Email = $("#Email").val()
AjaxUtils.post('apis/contact/add', {
name: name,
phone: phone,
content: content,
email: Email,
vehicle_id: 0
}).done(function(result) {
alert(result.data.message)
// console.log(result);
}).fail(function(error) {
// console.error(error);
});
}
},
})
})
+167
View File
@@ -0,0 +1,167 @@
$(function() {
// 轮播图
var id = getQueryString("id")
function initSlick() {
$(".rental-slider").slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: ".as-nav-slider",
});
$(".as-nav-slider").slick({
slidesToShow: 5,
slidesToScroll: 1,
// slide: true,
asNavFor: ".rental-slider",
dots: false,
arrows: false,
centerMode: false,
variableWidth: true,
focusOnSelect: true,
responsive: [{
breakpoint: 1200,
settings: {
slidesToShow: 4,
},
},
{
breakpoint: 1025,
settings: {
slidesToShow: 3,
},
},
],
});
}
// 生成HTML
function generateslide(product) {
if (product.value_full == '') {
return ''
}
return `
<div class="rental-slide">
<img src="${product.value_full}" alt="banner">
<div class="tag">${product.name}</div>
</div>
`;
}
function generateslide1(product) {
if (product.value_full == '') {
return ''
}
return `
<div class="img-box">
<img src="${product.value_full}" alt="car">
</div>
`;
}
// 渲染轮播图
function renderbanner(lbdata) {
const rentalslider = document.getElementById('rental-slider');
rentalslider.innerHTML = lbdata.map(product =>
generateslide(product)
).join('');
const asnavslider = document.getElementById('as-nav-slider');
asnavslider.innerHTML = lbdata.map(product =>
generateslide1(product)
).join('');
initSlick()
}
AjaxUtils.get('apis/vehicle/detail', {
id: id
}).done(function(data) {
var carinfo = data.data
$(".carname").html(carinfo.name)
$(".carpice").html(carinfo.price)
$(".carbrand").html(carinfo.brand_name)
$(".carstype").html(carinfo.type_name)
$(".careng").html(carinfo.energy_name)
$(".carstatus").html(carinfo.store_status_name)
$(".carkm").html(carinfo.mileage)
// $(".carage").html(carinfo.start_use)
$(".carage").html(carinfo.vehicle_age)
$(".condition_desc").html(carinfo.condition_desc)
$(".Locations").html(carinfo.location_name)
$(".views").html(carinfo.views)
renderbanner(carinfo.albums)
// console.log(data);
}).fail(function(error) {
// console.error(error);
});
// 相关产品数据
// 生成产品卡片HTML
function generateProductCard(product) {
return `
<div class="vehicle-card mb-24">
<a href="vehicle-details.html?id=${product.id}" >
<img src="${product.cover}" class="w-100" alt="${product.name}">
<h3 class="h3 title">${product.name}</h3>
<h6>${product.price}</h6>
<div class="vehica-car-card__separator"></div>
<div class="vehica-car-card__info">
<div class="vehica-car-card__info">
<div class="vehica-car-card__info__single" data-i18n="bay"></div>
<div class="vehica-car-card__info__single">
${product.brand}</div>
<div class="vehica-car-card__info__single" >
${product.model}
</div>
<div class="vehica-car-card__info__single" >
${product.energy}
</div>
<div class="vehica-car-card__info__single" >
${product.type}
</div>
</div>
</div>
</a>
</div>
`;
}
// 渲染相关产品
function renderRelatedProducts() {
const container = document.getElementById('relatedProductsContainer');
if (container) {
container.innerHTML = relatedProductsData.map(product =>
generateProductCard(product)
).join('');
}
}
var relatedProductsData = []
AjaxUtils.get('apis/vehicle/list', {
page: 1,
per_page: 5,
vehicle_id: id
}).done(function(data) {
relatedProductsData = data.data.list
renderRelatedProducts();
}).fail(function(error) {
// console.error(error);
});
$("#subbtn").click(function() {
var name = $("#name").val()
var phone = $("#Phone").val()
var content = $("#content").val()
var Email = $("#Email").val()
AjaxUtils.post('apis/contact/add', {
name: name,
phone: phone,
content: content,
email: Email,
vehicle_id: id
}).done(function(result) {
alert(result.data.message)
// console.log(result);
}).fail(function(error) {
// console.error(error);
});
})
})
+7
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+1661
View File
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
/*!
* The Final Countdown for jQuery v2.2.0 (http://hilios.github.io/jQuery.countdown/)
* Copyright (c) 2016 Edson Hilios
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;f<g;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&m<10&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),Math.abs(b)>1?c:d}var f=[],g=[],h={precision:100,elapse:!1,defer:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",d:"daysToWeek",w:"weeks",W:"weeksToMonth",H:"hours",M:"minutes",S:"seconds",D:"totalDays",I:"totalHours",N:"totalMinutes",T:"totalSeconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.options.defer===!1&&this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&b<0?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),weeksToMonth:Math.floor(this.totalSecsLeft/60/60/24/7)%4,months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear()),totalDays:Math.floor(this.totalSecsLeft/60/60/24),totalHours:Math.floor(this.totalSecsLeft/60/60),totalMinutes:Math.floor(this.totalSecsLeft/60),totalSeconds:this.totalSecsLeft},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}});
+4
View File
@@ -0,0 +1,4 @@
/* jQuery Nice Select - v1.0
https://github.com/hernansartorio/jquery-nice-select
Made by Hernán Sartorio */
!function(e){e.fn.niceSelect=function(t){function s(t){t.after(e("<div></div>").addClass("nice-select").addClass(t.attr("class")||"").addClass(t.attr("disabled")?"disabled":"").attr("tabindex",t.attr("disabled")?null:"0").html('<span class="current"></span><ul class="list"></ul>'));var s=t.next(),n=t.find("option"),i=t.find("option:selected");s.find(".current").html(i.data("display")||i.text()),n.each(function(t){var n=e(this),i=n.data("display");s.find("ul").append(e("<li></li>").attr("data-value",n.val()).attr("data-display",i||null).addClass("option"+(n.is(":selected")?" selected":"")+(n.is(":disabled")?" disabled":"")).html(n.text()))})}if("string"==typeof t)return"update"==t?this.each(function(){var t=e(this),n=e(this).next(".nice-select"),i=n.hasClass("open");n.length&&(n.remove(),s(t),i&&t.next().trigger("click"))}):"destroy"==t?(this.each(function(){var t=e(this),s=e(this).next(".nice-select");s.length&&(s.remove(),t.css("display",""))}),0==e(".nice-select").length&&e(document).off(".nice_select")):console.log('Method "'+t+'" does not exist.'),this;this.hide(),this.each(function(){var t=e(this);t.next().hasClass("nice-select")||s(t)}),e(document).off(".nice_select"),e(document).on("click.nice_select",".nice-select",function(t){var s=e(this);e(".nice-select").not(s).removeClass("open"),s.toggleClass("open"),s.hasClass("open")?(s.find(".option"),s.find(".focus").removeClass("focus"),s.find(".selected").addClass("focus")):s.focus()}),e(document).on("click.nice_select",function(t){0===e(t.target).closest(".nice-select").length&&e(".nice-select").removeClass("open").find(".option")}),e(document).on("click.nice_select",".nice-select .option:not(.disabled)",function(t){var s=e(this),n=s.closest(".nice-select");n.find(".selected").removeClass("selected"),s.addClass("selected");var i=s.data("display")||s.text();n.find(".current").text(i),n.prev("select").val(s.data("value")).trigger("change")}),e(document).on("keydown.nice_select",".nice-select",function(t){var s=e(this),n=e(s.find(".focus")||s.find(".list .option.selected"));if(32==t.keyCode||13==t.keyCode)return s.hasClass("open")?n.trigger("click"):s.trigger("click"),!1;if(40==t.keyCode){if(s.hasClass("open")){var i=n.nextAll(".option:not(.disabled)").first();i.length>0&&(s.find(".focus").removeClass("focus"),i.addClass("focus"))}else s.trigger("click");return!1}if(38==t.keyCode){if(s.hasClass("open")){var l=n.prevAll(".option:not(.disabled)").first();l.length>0&&(s.find(".focus").removeClass("focus"),l.addClass("focus"))}else s.trigger("click");return!1}if(27==t.keyCode)s.hasClass("open")&&s.trigger("click");else if(9==t.keyCode&&s.hasClass("open"))return!1});var n=document.createElement("a").style;return n.cssText="pointer-events:auto","auto"!==n.pointerEvents&&e("html").addClass("no-csspointerevents"),this}}(jQuery);
+816
View File
@@ -0,0 +1,816 @@
/*!
* Date picker for pickadate.js v3.6.4
* http://amsul.github.io/pickadate.js/date.htm
*/
!(function (a) {
"function" == typeof define && define.amd
? define(["./picker", "jquery"], a)
: "object" == typeof exports
? (module.exports = a(require("./picker.js"), require("jquery")))
: a(Picker, jQuery);
})(function (a, b) {
function c(a, b) {
var c = this,
d = a.$node[0],
e = d.value,
f = a.$node.data("value"),
g = f || e,
h = f ? b.formatSubmit : b.format,
i = function () {
return d.currentStyle
? "rtl" == d.currentStyle.direction
: "rtl" == getComputedStyle(a.$root[0]).direction;
};
(c.settings = b),
(c.$node = a.$node),
(c.queue = {
min: "measure create",
max: "measure create",
now: "now create",
select: "parse create validate",
highlight: "parse navigate create validate",
view: "parse create validate viewset",
disable: "deactivate",
enable: "activate",
}),
(c.item = {}),
(c.item.clear = null),
(c.item.disable = (b.disable || []).slice(0)),
(c.item.enable = -(function (a) {
return !0 === a[0] ? a.shift() : -1;
})(c.item.disable)),
c.set("min", b.min).set("max", b.max).set("now"),
g
? c.set("select", g, { format: h, defaultValue: !0 })
: c.set("select", null).set("highlight", c.item.now),
(c.key = {
40: 7,
38: -7,
39: function () {
return i() ? -1 : 1;
},
37: function () {
return i() ? 1 : -1;
},
go: function (a) {
var b = c.item.highlight,
d = new Date(b.year, b.month, b.date + a);
c.set("highlight", d, { interval: a }), this.render();
},
}),
a
.on(
"render",
function () {
a.$root.find("." + b.klass.selectMonth).on("change", function () {
var c = this.value;
c &&
(a.set("highlight", [
a.get("view").year,
c,
a.get("highlight").date,
]),
a.$root.find("." + b.klass.selectMonth).trigger("focus"));
}),
a.$root.find("." + b.klass.selectYear).on("change", function () {
var c = this.value;
c &&
(a.set("highlight", [
c,
a.get("view").month,
a.get("highlight").date,
]),
a.$root.find("." + b.klass.selectYear).trigger("focus"));
});
},
1
)
.on(
"open",
function () {
var d = "";
c.disabled(c.get("now")) &&
(d = ":not(." + b.klass.buttonToday + ")"),
a.$root.find("button" + d + ", select").attr("disabled", !1);
},
1
)
.on(
"close",
function () {
a.$root.find("button, select").attr("disabled", !0);
},
1
);
}
var d = 7,
e = a._;
(c.prototype.set = function (a, b, c) {
var d = this,
e = d.item;
return null === b
? ("clear" == a && (a = "select"), (e[a] = b), d)
: ((e["enable" == a ? "disable" : "flip" == a ? "enable" : a] = d.queue[a]
.split(" ")
.map(function (e) {
return (b = d[e](a, b, c));
})
.pop()),
"select" == a
? d.set("highlight", e.select, c)
: "highlight" == a
? d.set("view", e.highlight, c)
: a.match(/^(flip|min|max|disable|enable)$/) &&
(e.select && d.disabled(e.select) && d.set("select", e.select, c),
e.highlight &&
d.disabled(e.highlight) &&
d.set("highlight", e.highlight, c)),
d);
}),
(c.prototype.get = function (a) {
return this.item[a];
}),
(c.prototype.create = function (a, c, d) {
var f,
g = this;
return (
(c = void 0 === c ? a : c),
c == -1 / 0 || c == 1 / 0
? (f = c)
: b.isPlainObject(c) && e.isInteger(c.pick)
? (c = c.obj)
: b.isArray(c)
? ((c = new Date(c[0], c[1], c[2])),
(c = e.isDate(c) ? c : g.create().obj))
: (c =
e.isInteger(c) || e.isDate(c)
? g.normalize(new Date(c), d)
: g.now(a, c, d)),
{
year: f || c.getFullYear(),
month: f || c.getMonth(),
date: f || c.getDate(),
day: f || c.getDay(),
obj: f || c,
pick: f || c.getTime(),
}
);
}),
(c.prototype.createRange = function (a, c) {
var d = this,
f = function (a) {
return !0 === a || b.isArray(a) || e.isDate(a) ? d.create(a) : a;
};
return (
e.isInteger(a) || (a = f(a)),
e.isInteger(c) || (c = f(c)),
e.isInteger(a) && b.isPlainObject(c)
? (a = [c.year, c.month, c.date + a])
: e.isInteger(c) &&
b.isPlainObject(a) &&
(c = [a.year, a.month, a.date + c]),
{ from: f(a), to: f(c) }
);
}),
(c.prototype.withinRange = function (a, b) {
return (
(a = this.createRange(a.from, a.to)),
b.pick >= a.from.pick && b.pick <= a.to.pick
);
}),
(c.prototype.overlapRanges = function (a, b) {
var c = this;
return (
(a = c.createRange(a.from, a.to)),
(b = c.createRange(b.from, b.to)),
c.withinRange(a, b.from) ||
c.withinRange(a, b.to) ||
c.withinRange(b, a.from) ||
c.withinRange(b, a.to)
);
}),
(c.prototype.now = function (a, b, c) {
return (
(b = new Date()),
c && c.rel && b.setDate(b.getDate() + c.rel),
this.normalize(b, c)
);
}),
(c.prototype.navigate = function (a, c, d) {
var e,
f,
g,
h,
i = b.isArray(c),
j = b.isPlainObject(c),
k = this.item.view;
if (i || j) {
for (
j
? ((f = c.year), (g = c.month), (h = c.date))
: ((f = +c[0]), (g = +c[1]), (h = +c[2])),
d && d.nav && k && k.month !== g && ((f = k.year), (g = k.month)),
e = new Date(f, g + (d && d.nav ? d.nav : 0), 1),
f = e.getFullYear(),
g = e.getMonth();
new Date(f, g, h).getMonth() !== g;
)
h -= 1;
c = [f, g, h];
}
return c;
}),
(c.prototype.normalize = function (a) {
return a.setHours(0, 0, 0, 0), a;
}),
(c.prototype.measure = function (a, b) {
var c = this;
return (
e.isInteger(b)
? (b = c.now(a, b, { rel: b }))
: b
? "string" == typeof b && (b = c.parse(a, b))
: (b = "min" == a ? -1 / 0 : 1 / 0),
b
);
}),
(c.prototype.viewset = function (a, b) {
return this.create([b.year, b.month, 1]);
}),
(c.prototype.validate = function (a, c, d) {
var f,
g,
h,
i,
j = this,
k = c,
l = d && d.interval ? d.interval : 1,
m = -1 === j.item.enable,
n = j.item.min,
o = j.item.max,
p =
m &&
j.item.disable.filter(function (a) {
if (b.isArray(a)) {
var d = j.create(a).pick;
d < c.pick ? (f = !0) : d > c.pick && (g = !0);
}
return e.isInteger(a);
}).length;
if (
(!d || (!d.nav && !d.defaultValue)) &&
((!m && j.disabled(c)) ||
(m && j.disabled(c) && (p || f || g)) ||
(!m && (c.pick <= n.pick || c.pick >= o.pick)))
)
for (
m && !p && ((!g && l > 0) || (!f && l < 0)) && (l *= -1);
j.disabled(c) &&
(Math.abs(l) > 1 &&
(c.month < k.month || c.month > k.month) &&
((c = k), (l = l > 0 ? 1 : -1)),
c.pick <= n.pick
? ((h = !0),
(l = 1),
(c = j.create([
n.year,
n.month,
n.date + (c.pick === n.pick ? 0 : -1),
])))
: c.pick >= o.pick &&
((i = !0),
(l = -1),
(c = j.create([
o.year,
o.month,
o.date + (c.pick === o.pick ? 0 : 1),
]))),
!h || !i);
)
c = j.create([c.year, c.month, c.date + l]);
return c;
}),
(c.prototype.disabled = function (a) {
var c = this,
d = c.item.disable.filter(function (d) {
return e.isInteger(d)
? a.day === (c.settings.firstDay ? d : d - 1) % 7
: b.isArray(d) || e.isDate(d)
? a.pick === c.create(d).pick
: b.isPlainObject(d)
? c.withinRange(d, a)
: void 0;
});
return (
(d =
d.length &&
!d.filter(function (a) {
return (
(b.isArray(a) && "inverted" == a[3]) ||
(b.isPlainObject(a) && a.inverted)
);
}).length),
-1 === c.item.enable
? !d
: d || a.pick < c.item.min.pick || a.pick > c.item.max.pick
);
}),
(c.prototype.parse = function (a, b, c) {
var d = this,
f = {};
return b && "string" == typeof b
? ((c && c.format) || ((c = c || {}), (c.format = d.settings.format)),
d.formats.toArray(c.format).map(function (a) {
var c = d.formats[a],
g = c ? e.trigger(c, d, [b, f]) : a.replace(/^!/, "").length;
c && (f[a] = b.substr(0, g)), (b = b.substr(g));
}),
[f.yyyy || f.yy, +(f.mm || f.m) - 1, f.dd || f.d])
: b;
}),
(c.prototype.formats = (function () {
function a(a, b, c) {
var d = a.match(/[^\x00-\x7F]+|\w+/)[0];
return c.mm || c.m || (c.m = b.indexOf(d) + 1), d.length;
}
function b(a) {
return a.match(/\w+/)[0].length;
}
return {
d: function (a, b) {
return a ? e.digits(a) : b.date;
},
dd: function (a, b) {
return a ? 2 : e.lead(b.date);
},
ddd: function (a, c) {
return a ? b(a) : this.settings.weekdaysShort[c.day];
},
dddd: function (a, c) {
return a ? b(a) : this.settings.weekdaysFull[c.day];
},
m: function (a, b) {
return a ? e.digits(a) : b.month + 1;
},
mm: function (a, b) {
return a ? 2 : e.lead(b.month + 1);
},
mmm: function (b, c) {
var d = this.settings.monthsShort;
return b ? a(b, d, c) : d[c.month];
},
mmmm: function (b, c) {
var d = this.settings.monthsShort;
return b ? a(b, d, c) : d[c.month];
},
yy: function (a, b) {
return a ? 2 : ("" + b.year).slice(2);
},
yyyy: function (a, b) {
return a ? 4 : b.year;
},
toArray: function (a) {
return a.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
},
toString: function (a, b) {
var c = this;
return c.formats
.toArray(a)
.map(function (a) {
return e.trigger(c.formats[a], c, [0, b]) || a.replace(/^!/, "");
})
.join("");
},
};
})()),
(c.prototype.isDateExact = function (a, c) {
var d = this;
return (e.isInteger(a) && e.isInteger(c)) ||
("boolean" == typeof a && "boolean" == typeof c)
? a === c
: (e.isDate(a) || b.isArray(a)) && (e.isDate(c) || b.isArray(c))
? d.create(a).pick === d.create(c).pick
: !(!b.isPlainObject(a) || !b.isPlainObject(c)) &&
d.isDateExact(a.from, c.from) &&
d.isDateExact(a.to, c.to);
}),
(c.prototype.isDateOverlap = function (a, c) {
var d = this,
f = d.settings.firstDay ? 1 : 0;
return e.isInteger(a) && (e.isDate(c) || b.isArray(c))
? (a = (a % 7) + f) === d.create(c).day + 1
: e.isInteger(c) && (e.isDate(a) || b.isArray(a))
? (c = (c % 7) + f) === d.create(a).day + 1
: !(!b.isPlainObject(a) || !b.isPlainObject(c)) &&
d.overlapRanges(a, c);
}),
(c.prototype.flipEnable = function (a) {
var b = this.item;
b.enable = a || (-1 == b.enable ? 1 : -1);
}),
(c.prototype.deactivate = function (a, c) {
var d = this,
f = d.item.disable.slice(0);
return (
"flip" == c
? d.flipEnable()
: !1 === c
? (d.flipEnable(1), (f = []))
: !0 === c
? (d.flipEnable(-1), (f = []))
: c.map(function (a) {
for (var c, g = 0; g < f.length; g += 1)
if (d.isDateExact(a, f[g])) {
c = !0;
break;
}
c ||
((e.isInteger(a) ||
e.isDate(a) ||
b.isArray(a) ||
(b.isPlainObject(a) && a.from && a.to)) &&
f.push(a));
}),
f
);
}),
(c.prototype.activate = function (a, c) {
var d = this,
f = d.item.disable,
g = f.length;
return (
"flip" == c
? d.flipEnable()
: !0 === c
? (d.flipEnable(1), (f = []))
: !1 === c
? (d.flipEnable(-1), (f = []))
: c.map(function (a) {
var c, h, i, j;
for (i = 0; i < g; i += 1) {
if (((h = f[i]), d.isDateExact(h, a))) {
(c = f[i] = null), (j = !0);
break;
}
if (d.isDateOverlap(h, a)) {
b.isPlainObject(a)
? ((a.inverted = !0), (c = a))
: b.isArray(a)
? ((c = a), c[3] || c.push("inverted"))
: e.isDate(a) &&
(c = [
a.getFullYear(),
a.getMonth(),
a.getDate(),
"inverted",
]);
break;
}
}
if (c)
for (i = 0; i < g; i += 1)
if (d.isDateExact(f[i], a)) {
f[i] = null;
break;
}
if (j)
for (i = 0; i < g; i += 1)
if (d.isDateOverlap(f[i], a)) {
f[i] = null;
break;
}
c && f.push(c);
}),
f.filter(function (a) {
return null != a;
})
);
}),
(c.prototype.nodes = function (a) {
var b = this,
c = b.settings,
f = b.item,
g = f.now,
h = f.select,
i = f.highlight,
j = f.view,
k = f.disable,
l = f.min,
m = f.max,
n = (function (a, b) {
return (
c.firstDay && (a.push(a.shift()), b.push(b.shift())),
e.node(
"thead",
e.node(
"tr",
e.group({
min: 0,
max: d - 1,
i: 1,
node: "th",
item: function (d) {
return [
a[d],
c.klass.weekdays,
'scope=col title="' + b[d] + '"',
];
},
})
)
)
);
})(
(c.showWeekdaysFull ? c.weekdaysFull : c.weekdaysShort).slice(0),
c.weekdaysFull.slice(0)
),
o = function (a) {
return e.node(
"div",
" ",
c.klass["nav" + (a ? "Next" : "Prev")] +
((a && j.year >= m.year && j.month >= m.month) ||
(!a && j.year <= l.year && j.month <= l.month)
? " " + c.klass.navDisabled
: ""),
"data-nav=" +
(a || -1) +
" " +
e.ariaAttr({
role: "button",
controls: b.$node[0].id + "_table",
}) +
' title="' +
(a ? c.labelMonthNext : c.labelMonthPrev) +
'"'
);
},
p = function () {
var d = c.showMonthsShort ? c.monthsShort : c.monthsFull;
return c.selectMonths
? e.node(
"select",
e.group({
min: 0,
max: 11,
i: 1,
node: "option",
item: function (a) {
return [
d[a],
0,
"value=" +
a +
(j.month == a ? " selected" : "") +
((j.year == l.year && a < l.month) ||
(j.year == m.year && a > m.month)
? " disabled"
: ""),
];
},
}),
c.klass.selectMonth,
(a ? "" : "disabled") +
" " +
e.ariaAttr({ controls: b.$node[0].id + "_table" }) +
' title="' +
c.labelMonthSelect +
'"'
)
: e.node("div", d[j.month], c.klass.month);
},
q = function () {
var d = j.year,
f = !0 === c.selectYears ? 5 : ~~(c.selectYears / 2);
if (f) {
var g = l.year,
h = m.year,
i = d - f,
k = d + f;
if ((g > i && ((k += g - i), (i = g)), h < k)) {
var n = i - g,
o = k - h;
(i -= n > o ? o : n), (k = h);
}
return e.node(
"select",
e.group({
min: i,
max: k,
i: 1,
node: "option",
item: function (a) {
return [a, 0, "value=" + a + (d == a ? " selected" : "")];
},
}),
c.klass.selectYear,
(a ? "" : "disabled") +
" " +
e.ariaAttr({ controls: b.$node[0].id + "_table" }) +
' title="' +
c.labelYearSelect +
'"'
);
}
return e.node("div", d, c.klass.year);
};
return (
e.node(
"div",
(c.selectYears ? q() + p() : p() + q()) + o() + o(1),
c.klass.header
) +
e.node(
"table",
n +
e.node(
"tbody",
e.group({
min: 0,
max: 5,
i: 1,
node: "tr",
item: function (a) {
var f =
c.firstDay && 0 === b.create([j.year, j.month, 1]).day
? -7
: 0;
return [
e.group({
min: d * a - j.day + f + 1,
max: function () {
return this.min + d - 1;
},
i: 1,
node: "td",
item: function (a) {
a = b.create([
j.year,
j.month,
a + (c.firstDay ? 1 : 0),
]);
var d = h && h.pick == a.pick,
f = i && i.pick == a.pick,
n =
(k && b.disabled(a)) ||
a.pick < l.pick ||
a.pick > m.pick,
o = e.trigger(b.formats.toString, b, [c.format, a]);
return [
e.node(
"div",
a.date,
(function (b) {
return (
b.push(
j.month == a.month
? c.klass.infocus
: c.klass.outfocus
),
g.pick == a.pick && b.push(c.klass.now),
d && b.push(c.klass.selected),
f && b.push(c.klass.highlighted),
n && b.push(c.klass.disabled),
b.join(" ")
);
})([c.klass.day]),
"data-pick=" +
a.pick +
" " +
e.ariaAttr({
role: "gridcell",
label: o,
selected: !(!d || b.$node.val() !== o) || null,
activedescendant: !!f || null,
disabled: !!n || null,
})
),
"",
e.ariaAttr({ role: "presentation" }),
];
},
}),
];
},
})
),
c.klass.table,
'id="' +
b.$node[0].id +
'_table" ' +
e.ariaAttr({ role: "grid", controls: b.$node[0].id, readonly: !0 })
) +
e.node(
"div",
e.node(
"button",
c.today,
c.klass.buttonToday,
"type=button data-pick=" +
g.pick +
(a && !b.disabled(g) ? "" : " disabled") +
" " +
e.ariaAttr({ controls: b.$node[0].id })
) +
e.node(
"button",
c.clear,
c.klass.buttonClear,
"type=button data-clear=1" +
(a ? "" : " disabled") +
" " +
e.ariaAttr({ controls: b.$node[0].id })
) +
e.node(
"button",
c.close,
c.klass.buttonClose,
"type=button data-close=true " +
(a ? "" : " disabled") +
" " +
e.ariaAttr({ controls: b.$node[0].id })
),
c.klass.footer
)
);
}),
(c.defaults = (function (a) {
return {
labelMonthNext: "Next month",
labelMonthPrev: "Previous month",
labelMonthSelect: "Select a month",
labelYearSelect: "Select a year",
monthsFull: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
],
monthsShort: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
],
weekdaysFull: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
],
weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
today: "Today",
clear: "Clear",
close: "Close",
closeOnSelect: !0,
closeOnClear: !0,
updateInput: !0,
format: "d mmmm, yyyy",
klass: {
table: a + "table",
header: a + "header",
navPrev: a + "nav--prev",
navNext: a + "nav--next",
navDisabled: a + "nav--disabled",
month: a + "month",
year: a + "year",
selectMonth: a + "select--month",
selectYear: a + "select--year",
weekdays: a + "weekday",
day: a + "day",
disabled: a + "day--disabled",
selected: a + "day--selected",
highlighted: a + "day--highlighted",
now: a + "day--today",
infocus: a + "day--infocus",
outfocus: a + "day--outfocus",
footer: a + "footer",
buttonClear: a + "button--clear",
buttonToday: a + "button--today",
buttonClose: a + "button--close",
},
};
})(a.klasses().picker + "__")),
a.extend("pickadate", c);
});
Vendored Executable
+503
View File
@@ -0,0 +1,503 @@
/*!
* pickadate.js v3.6.4, 2019/05/25
* By Amsul, http://amsul.ca
* Hosted on http://amsul.github.io/pickadate.js
* Licensed under MIT
*/
!(function (a) {
"function" == typeof define && define.amd
? define("picker", ["jquery"], a)
: "object" == typeof exports
? (module.exports = a(require("jquery")))
: "object" == typeof window
? (window.Picker = a(jQuery))
: (this.Picker = a(jQuery));
})(function (a) {
function b(g, h, j, l) {
function n() {
return b._.node(
"div",
b._.node(
"div",
b._.node(
"div",
b._.node("div", B.component.nodes(w.open), y.box),
y.wrap
),
y.frame
),
y.holder,
'tabindex="-1"'
);
}
function o() {
z
.data(h, B)
.addClass(y.input)
.val(z.data("value") ? B.get("select", x.format) : g.value)
.on("focus." + w.id + " click." + w.id, function (a) {
a.preventDefault(), B.open();
})
.on("mousedown", function () {
w.handlingOpen = !0;
var b = function () {
setTimeout(function () {
a(document).off("mouseup", b), (w.handlingOpen = !1);
}, 0);
};
a(document).on("mouseup", b);
}),
x.editable || z.on("keydown." + w.id, u),
f(g, {
haspopup: !0,
expanded: !1,
readonly: !1,
owns: g.id + "_root",
});
}
function p() {
f(B.$root[0], "hidden", !0);
}
function q() {
B.$holder
.on({
keydown: u,
"focus.toOpen": t,
blur: function () {
z.removeClass(y.target);
},
focusin: function (a) {
B.$root.removeClass(y.focused), a.stopPropagation();
},
"mousedown click": function (b) {
var c = e(b, g);
c != B.$holder[0] &&
(b.stopPropagation(),
"mousedown" != b.type ||
a(c).is("input, select, textarea, button, option") ||
(b.preventDefault(), B.$holder.eq(0).focus()));
},
})
.on(
"click",
"[data-pick], [data-nav], [data-clear], [data-close]",
function () {
var b = a(this),
c = b.data(),
d = b.hasClass(y.navDisabled) || b.hasClass(y.disabled),
e = i();
(e = e && (e.type || e.href ? e : null)),
(d || (e && !a.contains(B.$root[0], e))) &&
B.$holder.eq(0).focus(),
!d && c.nav
? B.set("highlight", B.component.item.highlight, { nav: c.nav })
: !d && "pick" in c
? (B.set("select", c.pick), x.closeOnSelect && B.close(!0))
: c.clear
? (B.clear(), x.closeOnClear && B.close(!0))
: c.close && B.close(!0);
}
);
}
function r() {
var b;
!0 === x.hiddenName
? ((b = g.name), (g.name = ""))
: ((b = [
"string" == typeof x.hiddenPrefix ? x.hiddenPrefix : "",
"string" == typeof x.hiddenSuffix ? x.hiddenSuffix : "_submit",
]),
(b = b[0] + g.name + b[1])),
(B._hidden = a(
'<input type=hidden name="' +
b +
'"' +
(z.data("value") || g.value
? ' value="' + B.get("select", x.formatSubmit) + '"'
: "") +
">"
)[0]),
z.on("change." + w.id, function () {
B._hidden.value = g.value ? B.get("select", x.formatSubmit) : "";
});
}
function s() {
v && m
? B.$holder.find("." + y.frame).one("transitionend", function () {
B.$holder.eq(0).focus();
})
: setTimeout(function () {
B.$holder.eq(0).focus();
}, 0);
}
function t(a) {
a.stopPropagation(),
z.addClass(y.target),
B.$root.addClass(y.focused),
B.open();
}
function u(a) {
var b = a.keyCode,
c = /^(8|46)$/.test(b);
if (27 == b) return B.close(!0), !1;
(32 == b || c || (!w.open && B.component.key[b])) &&
(a.preventDefault(),
a.stopPropagation(),
c ? B.clear().close() : B.open());
}
if (!g) return b;
var v = !1,
w = {
id: g.id || "P" + Math.abs(~~(Math.random() * new Date())),
handlingOpen: !1,
},
x = j ? a.extend(!0, {}, j.defaults, l) : l || {},
y = a.extend({}, b.klasses(), x.klass),
z = a(g),
A = function () {
return this.start();
},
B = (A.prototype = {
constructor: A,
$node: z,
start: function () {
return w && w.start
? B
: ((w.methods = {}),
(w.start = !0),
(w.open = !1),
(w.type = g.type),
(g.autofocus = g == i()),
(g.readOnly = !x.editable),
(g.id = g.id || w.id),
"text" != g.type && (g.type = "text"),
(B.component = new j(B, x)),
(B.$root = a(
'<div class="' + y.picker + '" id="' + g.id + '_root" />'
)),
p(),
(B.$holder = a(n()).appendTo(B.$root)),
q(),
x.formatSubmit && r(),
o(),
x.containerHidden
? a(x.containerHidden).append(B._hidden)
: z.after(B._hidden),
x.container ? a(x.container).append(B.$root) : z.after(B.$root),
B.on({
start: B.component.onStart,
render: B.component.onRender,
stop: B.component.onStop,
open: B.component.onOpen,
close: B.component.onClose,
set: B.component.onSet,
}).on({
start: x.onStart,
render: x.onRender,
stop: x.onStop,
open: x.onOpen,
close: x.onClose,
set: x.onSet,
}),
(v = c(B.$holder[0])),
g.autofocus && B.open(),
B.trigger("start").trigger("render"));
},
render: function (b) {
return (
b
? ((B.$holder = a(n())), q(), B.$root.html(B.$holder))
: B.$root.find("." + y.box).html(B.component.nodes(w.open)),
B.trigger("render")
);
},
stop: function () {
return w.start
? (B.close(),
B._hidden && B._hidden.parentNode.removeChild(B._hidden),
B.$root.remove(),
z.removeClass(y.input).removeData(h),
setTimeout(function () {
z.off("." + w.id);
}, 0),
(g.type = w.type),
(g.readOnly = !1),
B.trigger("stop"),
(w.methods = {}),
(w.start = !1),
B)
: B;
},
open: function (c) {
return w.open
? B
: (z.addClass(y.active),
f(g, "expanded", !0),
setTimeout(function () {
B.$root.addClass(y.opened), f(B.$root[0], "hidden", !1);
}, 0),
!1 !== c &&
((w.open = !0),
v &&
a("body")
.css("overflow", "hidden")
.css("padding-right", "+=" + d()),
s(),
k
.on("click." + w.id + " focusin." + w.id, function (a) {
if (!w.handlingOpen) {
var b = e(a, g);
a.isSimulated ||
b == g ||
b == document ||
3 == a.which ||
B.close(b === B.$holder[0]);
}
})
.on("keydown." + w.id, function (c) {
var d = c.keyCode,
f = B.component.key[d],
h = e(c, g);
27 == d
? B.close(!0)
: h != B.$holder[0] || (!f && 13 != d)
? a.contains(B.$root[0], h) &&
13 == d &&
(c.preventDefault(), h.click())
: (c.preventDefault(),
f
? b._.trigger(B.component.key.go, B, [b._.trigger(f)])
: B.$root
.find("." + y.highlighted)
.hasClass(y.disabled) ||
(B.set("select", B.component.item.highlight),
x.closeOnSelect && B.close(!0)));
})),
B.trigger("open"));
},
close: function (b) {
return (
b &&
(x.editable
? g.focus()
: (B.$holder.off("focus.toOpen").focus(),
setTimeout(function () {
B.$holder.on("focus.toOpen", t);
}, 0))),
z.removeClass(y.active),
f(g, "expanded", !1),
setTimeout(function () {
B.$root.removeClass(y.opened + " " + y.focused),
f(B.$root[0], "hidden", !0);
}, 0),
w.open
? ((w.open = !1),
v &&
a("body")
.css("overflow", "")
.css("padding-right", "-=" + d()),
k.off("." + w.id),
B.trigger("close"))
: B
);
},
clear: function (a) {
return B.set("clear", null, a);
},
set: function (b, c, d) {
var e,
f,
g = a.isPlainObject(b),
h = g ? b : {};
if (((d = g && a.isPlainObject(c) ? c : d || {}), b)) {
g || (h[b] = c);
for (e in h)
(f = h[e]),
e in B.component.item &&
(void 0 === f && (f = null), B.component.set(e, f, d)),
("select" != e && "clear" != e) ||
!x.updateInput ||
z
.val("clear" == e ? "" : B.get(e, x.format))
.trigger("change");
B.render();
}
return d.muted ? B : B.trigger("set", h);
},
get: function (a, c) {
if (((a = a || "value"), null != w[a])) return w[a];
if ("valueSubmit" == a) {
if (B._hidden) return B._hidden.value;
a = "value";
}
if ("value" == a) return g.value;
if (a in B.component.item) {
if ("string" == typeof c) {
var d = B.component.get(a);
return d
? b._.trigger(B.component.formats.toString, B.component, [c, d])
: "";
}
return B.component.get(a);
}
},
on: function (b, c, d) {
var e,
f,
g = a.isPlainObject(b),
h = g ? b : {};
if (b) {
g || (h[b] = c);
for (e in h)
(f = h[e]),
d && (e = "_" + e),
(w.methods[e] = w.methods[e] || []),
w.methods[e].push(f);
}
return B;
},
off: function () {
var a,
b,
c = arguments;
for (a = 0, namesCount = c.length; a < namesCount; a += 1)
(b = c[a]) in w.methods && delete w.methods[b];
return B;
},
trigger: function (a, c) {
var d = function (a) {
var d = w.methods[a];
d &&
d.map(function (a) {
b._.trigger(a, B, [c]);
});
};
return d("_" + a), d(a), B;
},
});
return new A();
}
function c(a) {
var b,
c = "position";
return (
a.currentStyle
? (b = a.currentStyle[c])
: window.getComputedStyle && (b = getComputedStyle(a)[c]),
"fixed" == b
);
}
function d() {
if (l.height() <= j.height()) return 0;
var b = a('<div style="visibility:hidden;width:100px" />').appendTo("body"),
c = b[0].offsetWidth;
b.css("overflow", "scroll");
var d = a('<div style="width:100%" />').appendTo(b),
e = d[0].offsetWidth;
return b.remove(), c - e;
}
function e(a, b) {
var c = [];
return (
a.path && (c = a.path),
a.originalEvent && a.originalEvent.path && (c = a.originalEvent.path),
c && c.length > 0 ? (b && c.indexOf(b) >= 0 ? b : c[0]) : a.target
);
}
function f(b, c, d) {
if (a.isPlainObject(c)) for (var e in c) g(b, e, c[e]);
else g(b, c, d);
}
function g(a, b, c) {
a.setAttribute(("role" == b ? "" : "aria-") + b, c);
}
function h(b, c) {
a.isPlainObject(b) || (b = { attribute: c }), (c = "");
for (var d in b) {
var e = ("role" == d ? "" : "aria-") + d;
c += null == b[d] ? "" : e + '="' + b[d] + '"';
}
return c;
}
function i() {
try {
return document.activeElement;
} catch (a) {}
}
var j = a(window),
k = a(document),
l = a(document.documentElement),
m = null != document.documentElement.style.transition;
return (
(b.klasses = function (a) {
return (
(a = a || "picker"),
{
picker: a,
opened: a + "--opened",
focused: a + "--focused",
input: a + "__input",
active: a + "__input--active",
target: a + "__input--target",
holder: a + "__holder",
frame: a + "__frame",
wrap: a + "__wrap",
box: a + "__box",
}
);
}),
(b._ = {
group: function (a) {
for (
var c, d = "", e = b._.trigger(a.min, a);
e <= b._.trigger(a.max, a, [e]);
e += a.i
)
(c = b._.trigger(a.item, a, [e])),
(d += b._.node(a.node, c[0], c[1], c[2]));
return d;
},
node: function (b, c, d, e) {
return c
? ((c = a.isArray(c) ? c.join("") : c),
(d = d ? ' class="' + d + '"' : ""),
(e = e ? " " + e : ""),
"<" + b + d + e + ">" + c + "</" + b + ">")
: "";
},
lead: function (a) {
return (a < 10 ? "0" : "") + a;
},
trigger: function (a, b, c) {
return "function" == typeof a ? a.apply(b, c || []) : a;
},
digits: function (a) {
return /\d/.test(a[1]) ? 2 : 1;
},
isDate: function (a) {
return (
{}.toString.call(a).indexOf("Date") > -1 &&
this.isInteger(a.getDate())
);
},
isInteger: function (a) {
return {}.toString.call(a).indexOf("Number") > -1 && a % 1 == 0;
},
ariaAttr: h,
}),
(b.extend = function (c, d) {
(a.fn[c] = function (e, f) {
var g = this.data(c);
return "picker" == e
? g
: g && "string" == typeof e
? b._.trigger(g[e], g, [f])
: this.each(function () {
a(this).data(c) || new b(this, c, d, e);
});
}),
(a.fn[c].defaults = d.defaults);
}),
b
);
});
+99
View File
@@ -0,0 +1,99 @@
/*
slick-animation.js
Version: 0.3.3 Beta
Author: Marvin Hübner
Docs: https://github.com/marvinhuebner/slick-animation
Repo: https://github.com/marvinhuebner/slick-animation
*/
!(function (a) {
a.fn.slickAnimation = function () {
function n(a, n, t, i, o) {
(o = "undefined" != typeof o ? o : !1),
1 == n.opacity
? (a.addClass(t), a.addClass(i))
: (a.removeClass(t), a.removeClass(i)),
o && a.css(n);
}
function t(a, n) {
return a ? 1e3 * a + 1e3 : n ? 1e3 * n : a || n ? 1e3 * a + 1e3 * n : 1e3;
}
function i(a, n, t) {
var i = [
"animation-" + n,
"-webkit-animation-" + n,
"-moz-animation-" + n,
"-o-animation-" + n,
"-ms-animation-" + n,
],
o = {};
i.forEach(function (a) {
o[a] = t + "s";
}),
a.css(o);
}
var o = a(this),
e = o.find(".slick-list .slick-track > div"),
s = o.find('[data-slick-index="0"]'),
r = "animated",
c = { opacity: "1" },
d = { opacity: "0" };
return (
e.each(function () {
var e = a(this);
e.find("[data-animation-in]").each(function () {
var u = a(this);
u.css(d);
var l = u.attr("data-animation-in"),
f = u.attr("data-animation-out"),
h = u.attr("data-delay-in"),
m = u.attr("data-duration-in"),
y = u.attr("data-delay-out"),
C = u.attr("data-duration-out");
f
? (s.length > 0 &&
e.hasClass("slick-current") &&
(n(u, c, l, r, !0),
h && i(u, "delay", h),
m && i(u, "duration", m),
setTimeout(function () {
n(u, d, l, r),
n(u, c, f, r),
y && i(u, "delay", y),
C && i(u, "duration", C);
}, t(h, m))),
o.on("afterChange", function (a, o, s) {
e.hasClass("slick-current") &&
(n(u, c, l, r, !0),
h && i(u, "delay", h),
m && i(u, "duration", m),
setTimeout(function () {
n(u, d, l, r),
n(u, c, f, r),
y && i(u, "delay", y),
C && i(u, "duration", C);
}, t(h, m)));
}),
o.on("beforeChange", function (a, t, i) {
n(u, d, f, r, !0);
}))
: (s.length > 0 &&
e.hasClass("slick-current") &&
(n(u, c, l, r, !0),
h && i(u, "delay", h),
m && i(u, "duration", m)),
o.on("afterChange", function (a, t, o) {
e.hasClass("slick-current") &&
(n(u, c, l, r, !0),
h && i(u, "delay", h),
m && i(u, "duration", m));
}),
o.on("beforeChange", function (a, t, i) {
n(u, d, l, r, !0);
}));
});
}),
this
);
};
})(jQuery);
+1
View File
File diff suppressed because one or more lines are too long
+3512
View File
File diff suppressed because it is too large Load Diff
+446
View File
@@ -0,0 +1,446 @@
/* -- DO NOT REMOVE --
* jQuery MDTimePicker v1.0 plugin
*
* Author: Dionlee Uy
* Email: dionleeuy@gmail.com
*
* Date: Tuesday, August 28 2017
*
* @requires jQuery
* -- DO NOT REMOVE -- */
if ("undefined" == typeof jQuery)
throw new Error("MDTimePicker: This plugin requires jQuery");
+(function (e) {
var t = "mdtimepicker",
i = 120,
s = 90,
n = 360,
r = 30,
a = 6,
o = [9, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123],
c = function (t, i) {
(this.hour = t),
(this.minute = i),
(this.format = function (t, i) {
var s = this,
n = (t.match(/h/g) || []).length > 1;
return e.trim(
t.replace(/(hh|h|mm|ss|tt|t)/g, function (e) {
switch (e.toLowerCase()) {
case "h":
var t = s.getHour(!0);
return i && 10 > t ? "0" + t : t;
case "hh":
return s.hour < 10 ? "0" + s.hour : s.hour;
case "mm":
return s.minute < 10 ? "0" + s.minute : s.minute;
case "ss":
return "00";
case "t":
return n ? "" : s.getT().toLowerCase();
case "tt":
return n ? "" : s.getT();
}
})
);
}),
(this.setHour = function (e) {
this.hour = e;
}),
(this.getHour = function (e) {
return e
? 0 === this.hour || 12 === this.hour
? 12
: this.hour % 12
: this.hour;
}),
(this.invert = function () {
"AM" === this.getT()
? this.setHour(this.getHour() + 12)
: this.setHour(this.getHour() - 12);
}),
(this.setMinutes = function (e) {
this.minute = e;
}),
(this.getMinutes = function () {
return this.minute;
}),
(this.getT = function () {
return this.hour < 12 ? "AM" : "PM";
});
},
d = function (t, i) {
var s = this;
(this.visible = !1),
(this.activeView = "hours"),
(this.hTimeout = null),
(this.mTimeout = null),
(this.input = e(t)),
(this.config = i),
(this.time = new c(0, 0)),
(this.selected = new c(0, 0)),
(this.timepicker = {
overlay: e('<div class="mdtimepicker hidden"></div>'),
wrapper: e('<div class="mdtp__wrapper"></div>'),
timeHolder: {
wrapper: e('<section class="mdtp__time_holder"></section>'),
hour: e('<span class="mdtp__time_h">12</span>'),
dots: e('<span class="mdtp__timedots">:</span>'),
minute: e('<span class="mdtp__time_m">00</span>'),
am_pm: e('<span class="mdtp__ampm">AM</span>'),
},
clockHolder: {
wrapper: e('<section class="mdtp__clock_holder"></section>'),
am: e('<span class="mdtp__am">AM</span>'),
pm: e('<span class="mdtp__pm">PM</span>'),
clock: {
wrapper: e('<div class="mdtp__clock"></div>'),
dot: e('<span class="mdtp__clock_dot"></span>'),
hours: e('<div class="mdtp__hour_holder"></div>'),
minutes: e('<div class="mdtp__minute_holder"></div>'),
},
buttonsHolder: {
wrapper: e('<div class="mdtp__buttons">'),
btnOk: e('<span class="mdtp__button ok">Ok</span>'),
btnCancel: e('<span class="mdtp__button cancel">Cancel</span>'),
},
},
});
var n = s.timepicker;
if (
(s.setup(n).appendTo("body"),
n.clockHolder.am.click(function () {
"AM" !== s.selected.getT() && s.setT("am");
}),
n.clockHolder.pm.click(function () {
"PM" !== s.selected.getT() && s.setT("pm");
}),
n.timeHolder.hour.click(function () {
"hours" !== s.activeView && s.switchView("hours");
}),
n.timeHolder.minute.click(function () {
"minutes" !== s.activeView && s.switchView("minutes");
}),
n.clockHolder.buttonsHolder.btnOk.click(function () {
s.setValue(s.selected);
var t = s.getFormattedTime();
s.input
.trigger(e.Event("timechanged", { time: t.time, value: t.value }))
.trigger("onchange"),
s.hide();
}),
n.clockHolder.buttonsHolder.btnCancel.click(function () {
s.hide();
}),
s.input
.on("keydown", function (e) {
return (
13 === e.keyCode && s.show(),
!(o.indexOf(e.which) < 0 && s.config.readOnly)
);
})
.on("click", function () {
s.show();
})
.prop("readonly", s.config.readOnly),
"" !== s.input.val())
) {
var r = s.parseTime(s.input.val(), s.config.format);
s.setValue(r);
} else {
var r = s.getSystemTime();
s.time = new c(r.hour, r.minute);
}
s.resetSelected(), s.switchView(s.activeView);
};
(d.prototype = {
constructor: d,
setup: function (t) {
if ("undefined" == typeof t) throw new Error("Expecting a value.");
var o = this,
c = t.overlay,
d = t.wrapper,
u = t.timeHolder,
m = t.clockHolder;
u.wrapper
.append(u.hour)
.append(u.dots)
.append(u.minute)
.append(u.am_pm)
.appendTo(d);
for (var l = 0; 12 > l; l++) {
var p = l + 1,
h = (i + l * r) % n,
f = e(
'<div class="mdtp__digit rotate-' +
h +
'" data-hour="' +
p +
'"><span>' +
p +
"</span></div>"
);
f.find("span").click(function () {
var t = parseInt(e(this).parent().data("hour")),
i = o.selected.getT(),
s =
(t +
(("PM" === i && 12 > t) || ("AM" === i && 12 === t) ? 12 : 0)) %
24;
o.setHour(s), o.switchView("minutes");
}),
m.clock.hours.append(f);
}
for (var l = 0; 60 > l; l++) {
var v = 10 > l ? "0" + l : l,
h = (s + l * a) % n,
k = e(
'<div class="mdtp__digit rotate-' +
h +
'" data-minute="' +
l +
'"></div>'
);
l % 5 === 0
? k.addClass("marker").html("<span>" + v + "</span>")
: k.html("<span></span>"),
k.find("span").click(function () {
o.setMinute(e(this).parent().data("minute"));
}),
m.clock.minutes.append(k);
}
switch (
(m.clock.wrapper
.append(m.am)
.append(m.pm)
.append(m.clock.dot)
.append(m.clock.hours)
.append(m.clock.minutes)
.appendTo(m.wrapper),
m.buttonsHolder.wrapper
.append(m.buttonsHolder.btnCancel)
.append(m.buttonsHolder.btnOk)
.appendTo(m.wrapper),
m.wrapper.appendTo(d),
o.config.theme)
) {
case "red":
case "blue":
case "green":
case "purple":
case "indigo":
case "teal":
d.attr("data-theme", o.config.theme);
break;
default:
d.attr("data-theme", e.fn.mdtimepicker.defaults.theme);
}
return d.appendTo(c), c;
},
setHour: function (t) {
if ("undefined" == typeof t) throw new Error("Expecting a value.");
var i = this;
this.selected.setHour(t),
this.timepicker.timeHolder.hour.text(this.selected.getHour(!0)),
this.timepicker.clockHolder.clock.hours
.children("div")
.each(function (t, s) {
var n = e(s),
r = n.data("hour");
n[r === i.selected.getHour(!0) ? "addClass" : "removeClass"](
"active"
);
});
},
setMinute: function (t) {
if ("undefined" == typeof t) throw new Error("Expecting a value.");
this.selected.setMinutes(t),
this.timepicker.timeHolder.minute.text(10 > t ? "0" + t : t),
this.timepicker.clockHolder.clock.minutes
.children("div")
.each(function (i, s) {
var n = e(s),
r = n.data("minute");
n[r === t ? "addClass" : "removeClass"]("active");
});
},
setT: function (e) {
if ("undefined" == typeof e) throw new Error("Expecting a value.");
this.selected.getT() !== e.toUpperCase() && this.selected.invert();
var t = this.selected.getT();
this.timepicker.timeHolder.am_pm.text(t),
this.timepicker.clockHolder.am["AM" === t ? "addClass" : "removeClass"](
"active"
),
this.timepicker.clockHolder.pm["PM" === t ? "addClass" : "removeClass"](
"active"
);
},
setValue: function (e) {
if ("undefined" == typeof e) throw new Error("Expecting a value.");
var t = "string" == typeof e ? this.parseTime(e, this.config.format) : e;
this.time = new c(t.hour, t.minute);
var i = this.getFormattedTime();
this.input.val(i.value).attr("data-time", i.time).attr("value", i.value);
},
resetSelected: function () {
this.setHour(this.time.hour),
this.setMinute(this.time.minute),
this.setT(this.time.getT());
},
getFormattedTime: function () {
var e = this.time.format(this.config.timeFormat, !1),
t = this.time.format(this.config.format, this.config.hourPadding);
return { time: e, value: t };
},
getSystemTime: function () {
var e = new Date();
return new c(e.getHours(), e.getMinutes());
},
parseTime: function (e, t) {
var i = this,
s = "undefined" == typeof t ? i.config.format : t,
n = (s.match(/h/g) || []).length,
r = n > 1,
a = ((s.match(/m/g) || []).length, (s.match(/t/g) || []).length),
o = e.length,
d = s.indexOf("h"),
u = s.lastIndexOf("h"),
m = "",
l = "",
p = "";
if (i.config.hourPadding || r) m = e.substr(d, 2);
else {
var h = s.substring(d - 1, d),
f = s.substring(u + 1, u + 2);
m =
u === s.length - 1
? e.substring(e.indexOf(h, d - 1) + 1, o)
: 0 === d
? e.substring(0, e.indexOf(f, d))
: e.substring(e.indexOf(h, d - 1) + 1, e.indexOf(f, d + 1));
}
s = s.replace(/(hh|h)/g, m);
var v = s.indexOf("m"),
k = s.lastIndexOf("m"),
g = s.indexOf("t"),
w = s.substring(v - 1, v);
s.substring(k + 1, k + 2);
(l =
k === s.length - 1
? e.substring(e.indexOf(w, v - 1) + 1, o)
: 0 === v
? e.substring(0, 2)
: e.substr(v, 2)),
(p = r
? parseInt(m) > 11
? a > 1
? "PM"
: "pm"
: a > 1
? "AM"
: "am"
: e.substr(g, 2));
var H = "pm" === p.toLowerCase(),
_ = new c(parseInt(m), parseInt(l));
return (
((H && parseInt(m) < 12) || (!H && 12 === parseInt(m))) && _.invert(), _
);
},
switchView: function (e) {
var t = this,
i = this.timepicker,
s = 350;
("hours" !== e && "minutes" !== e) ||
((t.activeView = e),
i.timeHolder.hour["hours" === e ? "addClass" : "removeClass"]("active"),
i.timeHolder.minute["hours" === e ? "removeClass" : "addClass"](
"active"
),
i.clockHolder.clock.hours.addClass("animate"),
"hours" === e && i.clockHolder.clock.hours.removeClass("hidden"),
clearTimeout(t.hTimeout),
(t.hTimeout = setTimeout(
function () {
"hours" !== e && i.clockHolder.clock.hours.addClass("hidden"),
i.clockHolder.clock.hours.removeClass("animate");
},
"hours" === e ? 20 : s
)),
i.clockHolder.clock.minutes.addClass("animate"),
"minutes" === e && i.clockHolder.clock.minutes.removeClass("hidden"),
clearTimeout(t.mTimeout),
(t.mTimeout = setTimeout(
function () {
"minutes" !== e && i.clockHolder.clock.minutes.addClass("hidden"),
i.clockHolder.clock.minutes.removeClass("animate");
},
"minutes" === e ? 20 : s
)));
},
show: function () {
var t = this;
if ("" === t.input.val()) {
var i = t.getSystemTime();
this.time = new c(i.hour, i.minute);
}
t.resetSelected(),
e("body").attr("mdtimepicker-display", "on"),
t.timepicker.wrapper.addClass("animate"),
t.timepicker.overlay.removeClass("hidden").addClass("animate"),
setTimeout(function () {
t.timepicker.overlay.removeClass("animate"),
t.timepicker.wrapper.removeClass("animate"),
(t.visible = !0),
t.input.blur();
}, 10);
},
hide: function () {
var t = this;
t.timepicker.overlay.addClass("animate"),
t.timepicker.wrapper.addClass("animate"),
setTimeout(function () {
t.switchView("hours"),
t.timepicker.overlay.addClass("hidden").removeClass("animate"),
t.timepicker.wrapper.removeClass("animate"),
e("body").removeAttr("mdtimepicker-display"),
(t.visible = !1),
t.input.focus();
}, 300);
},
destroy: function () {
var e = this;
e.input
.removeData(t)
.unbind("keydown")
.unbind("click")
.removeProp("readonly"),
e.timepicker.overlay.remove();
},
}),
(e.fn.mdtimepicker = function (i) {
return e(this).each(function () {
var s = this,
n = e(this),
r = e(this).data(t);
(options = e.extend(
{},
e.fn.mdtimepicker.defaults,
n.data(),
"object" == typeof i && i
)),
r || n.data(t, (r = new d(s, options))),
"string" == typeof i && r[i](),
e(document).on("keydown", function (e) {
27 === e.keyCode && r.visible && r.hide();
});
});
}),
(e.fn.mdtimepicker.defaults = {
timeFormat: "hh:mm:ss.000",
format: "h:mm tt",
theme: "blue",
readOnly: !0,
hourPadding: !1,
});
})(jQuery);
+4
View File
File diff suppressed because one or more lines are too long
Vendored Executable
+34
View File
@@ -0,0 +1,34 @@
var $iframe = $('iframe'),
$videoLink = $('.play-btn'),
playerTemplate = '<div class="player"><div class="player__video"><div class="video-filler"></div><button class="video-close">&times;</button><iframe class="video-iframe" src="{{iframevideo}}" frameborder="0" allowfullscreen></iframe></div><div/>';
$videoLink.on('click', function (e) {
var localTemplate = '',
videoWidth = parseInt($(this).data('width')),
videoHeight = parseInt($(this).data('height')),
videoAspect = (videoHeight / videoWidth) * 100,
// elements
$player = null,
$video = null,
$close = null,
$iframe = null;
e.preventDefault();
localTemplate = playerTemplate.replace('{{iframevideo}}', $(this).prop('href'));
$player = $(localTemplate);
$player
.find('.video-filler')
.css('padding-top', videoAspect + '%');
$close = $player
.find('.video-close')
.on('click', function () {
$(this).off().closest('.player').hide().remove();
});
$player.appendTo('body').addClass('js--show-video');
});
Vendored Executable
+6071
View File
File diff suppressed because it is too large Load Diff
+2
View File
File diff suppressed because one or more lines are too long
Vendored Executable
+6
View File
File diff suppressed because one or more lines are too long