13 lines
1.5 KiB
HTML
13 lines
1.5 KiB
HTML
<!doctype html><html lang="zh-CN"><meta charset="utf-8"><body>
|
|
<!-- Isolated compatibility-component harness. The production app uses the native Coordinator/Dispatcher UI. -->
|
|
<aside><a href="#rules">分类规则</a><a href="#order-center">订单中心</a><a href="#mail-batches">邮件批次</a></aside>
|
|
<main id="content"></main><script src="/order-workflow.js"></script><script>
|
|
(async()=>{
|
|
const api=async(route,body,{signal}={})=>{const response=await fetch('/api'+route,{signal,method:body===undefined?'GET':'POST',headers:body===undefined?{}:{'Content-Type':'application/json'},body:body===undefined?undefined:JSON.stringify(body)});const data=await response.json();if(!response.ok)throw Error(data.error||'request failed');return data;};
|
|
const esc=value=>String(value??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
|
const {user}=await api('/me');window.OrderWorkflowViews.configure({api,esc,formatDate:value=>String(value||'—'),notify(){},user});
|
|
let generation=0,current='';async function route(){const hash=location.hash.slice(1)||'rules',name=['rules','order-rules'].includes(hash)?'rules':hash==='mail-batches'?'batches':'orders';if(current===hash)return;current=hash;const revision=++generation;await window.OrderWorkflowViews[name](document.querySelector('#content'),()=>revision===generation);}
|
|
window.addEventListener('hashchange',()=>route().catch(error=>{document.querySelector('#content').textContent=error.message;}));await route();
|
|
})();
|
|
</script></body></html>
|