Files
wecom_it_smart_desk/frontend-h5/dist_bak/itsm-bridge.html
T

65 lines
2.7 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>正在打开 ITSM 工单…</title>
<style>
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
display: flex; align-items: center; justify-content: center;
background: #f2f3f5; color: #646566;
}
.card {
background: #fff; border-radius: 12px; padding: 28px 24px;
text-align: center; box-shadow: 0 2px 12px rgba(0,0,0,.06);
max-width: 80%;
}
.spinner {
width: 30px; height: 30px; margin: 0 auto 14px;
border: 3px solid #ebedf0; border-top-color: #07c160;
border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tip { font-size: 14px; line-height: 1.6; }
.tip small { color: #c8c9cc; }
</style>
</head>
<body>
<div class="card">
<div class="spinner"></div>
<div class="tip">正在打开 ITSM 工单…<br /><small>若长时间未跳转,请手动刷新</small></div>
</div>
<script>
(function () {
// 读取工单服务名(H5 卡片传入时已做 URL 编码)
var name = new URLSearchParams(location.search).get('name') || '';
// 目标:Web ITSM 工单深链(本身不支持静默登录,必须经首页预热会话)
var WEB = 'http://devops.dc.servyou-it.com/ITSM/workflow/service/createTicket?name=' + encodeURIComponent(name);
// 预热入口:移动端首页在企微 webview 内会静默企微 OAuth,把 ITSM 后端会话“预热”出来
var HOME = 'https://itsm.servyou.com.cn/itsm-miniapp-mobile/';
function goWeb() { window.top.location.href = WEB; }
// 用隐藏 iframe 加载移动端首页,触发静默企微 OAuth 预热 ITSM 会话。
// 预热成功后,后续 top-level 跳转到 Web 深链即可复用该会话、免登录直达表单。
try {
var f = document.createElement('iframe');
f.setAttribute('style', 'position:absolute;width:1px;height:1px;left:-9999px;top:-9999px;border:0;opacity:0;');
f.src = HOME;
// 不依赖 onload(部分情况下被 X-Frame-Options 拦截不触发),统一靠定时器跳转
document.body.appendChild(f);
} catch (e) {
// 忽略:即使 iframe 被拦截,定时器仍会跳转(退化为冷 hit,可能弹登录,属可预期降级)
}
// 给预热留出时间后跳转 Web 深链
setTimeout(goWeb, 2500);
})();
</script>
</body>
</html>