Files
SupplierSystem/public/doc-preview/index.html
T
Ubuntu b9acca6f3a
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
docs(静态页): 操作说明 doc-preview 在线预览页 + 供应商测试记录页
2026-10-23 17:07:12 +08:00

68 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>供应商进销存配送系统 · 操作说明(在线预览)</title>
<style>
:root { --bg:#eef1f5; --bar:#ffffff; --line:#e5e7eb; --fg:#111827; --muted:#6b7280; --brand:#047857; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--fg); font:14px/1.6 "PingFang SC","Microsoft YaHei",system-ui,sans-serif; }
header { position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:12px;
background:var(--bar); border-bottom:1px solid var(--line); padding:10px 16px;
box-shadow:0 1px 8px rgba(0,0,0,.06); flex-wrap:wrap; }
header .title { font-weight:700; }
header .file { color:var(--muted); font-size:12px; }
header .actions { margin-left:auto; display:flex; gap:8px; }
header a, header button { font:inherit; font-size:13px; padding:6px 12px; border-radius:8px;
border:1px solid var(--line); background:#fff; color:#111827; cursor:pointer; text-decoration:none; }
header a.primary { background:var(--brand); border-color:var(--brand); color:#fff; }
#status { max-width:1000px; margin:12px auto 0; padding:0 16px; color:var(--muted); font-size:13px; }
#status.err { color:#b91c1c; white-space:pre-wrap; }
#viewport { padding:20px 16px 60px; }
.docx-wrapper { background:transparent !important; padding:0 !important; display:flex; flex-direction:column; align-items:center; gap:18px; }
.docx-wrapper > section.docx { box-shadow:0 2px 14px rgba(0,0,0,.10); border-radius:2px; }
@media print { header,#status { display:none; } #viewport{padding:0} .docx-wrapper{gap:0} .docx-wrapper > section.docx{box-shadow:none} }
</style>
</head>
<body>
<header>
<span class="title">供应商进销存配送系统 · 操作说明</span>
<span class="file">supplier-manual.docx · 浏览器直接解析渲染(内容与 Word 文件一致)</span>
<span class="actions">
<a class="primary" href="../supplier-manual.docx" download>下载原始 Word</a>
<a href="../supplier-manual.html">手机版 HTML</a>
<button onclick="window.print()">打印 / 导出 PDF</button>
</span>
</header>
<div id="status">正在加载并渲染文档…(首次打开需下载约 21 MB,请稍候)</div>
<div id="viewport"><div id="container"></div></div>
<script src="./jszip.min.js"></script>
<script src="./docx-preview.min.js"></script>
<script>
(async function () {
const status = document.getElementById('status');
const container = document.getElementById('container');
try {
if (typeof JSZip === 'undefined') throw new Error('JSZip 未加载');
if (!window.docx || typeof window.docx.renderAsync !== 'function') throw new Error('docx-preview 未加载');
const resp = await fetch('../supplier-manual.docx?v=' + Date.now(), { cache: 'no-store' });
if (!resp.ok) throw new Error('文档下载失败:HTTP ' + resp.status);
const blob = await resp.blob();
await window.docx.renderAsync(blob, container, null, {
className: 'docx', inWrapper: true, breakPages: true,
ignoreWidth: false, ignoreHeight: false, ignoreFonts: false,
experimental: true, useBase64URL: true
});
status.textContent = '渲染完成:内容直接来自 supplier-manual.docx(页数、表格、图片与 Word 一致)';
setTimeout(function () { status.style.display = 'none'; }, 2500);
} catch (e) {
status.className = 'err';
status.textContent = '渲染失败:' + (e && e.message ? e.message : e) + '\n可点击右上角「下载原始 Word」直接查看。';
}
})();
</script>
</body>
</html>