Initial commit
This commit is contained in:
+676269
File diff suppressed because it is too large
Load Diff
+274
@@ -0,0 +1,274 @@
|
||||
// 同步加载 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
|
||||
};
|
||||
var city_data;
|
||||
function addlist() {
|
||||
$('.citylist').liMarquee('destroy');
|
||||
let html = ""
|
||||
for (i = 0; i < city_data.length; i++) {
|
||||
html += `<li class="item" data-item='${JSON.stringify(city_data[i])}'>
|
||||
<p>${city_data[i].brand}</p>
|
||||
<p><span>${city_data[i].vin}</span></p>
|
||||
<p><span>${city_data[i].model}</span> <span class="status">${city_data[i].status}</span></p>
|
||||
</li>`
|
||||
}
|
||||
$(".citylist #nav").html(html)
|
||||
$(".citylist").fadeIn()
|
||||
listsc()
|
||||
}
|
||||
function addlist1(data) {
|
||||
$('.citylist').liMarquee('destroy');
|
||||
let html = ""
|
||||
for (i = 0; i < data.length; i++) {
|
||||
html += `<li class="item" data-item='${JSON.stringify(data[i])}'>
|
||||
<p>${data[i].brand}</p>
|
||||
<p><span>${data[i].vin}</span></p>
|
||||
<p><span>${data[i].model}</span> <span class="status">${data[i].status}</span></p>
|
||||
</li>`
|
||||
}
|
||||
$(".citylist #nav").append(html)
|
||||
listsc1()
|
||||
}
|
||||
$(".citylist").on('click', '.item', function() {
|
||||
var data = $(this).attr('data-item')
|
||||
data = JSON.parse(data)
|
||||
$('.item').removeClass('liactive')
|
||||
|
||||
$(this).addClass('liactive')
|
||||
$(".cartitle").html(data.brand)
|
||||
var langs = localStorage.getItem('lang') || 'en';
|
||||
if(data.img_url&&data.img_url!=''){
|
||||
$(".inner").html('<img src="'+data.img_url+'" alt="" />')
|
||||
}else{
|
||||
if(langs=='en'){$(".inner").html('<img src="../img/none2.jpg" alt="" />')}
|
||||
if(langs=='ru'){$(".inner").html('<img src="../img/none3.jpg" alt="" />')}
|
||||
if(langs=='ar'){$(".inner").html('<img src="../img/none4.jpg" alt="" />')}
|
||||
if(langs=='zh'){$(".inner").html('<img src="../img/none1.jpg" alt="" />')}
|
||||
}
|
||||
$(".vin").html(data.vin)
|
||||
$(".classify").html(data.location.name)
|
||||
$(".model").html(data.model)
|
||||
$(".destination").html(data.final_location!=null?data.final_location.name:'')
|
||||
$(".fbo_destination").html(data.fbo_destination)
|
||||
$(".departure_time").html(data.departure_time)
|
||||
$(".status").html(data.status)
|
||||
$(".arrival_time").html(data.arrival_time)
|
||||
});
|
||||
//初始化滚动
|
||||
function listsc() {
|
||||
$('.citylist').liMarquee({
|
||||
direction: 'up',
|
||||
runshort: false,
|
||||
scrollamount: 20 ,//滚动速度
|
||||
});
|
||||
var $lis = $('.citylist li')
|
||||
var index =5; // 当前li的索引
|
||||
var $currentLi = $lis.eq(index); // 获取当前索引的li元素
|
||||
$currentLi.trigger('click'); // 模拟点击事件
|
||||
// setInterval(function() {
|
||||
// var $currentLi = $lis.eq(index); // 获取当前索引的li元素
|
||||
// $currentLi.trigger('click'); // 模拟点击事件
|
||||
// index++; // 增加索引
|
||||
// if (index >= $lis.length) { // 如果索引超出li的数量,重置为0
|
||||
// index = 0;
|
||||
// }
|
||||
// }, 2000); // 每2秒执行一次
|
||||
// $('.citylist li').off('click').on('click', function(){
|
||||
// $(this).addClass('liactive').siblings().removeClass('liactive');
|
||||
// });
|
||||
var timer = setInterval(function() {
|
||||
if(currentPage*50>count){
|
||||
|
||||
}else{
|
||||
currentPage++
|
||||
Vehiclefn1(currentPage,localStorage.getItem("lang"))
|
||||
}
|
||||
}, 1000); // 每2秒执行一次
|
||||
}
|
||||
function listsc1() {
|
||||
$('.citylist').liMarquee({
|
||||
direction: 'up',
|
||||
runshort: false,
|
||||
scrollamount: 20 ,//滚动速度
|
||||
});
|
||||
var timer = setInterval(function() {
|
||||
if(currentPage*50>count){
|
||||
|
||||
}else{
|
||||
currentPage++
|
||||
Vehiclefn1(currentPage,localStorage.getItem("lang"))
|
||||
}
|
||||
}, 1000); // 每2秒执行一次
|
||||
}
|
||||
var count;
|
||||
var currentPage=1;
|
||||
function Vehiclefn1(currentPage,lang){
|
||||
$.ajax({
|
||||
url:'https://dashboard-server.hesuu.com/Vehicle',
|
||||
type:'POST',
|
||||
data:{
|
||||
lang: lang,
|
||||
page: currentPage,
|
||||
pageSize: 50
|
||||
},
|
||||
success: function(result){
|
||||
if(result.code==0){
|
||||
var data= result.data.list
|
||||
addlist1(data)
|
||||
}else{
|
||||
alert(result.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function Vehiclefn(lang){
|
||||
$.ajax({
|
||||
url:'https://dashboard-server.hesuu.com/Vehicle',
|
||||
type:'POST',
|
||||
data:{
|
||||
lang: lang,
|
||||
page: currentPage,
|
||||
pageSize: 50
|
||||
},
|
||||
success: function(result){
|
||||
if(result.code==0){
|
||||
city_data= result.data.list
|
||||
count=result.data.count;
|
||||
var i=result.data.count;
|
||||
let arr = Array.from(String(i), Number);
|
||||
var v=''
|
||||
for(var n = 0; n < arr.length; n++) {
|
||||
v+='<span>'+arr[n]+'</span>'
|
||||
}
|
||||
$(".all").html(v)
|
||||
addlist()
|
||||
}else{
|
||||
alert(result.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
var myChart = echarts.init(document.getElementById('world'));
|
||||
var lineDatas;
|
||||
function locationfn(lang){
|
||||
$.ajax({
|
||||
url:'https://dashboard-server.hesuu.com/location',
|
||||
type:'POST',
|
||||
data:{lang:lang},
|
||||
success: function(result){
|
||||
lineDatas = result.data
|
||||
Global(chinaGeoCoordMap,nameMap,localStorage.getItem("lang"))
|
||||
if(result.code==0){
|
||||
}else{
|
||||
alert(result.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const i18n = {
|
||||
currentLang: 'en', // 默认语言
|
||||
init: function() {
|
||||
var that = this
|
||||
this.currentLang = localStorage.getItem('lang') || navigator.language.substr(0, 2) || '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');
|
||||
}
|
||||
Vehiclefn(this.currentLang)
|
||||
locationfn(this.currentLang)
|
||||
// var selectedText1 = localStorage.getItem('langtext')?localStorage.getItem('langtext'):'中文';
|
||||
// $(".select-selected").text(selectedText1);
|
||||
// 点击选项时更新选择
|
||||
$(".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'))
|
||||
currentPage =1
|
||||
Vehiclefn($(this).attr('data-id'))
|
||||
locationfn($(this).attr('data-id'))
|
||||
|
||||
});
|
||||
// $('#langSwitch').click(() =>{
|
||||
// if(this.currentLang === 'en'){
|
||||
// $(".toggle2-button").removeClass('activebtn')
|
||||
// }else{
|
||||
// $(".toggle2-button").addClass('activebtn')
|
||||
// }
|
||||
|
||||
// });
|
||||
},
|
||||
loadLanguage: function(lang) {
|
||||
var data = loadJSONSync(`./js/lang/${lang}.json`);
|
||||
console.log(data)
|
||||
$('[data-i18n]').each(function() {
|
||||
const key = $(this).data('i18n');
|
||||
$(this).text(data[key]); // 更新文本内容
|
||||
});
|
||||
localStorage.setItem('lang', lang);
|
||||
// $.getJSON(`lang/${lang}.json`, (data) => {
|
||||
// console.log(data)
|
||||
// $('[data-i18n]').each(function() {
|
||||
// const key = $(this).data('i18n');
|
||||
// $(this).text(data[key]); // 更新文本内容
|
||||
// });
|
||||
// localStorage.setItem('lang', lang);
|
||||
// });
|
||||
},
|
||||
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');
|
||||
}
|
||||
Global(chinaGeoCoordMap,nameMap,this.currentLang)
|
||||
}
|
||||
};
|
||||
$(document).ready(() => i18n.init());
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
// 同步加载 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
|
||||
};
|
||||
var city_data;
|
||||
function addlist() {
|
||||
$('.citylist').liMarquee('destroy');
|
||||
let html = ""
|
||||
for (i = 0; i < city_data.length; i++) {
|
||||
html += `<li class="item" data-item='${JSON.stringify(city_data[i])}'>
|
||||
<p>${city_data[i].brand}</p>
|
||||
<p><span>${city_data[i].vin}</span></p>
|
||||
<p><span>${city_data[i].model}</span> <span class="status">${city_data[i].status}</span></p>
|
||||
</li>`
|
||||
}
|
||||
$(".citylist #nav").html(html)
|
||||
$(".citylist").fadeIn()
|
||||
listsc()
|
||||
}
|
||||
$(".citylist").on('click', '.item', function() {
|
||||
var data = $(this).attr('data-item')
|
||||
data = JSON.parse(data)
|
||||
$('.item').removeClass('liactive')
|
||||
|
||||
$(this).addClass('liactive')
|
||||
console.log()
|
||||
|
||||
$(".cartitle").html(data.brand)
|
||||
$(".inner").html('<img src="'+data.img_url+'" alt="" />')
|
||||
$(".cartitle").html(data.brand)
|
||||
$(".inner").html('<img src="'+data.img_url+'" alt="" />')
|
||||
$(".vin").html(data.vin)
|
||||
$(".classify").html(data.location.name)
|
||||
$(".model").html(data.model)
|
||||
$(".destination").html(data.final_location!=null?data.final_location.name:'')
|
||||
$(".fbo_destination").html(data.fbo_destination)
|
||||
$(".departure_time").html(data.departure_time)
|
||||
$(".status").html(data.status)
|
||||
$(".arrival_time").html(data.arrival_time)
|
||||
});
|
||||
//初始化滚动
|
||||
function listsc() {
|
||||
$('.citylist').liMarquee({
|
||||
direction: 'up',
|
||||
runshort: false,
|
||||
scrollamount: 20 ,//滚动速度
|
||||
});
|
||||
var $lis = $('.citylist li')
|
||||
var index =5; // 当前li的索引
|
||||
var $currentLi = $lis.eq(index); // 获取当前索引的li元素
|
||||
$currentLi.trigger('click'); // 模拟点击事件
|
||||
// setInterval(function() {
|
||||
// var $currentLi = $lis.eq(index); // 获取当前索引的li元素
|
||||
// $currentLi.trigger('click'); // 模拟点击事件
|
||||
// index++; // 增加索引
|
||||
// if (index >= $lis.length) { // 如果索引超出li的数量,重置为0
|
||||
// index = 0;
|
||||
// }
|
||||
// }, 2000); // 每2秒执行一次
|
||||
// $('.citylist li').off('click').on('click', function(){
|
||||
// $(this).addClass('liactive').siblings().removeClass('liactive');
|
||||
// });
|
||||
}
|
||||
var count;
|
||||
function Vehiclefn(lang){
|
||||
$.ajax({
|
||||
url:'https://dashboard-server.hesuu.com/Vehicle',
|
||||
type:'POST',
|
||||
data:{lang:lang},
|
||||
success: function(result){
|
||||
if(result.code==0){
|
||||
city_data= result.data.list
|
||||
var i=result.data.count;
|
||||
let arr = Array.from(String(i), Number);
|
||||
var v=''
|
||||
for(var n = 0; n < arr.length; n++) {
|
||||
v+='<span>'+arr[n]+'</span>'
|
||||
}
|
||||
$(".all").html(v)
|
||||
addlist()
|
||||
}else{
|
||||
alert(result.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
var myChart = echarts.init(document.getElementById('world'));
|
||||
var lineDatas;
|
||||
function locationfn(lang){
|
||||
$.ajax({
|
||||
url:'https://dashboard-server.hesuu.com/location',
|
||||
type:'POST',
|
||||
data:{lang:lang},
|
||||
success: function(result){
|
||||
lineDatas = result.data
|
||||
Global(chinaGeoCoordMap,nameMap,localStorage.getItem("lang"))
|
||||
if(result.code==0){
|
||||
}else{
|
||||
alert(result.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const i18n = {
|
||||
currentLang: 'en', // 默认语言
|
||||
init: function() {
|
||||
var that = this
|
||||
this.currentLang = localStorage.getItem('lang') || navigator.language.substr(0, 2) || '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');
|
||||
}
|
||||
Vehiclefn(this.currentLang)
|
||||
locationfn(this.currentLang)
|
||||
// var selectedText1 = localStorage.getItem('langtext')?localStorage.getItem('langtext'):'中文';
|
||||
// $(".select-selected").text(selectedText1);
|
||||
// 点击选项时更新选择
|
||||
$(".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'))
|
||||
Vehiclefn($(this).attr('data-id'))
|
||||
locationfn($(this).attr('data-id'))
|
||||
|
||||
});
|
||||
// $('#langSwitch').click(() =>{
|
||||
// if(this.currentLang === 'en'){
|
||||
// $(".toggle2-button").removeClass('activebtn')
|
||||
// }else{
|
||||
// $(".toggle2-button").addClass('activebtn')
|
||||
// }
|
||||
|
||||
// });
|
||||
},
|
||||
loadLanguage: function(lang) {
|
||||
var data = loadJSONSync(`./js/lang/${lang}.json`);
|
||||
console.log(data)
|
||||
$('[data-i18n]').each(function() {
|
||||
const key = $(this).data('i18n');
|
||||
$(this).text(data[key]); // 更新文本内容
|
||||
});
|
||||
localStorage.setItem('lang', lang);
|
||||
// $.getJSON(`lang/${lang}.json`, (data) => {
|
||||
// console.log(data)
|
||||
// $('[data-i18n]').each(function() {
|
||||
// const key = $(this).data('i18n');
|
||||
// $(this).text(data[key]); // 更新文本内容
|
||||
// });
|
||||
// localStorage.setItem('lang', lang);
|
||||
// });
|
||||
},
|
||||
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');
|
||||
}
|
||||
Global(chinaGeoCoordMap,nameMap,this.currentLang)
|
||||
}
|
||||
};
|
||||
$(document).ready(() => i18n.init());
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"title": "منصة بيانات المركبات",
|
||||
"buttonText": "التغيير إلى الإنجليزية",
|
||||
"carall": "إجمالي المركبات",
|
||||
"newdata": "أحدث البيانات",
|
||||
"carinfo": "معلومات المركبة",
|
||||
"month": "شهر",
|
||||
"day": "يوم",
|
||||
"vin": "رقم الهيكل",
|
||||
"category": "مستودع",
|
||||
"vehicletype": "نوع السيارة",
|
||||
"destination1":"مقصد",
|
||||
"destination": "ميناء",
|
||||
"Departuretime": "وقت المغادرة",
|
||||
"Vehiclestatus": "حالة المركبة",
|
||||
"ArrivalDate": "تاريخ الوصول",
|
||||
"zh": "中文",
|
||||
"en": "English",
|
||||
"ru": "Русский",
|
||||
"ar": "العربية",
|
||||
"lang":"العربية"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"title": "Vehicle Data Platform",
|
||||
"buttonText": "Switch to Chinese" ,
|
||||
"carall":"Total number of vehicle sources",
|
||||
"newdata":"latest data",
|
||||
"carinfo":"Vehicle information",
|
||||
"month":"Month",
|
||||
"day":"Day",
|
||||
"vin":"Vin",
|
||||
"category":"Belonging warehouse",
|
||||
"vehicletype":"Vehicle Model",
|
||||
"destination1":"Destination",
|
||||
"destination":"Port",
|
||||
"Departuretime":"Departure time",
|
||||
"Vehiclestatus":"Vehicle status",
|
||||
"ArrivalDate":"Arrival Date",
|
||||
"zh": "中文",
|
||||
"en": "English",
|
||||
"ru": "Русский",
|
||||
"ar": "العربية",
|
||||
"lang":"English"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"title": "Платформа данных",
|
||||
"buttonText": "Переключить на английский",
|
||||
"carall": "Всего автомобилей",
|
||||
"newdata": "Последние данные",
|
||||
"carinfo": "Информация об автомобиле",
|
||||
"month": "месяц",
|
||||
"day": "день",
|
||||
"vin": "VIN-код",
|
||||
"category": "Собственный склад",
|
||||
"vehicletype": "Тип транспортного средства",
|
||||
"destination1": "Пункт назначения",
|
||||
"destination": "Порт",
|
||||
"Departuretime": "Время отправления",
|
||||
"Vehiclestatus": "Состояние транспортного средства",
|
||||
"ArrivalDate": "Дата прибытия",
|
||||
"zh": "中文",
|
||||
"en": "English",
|
||||
"ru": "Русский",
|
||||
"ar": "العربية",
|
||||
"lang":"Русский"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"title": "车辆数据平台",
|
||||
"buttonText": "切换到英文",
|
||||
"carall":"车源总数",
|
||||
"newdata":"最新数据",
|
||||
"carinfo":"车辆信息",
|
||||
"month":"月",
|
||||
"day":"日",
|
||||
"vin":"车架号",
|
||||
"category":"所属仓库",
|
||||
"vehicletype":"车辆型号",
|
||||
"destination1":"目的地",
|
||||
"destination":"港口",
|
||||
"Departuretime":"发车时间",
|
||||
"Vehiclestatus":"车辆状态",
|
||||
"ArrivalDate":"到达日期",
|
||||
"zh": "中文",
|
||||
"en": "English",
|
||||
"ru": "Русский",
|
||||
"ar": "العربية",
|
||||
"lang":"中文"
|
||||
}
|
||||
+32544
File diff suppressed because it is too large
Load Diff
+3402
File diff suppressed because it is too large
Load Diff
+20
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user