u
This commit is contained in:
1 parent
a57070f860
commit
b9f728812d
22 files changed
+2892
-391
No files matched your search
@@ -1,34 +1,716 @@
|
||||
<!-- <Drawer
|
||||
isOpen={dateSelected}
|
||||
anchor="bottom"
|
||||
onClose={() => {
|
||||
setDateSelected(false)
|
||||
}}
|
||||
size="md"
|
||||
>
|
||||
<DrawerBackdrop />
|
||||
<DrawerContent style={{ padding: 12 }}>
|
||||
<DrawerBody style={{ padding: 0, marginTop: 0, marginBottom: 0 }}>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
<Text>This is the basic drawer component.</Text>
|
||||
</DrawerBody>
|
||||
</DrawerContent>
|
||||
</Drawer> -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>船司跟踪查询系统</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background: linear-gradient(135deg, #1a2980, #26d0ce);
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
header {
|
||||
background: #1a2980;
|
||||
color: white;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 16px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.simulation-controls {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
margin-bottom: 20px;
|
||||
background: #f8f9fa;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.simulation-controls label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-weight: 600;
|
||||
color: #1a2980;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
color: #1a2980;
|
||||
}
|
||||
|
||||
input, select {
|
||||
width: 100%;
|
||||
padding: 12px 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
font-size: 16px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
input:focus, select:focus {
|
||||
outline: none;
|
||||
border-color: #1a2980;
|
||||
box-shadow: 0 0 0 3px rgba(26, 41, 128, 0.1);
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: #1a2980;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 25px;
|
||||
border-radius: 6px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background: #152066;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
background: #cccccc;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background: #4CAF50;
|
||||
}
|
||||
|
||||
.btn-failure {
|
||||
background: #f44336;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 40px 20px;
|
||||
margin-bottom: 30px;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
border: 2px dashed #ddd;
|
||||
}
|
||||
|
||||
.placeholder-icon {
|
||||
font-size: 48px;
|
||||
margin-bottom: 15px;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.placeholder-text {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.status-indicator {
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 30px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.status-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 15px;
|
||||
color: #1a2980;
|
||||
}
|
||||
|
||||
/* 垂直布局样式 */
|
||||
.steps-vertical {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.steps-vertical::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 15px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
background: #e0e0e0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.step-vertical {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.step-circle-vertical {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
background: #e0e0e0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
margin-right: 15px;
|
||||
flex-shrink: 0;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.step-vertical.active .step-circle-vertical {
|
||||
background: #1a2980;
|
||||
animation: pulse 1.5s infinite;
|
||||
}
|
||||
|
||||
.step-vertical.completed .step-circle-vertical {
|
||||
background: #4CAF50;
|
||||
}
|
||||
|
||||
.step-vertical.failed .step-circle-vertical {
|
||||
background: #f44336;
|
||||
}
|
||||
|
||||
.step-text-vertical {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.status-message {
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
margin-top: 10px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.status-message.info {
|
||||
background: #e3f2fd;
|
||||
color: #0d47a1;
|
||||
}
|
||||
|
||||
.status-message.success {
|
||||
background: #e8f5e9;
|
||||
color: #2e7d32;
|
||||
}
|
||||
|
||||
.status-message.warning {
|
||||
background: #fff3e0;
|
||||
color: #ef6c00;
|
||||
}
|
||||
|
||||
.result {
|
||||
display: none;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.result-title {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 15px;
|
||||
color: #1a2980;
|
||||
border-bottom: 2px solid #1a2980;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.tracking-info {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
background: white;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 3px solid rgba(255,255,255,.3);
|
||||
border-radius: 50%;
|
||||
border-top-color: #fff;
|
||||
animation: spin 1s ease-in-out infinite;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.success-animation {
|
||||
animation: successPulse 2s ease-in-out;
|
||||
}
|
||||
|
||||
.warning-animation {
|
||||
animation: warningPulse 2s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% { transform: scale(1); }
|
||||
50% { transform: scale(1.1); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
|
||||
@keyframes successPulse {
|
||||
0% { transform: scale(1); }
|
||||
50% { transform: scale(1.05); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
|
||||
@keyframes warningPulse {
|
||||
0% { transform: scale(1); }
|
||||
50% { transform: scale(1.02); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
|
||||
.test-buttons {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.step-vertical {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.step-circle-vertical {
|
||||
margin-bottom: 8px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.steps-vertical::before {
|
||||
left: 15px;
|
||||
}
|
||||
|
||||
.test-buttons {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.simulation-controls {
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>船司跟踪查询系统</h1>
|
||||
<div class="subtitle">实时追踪您的船舶位置与状态</div>
|
||||
</header>
|
||||
|
||||
<div class="content">
|
||||
<div class="simulation-controls">
|
||||
<label>
|
||||
<input type="radio" name="simulationMode" value="random" checked> 随机模式 (80%成功, 20%暂时无法获取)
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="simulationMode" value="success"> 模拟可获取数据
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="simulationMode" value="failure"> 模拟暂时无法获取数据
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<form class="search-form" id="trackingForm">
|
||||
<div class="form-group">
|
||||
<label for="company">船运公司</label>
|
||||
<select id="company" required>
|
||||
<option value="">请选择船运公司</option>
|
||||
<option value="maersk">马士基航运 (Maersk)</option>
|
||||
<option value="msc">地中海航运 (MSC)</option>
|
||||
<option value="cosco">中远海运 (COSCO)</option>
|
||||
<option value="cma-cgm">达飞轮船 (CMA CGM)</option>
|
||||
<option value="evergreen">长荣海运 (Evergreen)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="trackingNumber">提单号/集装箱号</label>
|
||||
<input type="text" id="trackingNumber" placeholder="请输入提单号或集装箱号" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="display: flex; align-items: flex-end;">
|
||||
<button type="submit" class="btn" id="searchBtn">
|
||||
<span id="btnText">查询</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="test-buttons">
|
||||
<button class="btn btn-success" id="testSuccessBtn">测试可获取数据案例</button>
|
||||
<button class="btn btn-failure" id="testFailureBtn">测试暂时无法获取数据案例</button>
|
||||
</div>
|
||||
|
||||
<!-- 初始占位符 -->
|
||||
<div class="placeholder" id="placeholder">
|
||||
<div class="placeholder-icon">🚢</div>
|
||||
<div class="placeholder-text">请输入查询条件并点击"查询"按钮开始跟踪</div>
|
||||
</div>
|
||||
|
||||
<!-- 状态指示器(初始隐藏) -->
|
||||
<div class="status-indicator" id="statusIndicator">
|
||||
<div class="status-title">查询状态</div>
|
||||
|
||||
<div class="steps-vertical" id="stepsVertical">
|
||||
<div class="step-vertical" id="step1">
|
||||
<div class="step-circle-vertical">1</div>
|
||||
<div class="step-text-vertical">发出请求</div>
|
||||
</div>
|
||||
<div class="step-vertical" id="step2">
|
||||
<div class="step-circle-vertical">2</div>
|
||||
<div class="step-text-vertical">等待响应</div>
|
||||
</div>
|
||||
<div class="step-vertical" id="step3">
|
||||
<div class="step-circle-vertical">3</div>
|
||||
<div class="step-text-vertical">处理数据</div>
|
||||
</div>
|
||||
<div class="step-vertical" id="step4">
|
||||
<div class="step-circle-vertical">4</div>
|
||||
<div class="step-text-vertical">查询完成</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="status-message info" id="statusMessage"></div>
|
||||
</div>
|
||||
|
||||
<!-- 查询结果(初始隐藏) -->
|
||||
<div class="result" id="result">
|
||||
<div class="result-title">查询结果</div>
|
||||
<div class="tracking-info">
|
||||
<div class="info-item">
|
||||
<div class="info-label">船运公司</div>
|
||||
<div class="info-value" id="result-company">-</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-label">提单号</div>
|
||||
<div class="info-value" id="result-bill">-</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-label">集装箱号</div>
|
||||
<div class="info-value" id="result-container">-</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-label">当前位置</div>
|
||||
<div class="info-value" id="result-location">-</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-label">状态</div>
|
||||
<div class="info-value" id="result-status">-</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="info-label">预计到达</div>
|
||||
<div class="info-value" id="result-eta">-</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('DOM已加载,正在初始化船司跟踪查询系统...');
|
||||
|
||||
const trackingForm = document.getElementById('trackingForm');
|
||||
const searchBtn = document.getElementById('searchBtn');
|
||||
const testSuccessBtn = document.getElementById('testSuccessBtn');
|
||||
const testFailureBtn = document.getElementById('testFailureBtn');
|
||||
const placeholder = document.getElementById('placeholder');
|
||||
const statusIndicator = document.getElementById('statusIndicator');
|
||||
const result = document.getElementById('result');
|
||||
|
||||
if (!trackingForm) {
|
||||
console.error('错误:未找到ID为"trackingForm"的表单元素');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!searchBtn) {
|
||||
console.error('错误:未找到ID为"searchBtn"的按钮元素');
|
||||
return;
|
||||
}
|
||||
|
||||
// 绑定表单提交事件
|
||||
trackingForm.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
console.log('表单提交事件触发');
|
||||
|
||||
const company = document.getElementById('company').value;
|
||||
const trackingNumber = document.getElementById('trackingNumber').value;
|
||||
const simulationMode = document.querySelector('input[name="simulationMode"]:checked').value;
|
||||
|
||||
console.log('公司:', company, '跟踪号:', trackingNumber, '模拟模式:', simulationMode);
|
||||
|
||||
if (!company || !trackingNumber) {
|
||||
alert('请填写完整的查询信息');
|
||||
return;
|
||||
}
|
||||
|
||||
startTracking(company, trackingNumber, simulationMode);
|
||||
});
|
||||
|
||||
// 测试成功按钮
|
||||
testSuccessBtn.addEventListener('click', function() {
|
||||
document.getElementById('company').value = 'maersk';
|
||||
document.getElementById('trackingNumber').value = 'MAE123456789';
|
||||
document.querySelector('input[name="simulationMode"][value="success"]').checked = true;
|
||||
startTracking('maersk', 'MAE123456789', 'success');
|
||||
});
|
||||
|
||||
// 测试失败按钮
|
||||
testFailureBtn.addEventListener('click', function() {
|
||||
document.getElementById('company').value = 'msc';
|
||||
document.getElementById('trackingNumber').value = 'MSC987654321';
|
||||
document.querySelector('input[name="simulationMode"][value="failure"]').checked = true;
|
||||
startTracking('msc', 'MSC987654321', 'failure');
|
||||
});
|
||||
|
||||
console.log('船司跟踪查询系统初始化完成');
|
||||
});
|
||||
|
||||
function startTracking(company, trackingNumber, simulationMode) {
|
||||
console.log('开始跟踪流程,模式:', simulationMode);
|
||||
|
||||
// 隐藏占位符,显示状态指示器
|
||||
document.getElementById('placeholder').style.display = 'none';
|
||||
document.getElementById('statusIndicator').style.display = 'block';
|
||||
document.getElementById('result').style.display = 'none';
|
||||
|
||||
resetStatus();
|
||||
|
||||
const searchBtn = document.getElementById('searchBtn');
|
||||
searchBtn.disabled = true;
|
||||
document.getElementById('btnText').innerHTML = '<span class="spinner"></span>查询中...';
|
||||
|
||||
updateStep(1, 'active', '正在向船运公司发送查询请求...');
|
||||
console.log('步骤1: 发出请求');
|
||||
|
||||
setTimeout(() => {
|
||||
updateStep(1, 'completed');
|
||||
updateStep(2, 'active', '已发送请求,等待船运公司响应...');
|
||||
console.log('步骤2: 等待响应');
|
||||
|
||||
setTimeout(() => {
|
||||
updateStep(2, 'completed');
|
||||
updateStep(3, 'active', '收到响应,正在处理数据...');
|
||||
console.log('步骤3: 处理数据');
|
||||
|
||||
setTimeout(() => {
|
||||
updateStep(3, 'completed');
|
||||
updateStep(4, 'active', '数据解析完成,生成查询结果...');
|
||||
console.log('步骤4: 查询完成');
|
||||
|
||||
setTimeout(() => {
|
||||
let isSuccess;
|
||||
|
||||
// 根据选择的模拟模式决定结果
|
||||
if (simulationMode === 'success') {
|
||||
isSuccess = true;
|
||||
} else if (simulationMode === 'failure') {
|
||||
isSuccess = false;
|
||||
} else {
|
||||
// 随机模式:80%成功,20%失败
|
||||
isSuccess = Math.random() > 0.2;
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
updateStep(4, 'completed', '查询成功!已找到相关船舶信息。');
|
||||
console.log('查询成功');
|
||||
document.getElementById('statusIndicator').classList.add('success-animation');
|
||||
showResult(company, trackingNumber);
|
||||
} else {
|
||||
// 使用更友好的提示信息
|
||||
updateStep(4, 'failed', '目前无法获取该船舶的实时信息,请稍后再试。');
|
||||
console.log('查询暂时无法获取数据');
|
||||
document.getElementById('statusIndicator').classList.add('warning-animation');
|
||||
|
||||
// 暂时无法获取数据时显示占位符
|
||||
setTimeout(() => {
|
||||
document.getElementById('placeholder').style.display = 'block';
|
||||
document.getElementById('placeholder').innerHTML = `
|
||||
<div class="placeholder-icon">⏳</div>
|
||||
<div class="placeholder-text">当前无法获取该船舶的实时信息,请稍后再试</div>
|
||||
`;
|
||||
document.getElementById('statusIndicator').style.display = 'none';
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
searchBtn.disabled = false;
|
||||
document.getElementById('btnText').textContent = '查询';
|
||||
}, 1500);
|
||||
}, 2000);
|
||||
}, 1500);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function updateStep(stepNumber, status, message) {
|
||||
console.log(`更新步骤 ${stepNumber} 状态为: ${status}`);
|
||||
|
||||
const stepElement = document.getElementById('step' + stepNumber);
|
||||
const messageElement = document.getElementById('statusMessage');
|
||||
|
||||
if (!stepElement) {
|
||||
console.error(`错误:未找到ID为"step${stepNumber}"的步骤元素`);
|
||||
return;
|
||||
}
|
||||
|
||||
stepElement.classList.remove('active', 'completed', 'failed');
|
||||
|
||||
if (status) {
|
||||
stepElement.classList.add(status);
|
||||
}
|
||||
|
||||
if (message && messageElement) {
|
||||
messageElement.textContent = message;
|
||||
messageElement.className = 'status-message';
|
||||
|
||||
if (status === 'active') {
|
||||
messageElement.classList.add('info');
|
||||
} else if (status === 'completed') {
|
||||
messageElement.classList.add('success');
|
||||
} else if (status === 'failed') {
|
||||
messageElement.classList.add('warning');
|
||||
}
|
||||
|
||||
messageElement.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
function resetStatus() {
|
||||
console.log('重置状态指示器');
|
||||
|
||||
for (let i = 1; i <= 4; i++) {
|
||||
const stepElement = document.getElementById('step' + i);
|
||||
if (stepElement) {
|
||||
stepElement.classList.remove('active', 'completed', 'failed');
|
||||
}
|
||||
}
|
||||
|
||||
const messageElement = document.getElementById('statusMessage');
|
||||
if (messageElement) {
|
||||
messageElement.style.display = 'none';
|
||||
}
|
||||
|
||||
document.getElementById('statusIndicator').classList.remove('success-animation', 'warning-animation');
|
||||
}
|
||||
|
||||
function showResult(company, trackingNumber) {
|
||||
console.log('显示查询结果');
|
||||
|
||||
const companies = {
|
||||
'maersk': '马士基航运',
|
||||
'msc': '地中海航运',
|
||||
'cosco': '中远海运',
|
||||
'cma-cgm': '达飞轮船',
|
||||
'evergreen': '长荣海运'
|
||||
};
|
||||
|
||||
const locations = [
|
||||
'上海港', '新加坡港', '鹿特丹港', '汉堡港', '洛杉矶港',
|
||||
'釜山港', '深圳港', '迪拜港', '纽约港', '安特卫普港'
|
||||
];
|
||||
|
||||
const statuses = [
|
||||
'在港装货', '海上航行', '在港卸货', '等待泊位', '海关检查'
|
||||
];
|
||||
|
||||
const randomLocation = locations[Math.floor(Math.random() * locations.length)];
|
||||
const randomStatus = statuses[Math.floor(Math.random() * statuses.length)];
|
||||
|
||||
const etaDate = new Date();
|
||||
etaDate.setDate(etaDate.getDate() + Math.floor(Math.random() * 13) + 3);
|
||||
const etaString = etaDate.toLocaleDateString('zh-CN');
|
||||
|
||||
document.getElementById('result-company').textContent = companies[company] || company;
|
||||
document.getElementById('result-bill').textContent = trackingNumber;
|
||||
document.getElementById('result-container').textContent = 'CCLU' + Math.floor(Math.random() * 1000000);
|
||||
document.getElementById('result-location').textContent = randomLocation;
|
||||
document.getElementById('result-status').textContent = randomStatus;
|
||||
document.getElementById('result-eta').textContent = etaString;
|
||||
|
||||
document.getElementById('result').style.display = 'block';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -33,7 +33,8 @@
|
||||
pageSize:30,
|
||||
onClickRow:onClickRow,
|
||||
showPageInfo:false,
|
||||
showRefresh:false
|
||||
showRefresh:false,
|
||||
data: createMockData(100)
|
||||
">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -57,20 +58,23 @@ let editIndex = undefined;
|
||||
|
||||
// 初始化 Datagrid 数据
|
||||
$('#dg').datagrid({
|
||||
data: createMockData(100),
|
||||
onLoadSuccess: function(){
|
||||
let pager = $('#dg').datagrid('getPager');
|
||||
pager.pagination({
|
||||
showRefresh: true, // 隐藏刷新按钮
|
||||
showPageInfo: true, // 隐藏页信息
|
||||
onRefresh: function(pageNumber, pageSize){
|
||||
let newData = createMockData(300);
|
||||
$('#dg').datagrid('loadData', newData);
|
||||
|
||||
$('#dg').datagrid('clearSelections');
|
||||
$('#dg').datagrid('clearChecked');
|
||||
}
|
||||
});
|
||||
data: createMockData(100)
|
||||
});
|
||||
// 2. 获取分页控件并绑定事件
|
||||
var pager = $('#dg').datagrid('getPager');
|
||||
pager.pagination({
|
||||
showRefresh: false,
|
||||
showPageList: false,
|
||||
onBeforeRefresh: function(){
|
||||
console.log('onBeforeRefresh triggered');
|
||||
},
|
||||
onRefresh: function(pageNumber, pageSize){
|
||||
console.log('onRefresh triggered', pageNumber, pageSize);
|
||||
// 刷新数据
|
||||
var newData = createMockData(300);
|
||||
$('#dg').datagrid('loadData', newData);
|
||||
$('#dg').datagrid('clearSelections');
|
||||
$('#dg').datagrid('clearChecked');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Reference in new issue
Block a user