手机端

This commit is contained in:
2026-03-30 19:54:25 +08:00
Unverified
parent adfcd61e22
commit 05aa40c3b1
3 changed files with 214 additions and 66 deletions
+60 -5
View File
@@ -41,8 +41,28 @@
box-shadow: 0 10px 30px rgba(0,0,0,0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.1);
margin-bottom: 40px; margin-bottom: 40px;
display: flex; justify-content: center; display: flex; justify-content: center;
cursor: pointer;
position: relative;
min-height: 400px;
align-items: center;
} }
#cert-img { width: 100%; height: auto; display: none; } #cert-img { width: 100%; height: auto; display: none; }
/* 点击加载提示 */
.click-hint {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: #64748b;
font-size: 16px;
}
.click-hint-icon {
font-size: 48px;
margin-bottom: 10px;
color: var(--primary);
}
/* 详细信息表卡片 */ /* 详细信息表卡片 */
.info-card { .info-card {
@@ -109,8 +129,12 @@
</div> </div>
<div class="main-content"> <div class="main-content">
<div id="cert-viewport"> <div id="cert-viewport" onclick="loadCertificateImage()">
<img id="cert-img" alt="荣誉证书原件"> <img id="cert-img" alt="荣誉证书原件">
<div class="click-hint" id="click-hint">
<div class="click-hint-icon">🖼️</div>
<div>点击查看证书图片</div>
</div>
</div> </div>
<div class="info-card" id="info-card" style="display: none;"> <div class="info-card" id="info-card" style="display: none;">
@@ -172,10 +196,8 @@
document.getElementById('display-status').innerHTML = '<span class="status-tag">无效</span>'; document.getElementById('display-status').innerHTML = '<span class="status-tag">无效</span>';
} }
// 加载图片 // 图片改为点击加载,初始不加载
const img = document.getElementById('cert-img'); window.currentCertNumber = data.cert_number;
img.src = `img/${data.cert_number}.svg`;
img.onload = () => img.style.display = 'block';
} catch (e) { } catch (e) {
console.error("加载失败:", e); console.error("加载失败:", e);
@@ -183,7 +205,40 @@
} }
} }
// 点击加载证书图片
function loadCertificateImage() {
const certNumber = window.currentCertNumber;
if (!certNumber) return;
const img = document.getElementById('cert-img');
const hint = document.getElementById('click-hint');
// 如果图片已加载,直接显示
if (img.src && img.complete) {
img.style.display = 'block';
if (hint) hint.style.display = 'none';
return;
}
// 加载中提示
if (hint) {
hint.innerHTML = '<div class="click-hint-icon">⏳</div><div>图片加载中...</div>';
}
img.src = `img/${certNumber}.svg`;
img.onload = () => {
img.style.display = 'block';
if (hint) hint.style.display = 'none';
};
img.onerror = () => {
if (hint) {
hint.innerHTML = '<div class="click-hint-icon">❌</div><div>图片加载失败</div>';
}
};
}
loadData(); loadData();
</script> </script>
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script> <script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
</body> </body>
+2 -2
View File
@@ -299,7 +299,7 @@
<tr> <tr>
<th>证书编号</th> <th>证书编号</th>
<th>持有人</th> <th>持有人</th>
<th class="hide-on-mobile">荣誉标题</th> <th>荣誉标题</th>
<th>颁发日期</th> <th>颁发日期</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
@@ -312,7 +312,7 @@
<tr> <tr>
<td><strong>${item.cert_number}</strong></td> <td><strong>${item.cert_number}</strong></td>
<td>${item.holder_name}</td> <td>${item.holder_name}</td>
<td class="hide-on-mobile">${item.honor_title}</td> <td>${item.honor_title}</td>
<td>${item.issue_date || '-'}</td> <td>${item.issue_date || '-'}</td>
<td><a class="btn-link" onclick="goToDetail('${item.id}')">详情</a></td> <td><a class="btn-link" onclick="goToDetail('${item.id}')">详情</a></td>
</tr> </tr>
+152 -59
View File
@@ -8,36 +8,60 @@
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script> <script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
<style> <style>
:root {
--primary-blue: #1a73e8;
--light-blue: #e3f2fd;
--gradient-blue: linear-gradient(135deg, #66b3ff, #1a73e8);
--shadow-light: 0 4px 12px rgba(26, 115, 232, 0.15);
--shadow-medium: 0 8px 24px rgba(26, 115, 232, 0.2);
}
body { body {
background: #f0f2f5; background: linear-gradient(180deg, #f0f7ff, #e8f4fc);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
min-height: 100vh;
padding: 20px;
} }
.ticket-container { .ticket-container {
max-width: 900px; max-width: 900px;
margin: 60px auto; margin: 40px auto;
padding: 32px; padding: 32px;
background: #fff; background: #fff;
border-radius: 12px; border-radius: 16px;
box-shadow: 0 8px 24px rgba(0,0,0,0.08); box-shadow: var(--shadow-medium);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
} }
h1 { h1 {
text-align: center; text-align: center;
font-size: 24px; font-size: 28px;
font-weight: 600; font-weight: 600;
margin-bottom: 20px; margin-bottom: 12px;
background: var(--gradient-blue);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.page-desc {
text-align: center;
color: #6b7280;
font-size: 14px;
margin-bottom: 28px;
} }
.search-form { .search-form {
margin-bottom: 24px; margin-bottom: 24px;
padding: 20px; padding: 24px;
background: #fafafa; background: linear-gradient(135deg, #f8fbff, #f0f7ff);
border-radius: 10px; border-radius: 12px;
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px; gap: 16px;
align-items: end; align-items: end;
border: 1px solid #e0f0ff;
} }
.form-group { .form-group {
@@ -47,35 +71,49 @@
.form-group label { .form-group label {
font-size: 13px; font-size: 13px;
color: #666; color: #4b5563;
margin-bottom: 6px; margin-bottom: 8px;
font-weight: 500;
} }
.form-control { .form-control {
padding: 10px 12px; padding: 12px 16px;
border: 1px solid #ddd; border: 1.5px solid #d1d5db;
border-radius: 6px; border-radius: 8px;
font-size: 14px;
transition: all 0.3s ease;
background: white;
} }
.form-control:focus { .form-control:focus {
border-color: #4CAF50; border-color: var(--primary-blue);
outline: none; outline: none;
box-shadow: 0 0 0 2px rgba(76,175,80,0.15); box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}
.form-control::placeholder {
color: #9ca3af;
} }
.btn { .btn {
height: 40px; height: 44px;
background: linear-gradient(135deg, #4CAF50, #43a047); background: var(--gradient-blue);
border-radius: 6px; border-radius: 8px;
color: #fff; color: #fff;
font-weight: 500; font-weight: 600;
cursor: pointer; cursor: pointer;
border: none; border: none;
transition: all 0.3s ease;
box-shadow: var(--shadow-light);
} }
.btn:hover { .btn:hover {
transform: translateY(-1px); transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(76,175,80,0.3); box-shadow: 0 6px 16px rgba(26, 115, 232, 0.3);
}
.btn:active {
transform: translateY(0);
} }
.result-table { .result-table {
@@ -83,70 +121,124 @@
border-collapse: collapse; border-collapse: collapse;
margin-top: 16px; margin-top: 16px;
font-size: 14px; font-size: 14px;
border-radius: 10px;
overflow: hidden;
} }
.result-table th { .result-table th {
background: #fafafa; background: linear-gradient(135deg, #f0f7ff, #e3f2fd);
text-align: left; text-align: left;
padding: 12px; padding: 16px 12px;
font-weight: 600; font-weight: 600;
border-bottom: 1px solid #eee; color: #1e40af;
border-bottom: 2px solid #bfdbfe;
} }
.result-table td { .result-table td {
padding: 12px; padding: 14px 12px;
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #e5e7eb;
color: #374151;
} }
.result-table tr:hover { .result-table tr:hover {
background: #fafafa; background: #f9fafb;
} }
.status { .status {
padding: 4px 8px; padding: 6px 12px;
border-radius: 4px; border-radius: 6px;
font-size: 12px; font-size: 12px;
font-weight: 500;
display: inline-block;
} }
.status.done { .status.done {
background: #e8f5e9; background: linear-gradient(135deg, #dcfce7, #bbf7d0);
color: #2e7d32; color: #166534;
box-shadow: 0 2px 4px rgba(22, 101, 52, 0.1);
} }
.status.pending { .status.pending {
background: #fff3e0; background: linear-gradient(135deg, #ffedd5, #fed7aa);
color: #ef6c00; color: #c2410c;
box-shadow: 0 2px 4px rgba(194, 65, 12, 0.1);
} }
.no-result { .no-result {
text-align: center; text-align: center;
padding: 60px; padding: 80px 20px;
color: #999; color: #9ca3af;
font-size: 16px;
background: #f9fafb;
border-radius: 12px;
margin-top: 20px;
} }
.loading { .loading {
text-align: center; text-align: center;
padding: 30px; padding: 40px;
color: #666; color: var(--primary-blue);
font-size: 15px;
font-weight: 500;
} }
.error-message { .error-message {
background-color: #fee; background: linear-gradient(135deg, #fee2e2, #fecaca);
color: #c33; color: #b91c1c;
padding: 10px; padding: 16px;
border-radius: 6px; border-radius: 10px;
border-left: 4px solid #ef4444;
margin-top: 20px;
} }
.back-link { .back-link {
font-size: 14px; font-size: 14px;
color: #4CAF50; color: var(--primary-blue);
text-decoration: none; text-decoration: none;
display: inline-block; display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 20px; margin-bottom: 20px;
padding: 8px 16px;
background: var(--light-blue);
border-radius: 8px;
transition: all 0.3s ease;
} }
.back-link:hover { .back-link:hover {
text-decoration: underline; background: #bfdbfe;
text-decoration: none;
transform: translateX(-4px);
}
/* 响应式优化 */
@media (max-width: 768px) {
body {
padding: 10px;
}
.ticket-container {
margin: 20px auto;
padding: 20px;
}
h1 {
font-size: 24px;
}
.search-form {
grid-template-columns: 1fr;
padding: 16px;
}
.result-table {
font-size: 13px;
}
.result-table th,
.result-table td {
padding: 10px 8px;
}
} }
</style> </style>
</head> </head>
@@ -157,25 +249,26 @@
<a href="../index.html" class="back-link">← 返回首页</a> <a href="../index.html" class="back-link">← 返回首页</a>
<h1>单据查询</h1> <h1>单据查询</h1>
<p>请输入查询条件,可以查询2024年至今的单据</p> <p class="page-desc">请输入查询条件,可查询 2024 年至今的单据</p>
<div class="search-form"> <div class="search-form">
<div class="form-group"> <div class="form-group">
<label>编号 / 姓名</label> <label for="searchTerm">编号 / 姓名</label>
<input type="text" id="searchTerm" class="form-control"> <input type="text" id="searchTerm" class="form-control" placeholder="请输入编号或姓名">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>开始日期</label> <label for="dateFrom">开始日期</label>
<input type="date" id="dateFrom" class="form-control"> <input type="date" id="dateFrom" class="form-control" title="选择开始日期">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>结束日期</label> <label for="dateTo">结束日期</label>
<input type="date" id="dateTo" class="form-control"> <input type="date" id="dateTo" class="form-control" title="选择结束日期">
</div> </div>
<button id="searchBtn" class="btn">查询</button> <button id="searchBtn" class="btn">立即查询</button>
</div> </div>
<div id="searchResults"></div> <div id="searchResults"></div>
@@ -231,7 +324,7 @@
const resultsDiv = document.getElementById('searchResults'); const resultsDiv = document.getElementById('searchResults');
if (!tickets || tickets.length === 0) { if (!tickets || tickets.length === 0) {
resultsDiv.innerHTML = '<div class="no-result">未找到符合条件的单据</div>'; resultsDiv.innerHTML = '<div class="no-result">🔍 未找到符合条件的单据</div>';
return; return;
} }
@@ -251,15 +344,15 @@
<td>${ticket.ticket_number || ''}</td> <td>${ticket.ticket_number || ''}</td>
<td>${ticket.customer_name || ''}</td> <td>${ticket.customer_name || ''}</td>
<td>${ticket.reason || ''}</td> <td>${ticket.reason || ''}</td>
<td>¥${Number(ticket.amount || 0).toFixed(2)}</td> <td style="font-weight: 600; color: #1a73e8;"${Number(ticket.amount || 0).toFixed(2)}</td>
<td>${formatDate(ticket.created_at)}</td> <td>${formatDate(ticket.created_at)}</td>
<td> <td>
<span class="status ${ticket.processed ? 'done' : 'pending'}"> <span class="status ${ticket.processed ? 'done' : 'pending'}">
${ticket.processed ? '已处理' : '未处理'} ${ticket.processed ? '已处理' : '未处理'}
</span> </span>
</td> </td>
<td> <td>
<button class="btn" onclick="viewDetail('${ticket.id}')">详情</button> <button class="btn" onclick="viewDetail('${ticket.id}')" style="padding: 6px 16px; font-size: 13px;">查看详情</button>
</td> </td>
</tr> </tr>
`; `;