顶部 添加船卡片显示

This commit is contained in:
浅念
2025-06-16 17:26:52 +08:00
parent a9d18a9b14
commit 36f44e2716
11 changed files with 301 additions and 8 deletions
+70 -7
View File
@@ -3668,7 +3668,9 @@ function Global(chinaGeoCoordMap, nameMap, isshow) {
$(".infotimes").hide();
$(".pagination-container1").show();
$(".pagination-container").hide();
Vehiclelocation(params.data.id,langzh)
$(".pagination-containerkp").hide();
$(".pagination-containerkp1").hide();
Vehiclelocation(params.data.id,langzh,'pagination-container1')
return false
}else{
//获取船上车辆信息
@@ -3676,8 +3678,10 @@ function Global(chinaGeoCoordMap, nameMap, isshow) {
$('#globalLoading').show();
$(".infotimes").show();
$(".pagination-container").show();
$(".pagination-containerkp1").hide();
$(".pagination-containerkp").hide();
$(".pagination-container1").hide();
Vehicleshipfn(params.data.id,langzh)
Vehicleshipfn(params.data.id,langzh,'pagination-container')
}
// 设置标题
// modalTitle.textContent = params.name;
@@ -3712,7 +3716,7 @@ function vehicleshipData(id,lang,page){
})
}
//船上车辆
function Vehicleshipfn(id,lang){
function Vehicleshipfn(id,lang,name){
$.ajax({
url:baseURL+'/Vehicle/ship',
type:'POST',
@@ -3760,7 +3764,7 @@ function Vehicleshipfn(id,lang){
const totalPages = Math.ceil(totalItems / pageSize);
// 分页配置
const pagination = new Pagination({
container: document.querySelector('.pagination-container'),
container: document.querySelector(`.${name}`),
currentPage: 1,
totalPages: totalPages,
onPageChange: (page) => {
@@ -3819,7 +3823,7 @@ function loadTableData(id,lang,page){
}
})
}
function Vehiclelocation(id,lang){
function Vehiclelocation(id,lang,name){
$.ajax({
url:baseURL+'/Vehicle/location',
type:'POST',
@@ -3837,7 +3841,7 @@ function Vehiclelocation(id,lang){
const totalPages = Math.ceil(totalItems / pageSize);
// 分页配置
const pagination = new Pagination({
container: document.querySelector('.pagination-container1'),
container: document.querySelector(`.${name}`),
currentPage: 1,
totalPages: totalPages,
onPageChange: (page) => {
@@ -3919,6 +3923,39 @@ function getcardetile(id){
});
}
$(function(){
// 为所有 shiptopcard 添加点击事件
$(document).on('click', '.shiptopcard', function() {
// 获取当前点击卡片的 data-id
document.getElementById('modalOverlay').style.display = 'block';
const id = this.getAttribute('data-id');
var names= this.getAttribute('data-name');
// 移除其他卡片的激活状态
document.querySelectorAll('.shiptopcard').forEach(c => c.classList.remove('active'));
// 添加当前卡片的激活状态
this.classList.add('active');
if(names=="navigate"){
$('.modal-tabs').children().not(':first').hide();
$('#globalLoading').show();
$(".infotimes").hide();
$(".pagination-containerkp1").show();
$(".pagination-container1").hide();
$(".pagination-containerkp").hide();
$(".pagination-container").hide();
Vehiclelocation(id,localStorage.getItem('lang')|| 'en','pagination-containerkp1')
return false
}else{
//获取船上车辆信息
$('.modal-tabs').children().show();
$('#globalLoading').show();
$(".infotimes").show();
$(".pagination-containerkp").show();
$(".pagination-container").hide();
$(".pagination-containerkp1").hide();
$(".pagination-container1").hide();
Vehicleshipfn(id,localStorage.getItem('lang')|| 'en','pagination-containerkp')
}
});
// 弹出层控制
const modalOverlay = document.getElementById('modalOverlay');
const modalClose = document.querySelector('.modal-close');
@@ -3996,6 +4033,32 @@ $(function(){
// console.log('Switch is OFF');
// }
// });
document.querySelectorAll('.centers-tab').forEach(tab => {
tab.addEventListener('click', () => {
// 移除所有标签的激活状态
document.querySelectorAll('.centers-tab').forEach(t => t.classList.remove('active'));
// 移除所有内容的激活状态
document.querySelectorAll('.centers-content').forEach(c => c.classList.remove('active'));
// 添加当前标签的激活状态
tab.classList.add('active');
// 添加对应内容的激活状态
const index = Array.from(tab.parentElement.children).indexOf(tab);
document.querySelectorAll('.centers-content')[index].classList.add('active');
});
});
document.querySelectorAll('.mores').forEach(button => {
button.addEventListener('click', () => {
const wrapper = button.previousElementSibling;
const isExpanded = wrapper.classList.contains('expanded');
if (isExpanded) {
wrapper.classList.remove('expanded');
button.classList.remove('expanded');
} else {
wrapper.classList.add('expanded');
button.classList.add('expanded');
}
});
});
})