unis-oa/frontend/index.html

207 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<!--
IE 在内网里默认可能掉进"兼容性视图",那一档按 IE7 的盒子模型画,栅格全歪。
这一句把它按回本机最新的内核;老内核认不认识这一句都不影响别的浏览器。
-->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--
页签上那一枚就是系统左上角那块 "OA" 磁贴:整套图标都由
frontend/scripts/gen-icons.py 一处生成,不会哪天又长歪。
管理员在「站点信息」里另填了 logo 时,开发模式下由 vite 的 injectBranding
把下面第一句整个换掉,生产则由 src/utils/branding.ts 在拿到公开配置之后改。
第二句是留给不认 SVG 图标的那几档内核兜底的:老 Safari 与 Edge 旧内核看不了
rel="icon" 的矢量图,只会自己去要 /favicon.ico,这里显式指一次就不必靠猜路径。
-->
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="alternate icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<!-- PWA:装到桌面之后是一条独立的 App 任务栏,地址栏没有了,
所以状态栏那一条的颜色得由我们自己认领,主题色取自 tailwind 的 primary-600 -->
<meta name="theme-color" content="#0d9488" />
<meta name="description" content="待办、发起、审批:一部手机上的 OA 办公台" />
<link rel="manifest" href="/manifest.webmanifest" />
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="UnisOA" />
<title>UnisOA 流程审批平台</title>
<!-- 深色档在画第一笔之前就得定下来:这条原来写在 main.ts 里,而那是一份模块脚本,
等它跑起来这页已经白了一瞬。样式与骨架屏同理,都不能等 Tailwind 下载完。 -->
<script>
(function () {
try {
var saved = localStorage.getItem('theme')
var dark = saved === 'dark' || (!saved && window.matchMedia('(prefers-color-scheme: dark)').matches)
// 不用 classList.toggle(name, force):IE 11 认不出第二个参数,深色档会变反。
if (dark) document.documentElement.classList.add('dark')
else document.documentElement.classList.remove('dark')
// 主题色同理:整套色板在样式表里按 <html data-accent> 分套,
// 首屏这一笔只写那一个属性,色值一份都不抄(抄一份就会走样)。
// 认不出的值干脆不写,落回 :root 那一套默认青。
var accent = localStorage.getItem('oa.accent')
if (accent === 'teal' || accent === 'blue' || accent === 'indigo' ||
accent === 'violet' || accent === 'rose' || accent === 'amber') {
document.documentElement.setAttribute('data-accent', accent)
}
} catch (e) {
/* 隐私模式里 localStorage 会抛:照着浅色画就是 */
}
})()
</script>
<!--
老内核闸门。跑不了这套界面就别让它空转骨架屏:骨架屏是会一直闪的那幅样子,
人对着一片闪只能猜"网慢",实际上这一档引擎根本画不出来(Vue 3 的响应式要 Proxy,
Tailwind 的色板要 CSS 变量,两者都补不出来)。判据与 src/utils/legacyCompat.ts
的 probeRuntime() 同一套,浏览器口径见 docs/frontend-design.md §15。
这一整段必须是 ES5:语法本身解析不了的话,告示也就没人看见了。
还有一条踩过坑的规矩:这段写在 head 里,那时候 body 与 #app 都还不存在,
一上来就往 body 上挂东西会抛异常,而异常是 catch 掉的——闸门等于没装上。
所以先只往 <html> 上打标记,那句人话等 body 长出来再画。
-->
<script>
(function () {
var g = typeof window !== 'undefined' ? window : this
var missing = []
if (typeof g.Proxy !== 'function') missing.push('Proxy')
if (typeof g.Symbol !== 'function') missing.push('Symbol')
if (typeof g.Promise !== 'function') missing.push('Promise')
var cssVars = false
try {
cssVars = !!(g.CSS && g.CSS.supports && g.CSS.supports('--oa-compat', '0'))
} catch (e) {
cssVars = false
}
if (!cssVars) missing.push('CSS 变量')
if (!missing.length) return
// 标记先打上:骨架屏是靠 CSS 藏起来的,早一拍就不会闪。
document.documentElement.setAttribute('data-legacy-engine', '1')
var draw = function () {
try {
if (document.querySelector('[data-legacy-gate]')) return
var notice = document.createElement('div')
notice.setAttribute('data-legacy-gate', '')
notice.style.cssText =
'display:block;box-sizing:border-box;max-width:640px;margin:12vh auto;padding:24px;' +
'border:1px solid #e5e7eb;border-radius:12px;background:#fff;color:#111827;' +
"font:14px/1.7 -apple-system,'Segoe UI','Microsoft YaHei',sans-serif"
notice.innerHTML =
'<div style="margin:0 0 8px;font-size:18px;font-weight:600">当前浏览器内核过旧,这一页画不出来</div>' +
'<p style="margin:0 0 12px">这套办公界面要用到 <code>Proxy</code> 与 CSS 变量,老内核缺了它们就无法正确渲染:系统带出值、明细表、金额与日期都可能空着。</p>' +
'<p style="margin:0 0 12px">请改用 <strong>Microsoft Edge</strong>、<strong>Chrome</strong>、<strong>Firefox</strong> 或 360 浏览器的极速模式打开;如果开着 Edge 的「IE 模式」,切回 Edge 模式即可。</p>' +
'<p style="margin:0;color:#6b7280;font-size:12px">检测到缺失:' + missing.join('、') + '</p>'
var app = document.getElementById('app')
if (app) {
app.innerHTML = ''
app.appendChild(notice)
} else if (document.body) {
document.body.appendChild(notice)
}
} catch (e) {
/* 连告示都画不出来的引擎,只能留给下一位了 */
}
}
// addEventListener 本身也是要看一眼的:IE 8 只有 attachEvent,那句人话得换个门等
if (document.readyState !== 'loading') draw()
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', draw, false)
else if (g.addEventListener) g.addEventListener('load', draw, false)
else if (g.attachEvent) g.attachEvent('onload', draw)
else draw()
})()
</script>
<style>
/* 首屏骨架:免登落地要先拿一次性票据换会话,这段等待不该让人看见一张登录页。
320ms 之内能进站就压根不画它(靠 animation-delay 撑着),网络慢时才替上那片空白。
类名同时给 views/auth/SsoCallbackView.vue 的等待态用,两处是同一幅样子。 */
.boot-shell {
display: flex;
min-height: 100vh;
flex-direction: column;
background: #f9fafb;
opacity: 0;
animation: boot-reveal 1ms linear 320ms forwards;
}
.dark .boot-shell { background: #020617; }
/* 闸门拉下之后,这幅会一直闪的占位就该消失:脚本里的异常都 catch 了,不能指望它自己收尾 */
[data-legacy-engine] .boot-shell { display: none; }
.boot-bar,
.boot-tabs {
display: flex;
flex-shrink: 0;
align-items: center;
gap: 12px;
padding: 14px 16px;
background: rgba(255, 255, 255, 0.9);
}
.boot-bar { border-bottom: 1px solid #e5e7eb; }
.boot-tabs { display: none; justify-content: space-around; border-top: 1px solid #e5e7eb; }
@media (max-width: 1023px) {
.boot-tabs { display: flex; }
}
.boot-main { flex: 1; padding: 16px; }
.boot-card { margin-bottom: 12px; padding: 16px; border-radius: 12px; background: #fff; }
.dark .boot-bar,
.dark .boot-tabs { background: rgba(30, 41, 59, 0.7); }
.dark .boot-bar { border-color: #1e293b; }
.dark .boot-tabs { border-color: #1e293b; }
.dark .boot-card { background: #1e293b; }
.boot-bar, .boot-card, .boot-tabs, .boot-block {
background-image: linear-gradient(
90deg,
transparent 0%,
rgb(var(--primary-500, 20 184 166) / 0.08) 50%,
transparent 100%
);
background-size: 200% 100%;
background-repeat: no-repeat;
animation: boot-shimmer 1.6s linear infinite;
}
.boot-pill, .boot-line, .boot-block, .boot-tabs i {
display: block;
border-radius: 6px;
background: #e5e7eb;
}
.dark .boot-pill, .dark .boot-line, .dark .boot-block, .dark .boot-tabs i { background: #334155; }
.boot-pill { height: 20px; }
.boot-line { height: 12px; margin-bottom: 10px; }
.boot-block { width: 100%; height: 76px; }
.boot-tabs i { width: 24px; height: 24px; border-radius: 8px; }
.boot-w-xs { width: 48px; }
.boot-w-sm { width: 96px; }
.boot-w-md { width: 60%; }
.boot-w-lg { width: 40%; }
@keyframes boot-reveal { to { opacity: 1; } }
@keyframes boot-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
.boot-bar, .boot-card, .boot-tabs, .boot-block { animation: none; }
}
</style>
</head>
<body>
<noscript>
<div style="max-width:640px;margin:12vh auto;padding:24px;border:1px solid #e5e7eb;border-radius:12px;background:#fff;color:#111827;font:14px/1.7 sans-serif">
这一页要靠 JavaScript 才能列出待办与表单,请在浏览器里允许脚本运行后刷新。
</div>
</noscript>
<div id="app">
<!-- 这一份是挂载前的占位,app.mount() 会把它整块换掉。
画的是"进站的壳子"而不是登录页:从企业微信卡片点进来的人不该先撞见一张登录卡。 -->
<div class="boot-shell" aria-hidden="true">
<div class="boot-bar">
<span class="boot-pill boot-w-sm"></span>
<span class="boot-pill boot-w-xs" style="margin-left: auto"></span>
</div>
<div class="boot-main">
<div class="boot-card"><span class="boot-line boot-w-lg"></span><span class="boot-line boot-w-md"></span></div>
<div class="boot-card"><span class="boot-block"></span></div>
<div class="boot-card"><span class="boot-line boot-w-md"></span><span class="boot-line boot-w-sm"></span></div>
</div>
<div class="boot-tabs"><i></i><i></i><i></i><i></i></div>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>