login fix

This commit is contained in:
zzh 2026-05-11 14:28:08 +08:00
parent ada8c291a2
commit 0a79a83ac3
4 changed files with 27 additions and 7 deletions

View File

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>韬智生产管理系统</title>
<link rel="icon" type="image/x-icon" href="./assets/icon.ico" />
<link rel="icon" type="image/x-icon" href="/icon.ico" />
<!-- Modern Professional Typography -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
@ -36,7 +36,7 @@
<div class="brand">
<div class="brand-content">
<div class="brand-logo">
<img src="./assets/icon.ico" alt="Logo" style="width:100%;height:100%;object-fit:contain" />
<img src="/icon.ico" alt="Logo" style="width:100%;height:100%;object-fit:contain" />
</div>
<span class="brand-name">韬智生产管理</span>
</div>

View File

@ -1225,7 +1225,7 @@ const Dashboard = (() => {
};
};
const drawShipmentDonutChart = (stats) => {
const drawShipmentDonutChart = async (stats) => {
const canvas = document.getElementById('shipment-donut-chart');
if(!canvas) return;
const ctx = canvas.getContext('2d');
@ -1243,6 +1243,20 @@ const Dashboard = (() => {
const items = Object.entries(byPlatform).filter(([, v]) => (v || 0) > 0);
items.sort((a, b) => (b[1] || 0) - (a[1] || 0));
// 获取机种列表以映射自定义机种名称
let platformList = [];
try {
const platformRes = await fetch('/api/shipments/platforms', {
headers: { 'Content-Type': 'application/json' },
credentials: 'include'
}).then(r => r.ok ? r.json() : null);
if(platformRes && platformRes.list) {
platformList = platformRes.list;
}
} catch(e) {
// 忽略错误,使用默认映射
}
const platformName = (k) => {
const map = {
pdd: '拼多多',
@ -1253,7 +1267,13 @@ const Dashboard = (() => {
std: '标准版',
unknown: '未知'
};
return map[k] || k;
// 先从固定映射查找
if(map[k]) return map[k];
// 再从机种列表查找自定义机种名称
const customPlatform = platformList.find(p => p.value === k);
if(customPlatform) return customPlatform.label;
// 最后返回原始值
return k;
};
const platformColor = (k, fallbackIndex) => {
@ -1358,7 +1378,7 @@ const Dashboard = (() => {
window.__shipmentStatsTs = window.__shipmentStatsTs || 0;
const now = Date.now();
if(!force && (now - window.__shipmentStatsTs) < 60000 && window.__shipmentStatsCache) {
drawShipmentDonutChart(window.__shipmentStatsCache);
await drawShipmentDonutChart(window.__shipmentStatsCache);
return;
}
try {
@ -1369,7 +1389,7 @@ const Dashboard = (() => {
if(res && res.ok) {
window.__shipmentStatsCache = res;
window.__shipmentStatsTs = now;
drawShipmentDonutChart(res);
await drawShipmentDonutChart(res);
}
} catch(e) {
}

View File

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>登录 - 韬智生产管理系统</title>
<link rel="icon" type="image/x-icon" href="../icon.ico" />
<link rel="icon" type="image/x-icon" href="/icon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />

Binary file not shown.