| 1234567891011121314 |
- <!doctype html><html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>康师傅 · 报告确认</title>
- <style>*{box-sizing:border-box}body{font:15px/1.6 system-ui;background:#f5f6fa;color:#18212e;margin:0}main{max-width:1140px;margin:auto;padding:28px}header{display:flex;justify-content:space-between;align-items:center;gap:20px}h1{font-size:23px;margin:0}small{color:#6b7480}.box{background:white;border:1px solid #e5e9ef;border-radius:14px;padding:22px;margin-top:20px;box-shadow:0 8px 26px #16223808}input{width:240px;max-width:100%;padding:11px;border:1px solid #d7dde7;border-radius:7px;margin:5px}button{padding:11px 18px;border:0;border-radius:7px;background:#be2334;color:#fff;cursor:pointer}button:disabled{opacity:.45;cursor:default}iframe{width:100%;height:65vh;border:1px solid #e5e9ef;border-radius:9px;background:white}#message{white-space:pre-wrap;color:#7c2833}#identity{overflow-wrap:anywhere}label{display:block;margin:14px 0}#preview{display:none}</style>
- <main><header><div><small>康师傅 · 产品创新助手</small><h1>查看并确认报告</h1></div><small>确认仅针对当前版本</small></header>
- <section id="login" class="box"><h2>员工登录</h2><p>请使用已获授权的员工账号。确认记录会保存登录身份和当前报告版本。</p><form id="form"><input id="username" autocomplete="username" placeholder="员工账号" required><input id="password" type="password" autocomplete="current-password" placeholder="密码" required><button>登录并查看</button></form></section>
- <section id="preview" class="box"><p id="identity"></p><iframe id="frame" sandbox="" referrerpolicy="no-referrer" title="待确认报告"></iframe><label><input type="checkbox" id="ack" style="width:auto">我已查看当前报告,同意将此版本提交入库。</label><button id="confirm" disabled>确认当前版本</button><p><small>报告内容变化后,需要重新确认。确认报告不代表其中每一项推断均已核验。</small></p></section><p id="message" role="status"></p></main>
- <script nonce="__NONCE__">'use strict';
- const API='/api/functions',APP='FKieRbIoGt_main',previewId=new URLSearchParams(location.search).get('previewId');let token='',report=null,objectUrl=null;
- const el=id=>document.getElementById(id),say=s=>{el('message').textContent=s;};
- async function call(name,params){const r=await fetch(API,{method:'POST',headers:{'content-type':'application/json','X-Parse-Application-Id':APP,'X-Parse-Session-Token':token},body:JSON.stringify({path:'/'+name,params})});const j=await r.json(),v=j.result;if(!r.ok||!v?.ok)throw Error(v?.errors?.map(e=>e.message).join(';')||j.error||'请求失败');return v.data;}
- el('form').addEventListener('submit',async e=>{e.preventDefault();say('正在核验登录身份…');try{if(!previewId)throw Error('确认链接缺少报告编号');const r=await fetch('/parse/login',{method:'POST',headers:{'content-type':'application/json','X-Parse-Application-Id':APP},body:JSON.stringify({username:el('username').value,password:el('password').value})});const j=await r.json();el('password').value='';if(!r.ok||!j.sessionToken)throw Error('登录失败,请核对账号和密码');token=j.sessionToken;report=await call('ksfGetReportPreview',{previewId});objectUrl=URL.createObjectURL(new Blob([report.html],{type:'text/html'}));el('frame').src=objectUrl;el('identity').textContent='报告:'+report.reportIdentity.reportSeriesKey+' · 版本 '+report.reportIdentity.version+' · 内容指纹 '+report.reportIdentity.reportContentHash;el('login').hidden=true;el('preview').style.display='block';say('请查看报告后确认。');}catch(e){say(e.message);}});
- el('ack').addEventListener('change',()=>el('confirm').disabled=!el('ack').checked);
- el('confirm').addEventListener('click',async()=>{el('confirm').disabled=true;try{const r=await call('ksfEmployeeConfirmation',{requestId:'employee-confirm:'+previewId+':'+crypto.randomUUID(),previewId,action:'confirm_report',reportContentHash:report.reportIdentity.reportContentHash});say('已确认当前版本,助手可继续入库。确认事件编号:'+r.eventId);el('ack').disabled=true;}catch(e){say(e.message);el('confirm').disabled=false;}});
- addEventListener('pagehide',()=>{if(objectUrl)URL.revokeObjectURL(objectUrl);token='';});
- </script></html>
|