提交 a5110a84 作者: zhongye-dev

fix: 修复 public 静态资源在子路径部署下的 404

- 地图 geojson 改用 BASE_URL 加载 china-provinces.json
- 各模板下载路径(隔离记录表、实验室检验记录、处理决定通知书、放行证书、处理方案/结果报告单)统一改用 import.meta.env.BASE_URL 前缀

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
上级 32bcb7ec
...@@ -593,7 +593,7 @@ const onRegClick = (cert) => { ...@@ -593,7 +593,7 @@ const onRegClick = (cert) => {
}; };
const onDownloadIsolationTemplate = () => { const onDownloadIsolationTemplate = () => {
const a = document.createElement("a"); const a = document.createElement("a");
a.href = "/isolation-record-template.docx"; a.href = `${import.meta.env.BASE_URL}isolation-record-template.docx`;
a.download = "隔离检疫情况记录表模板.docx"; a.download = "隔离检疫情况记录表模板.docx";
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
......
...@@ -636,8 +636,8 @@ const goToDisposal = () => { ...@@ -636,8 +636,8 @@ const goToDisposal = () => {
const onDownloadTemplate = (type) => { const onDownloadTemplate = (type) => {
tplOpen.value = false; tplOpen.value = false;
const map = { const map = {
lab: { href: "/lab-test-template.docx", name: "隔离检疫实验室检验记录及检验结果报告模板.docx" }, lab: { href: `${import.meta.env.BASE_URL}lab-test-template.docx`, name: "隔离检疫实验室检验记录及检验结果报告模板.docx" },
decision: { href: "/quarantine-decision-template.docx", name: "隔离检疫处理决定通知书模板.docx" } decision: { href: `${import.meta.env.BASE_URL}quarantine-decision-template.docx`, name: "隔离检疫处理决定通知书模板.docx" }
}; };
const item = map[type] || map.lab; const item = map[type] || map.lab;
const a = document.createElement("a"); const a = document.createElement("a");
......
...@@ -780,8 +780,8 @@ const onAdd = () => { addForm.value = defaultAddForm(); addTab.value = "d2"; upl ...@@ -780,8 +780,8 @@ const onAdd = () => { addForm.value = defaultAddForm(); addTab.value = "d2"; upl
const onDownloadTemplate = (type) => { const onDownloadTemplate = (type) => {
tplOpen.value = false; tplOpen.value = false;
const map = { const map = {
lab: { href: "/lab-test-template.docx", name: "隔离检疫实验室检验记录及检验结果报告模板.docx" }, lab: { href: `${import.meta.env.BASE_URL}lab-test-template.docx`, name: "隔离检疫实验室检验记录及检验结果报告模板.docx" },
decision: { href: "/quarantine-decision-template.docx", name: "隔离检疫处理决定通知书模板.docx" } decision: { href: `${import.meta.env.BASE_URL}quarantine-decision-template.docx`, name: "隔离检疫处理决定通知书模板.docx" }
}; };
const item = map[type] || map.lab; const item = map[type] || map.lab;
const a = document.createElement("a"); const a = document.createElement("a");
......
...@@ -986,7 +986,7 @@ const onDownloadTemplate = (type) => { ...@@ -986,7 +986,7 @@ const onDownloadTemplate = (type) => {
const map = { treatment: "quarantine-treatment-report-template.docx" }; const map = { treatment: "quarantine-treatment-report-template.docx" };
const filename = map[type] || "quarantine-treatment-report-template.docx"; const filename = map[type] || "quarantine-treatment-report-template.docx";
const link = document.createElement("a"); const link = document.createElement("a");
link.href = "/" + filename; link.href = import.meta.env.BASE_URL + filename;
link.download = filename; link.download = filename;
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
...@@ -1029,7 +1029,7 @@ const planDrugs = [ ...@@ -1029,7 +1029,7 @@ const planDrugs = [
{ v: "磷化铝", l: "磷化铝" }, { v: "磷化铝", l: "磷化铝" },
{ v: "其他", l: "其他" } { v: "其他", l: "其他" }
]; ];
const TEMPLATE_URL = "/templates/plant_quarantine_plan_template.docx"; const TEMPLATE_URL = `${import.meta.env.BASE_URL}templates/plant_quarantine_plan_template.docx`;
const planUploadedName = ref(""); const planUploadedName = ref("");
const planFormVisible = ref(true); const planFormVisible = ref(true);
......
...@@ -508,7 +508,7 @@ const onJump = () => { const p = parseInt(jumpInput.value); if (!isNaN(p)) goPag ...@@ -508,7 +508,7 @@ const onJump = () => { const p = parseInt(jumpInput.value); if (!isNaN(p)) goPag
const onDownloadTemplate = () => { const onDownloadTemplate = () => {
tplMenuOpen.value = false; tplMenuOpen.value = false;
const link = document.createElement("a"); const link = document.createElement("a");
link.href = "/release-cert-template.docx"; link.href = `${import.meta.env.BASE_URL}release-cert-template.docx`;
link.download = "隔离植物检疫放行证书模板.docx"; link.download = "隔离植物检疫放行证书模板.docx";
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
......
...@@ -885,7 +885,7 @@ const geoStore = {}; // adcode -> 下级行政区边界(远端懒加载 ...@@ -885,7 +885,7 @@ const geoStore = {}; // adcode -> 下级行政区边界(远端懒加载
async function loadGeo() { async function loadGeo() {
if (geoCache) return geoCache; if (geoCache) return geoCache;
const res = await fetch("/china-provinces.json"); const res = await fetch(`${import.meta.env.BASE_URL}china-provinces.json`);
geoCache = await res.json(); geoCache = await res.json();
return geoCache; return geoCache;
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论