chore: curate monthly assessment evidence and scripts
This commit is contained in:
+107
@@ -0,0 +1,107 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>小羚羚小程序</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
html, body {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-height: 100%;
|
||||
height: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
#root {
|
||||
width: 100%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
height: 100%;
|
||||
min-height: 100vh;
|
||||
overflow: visible;
|
||||
}
|
||||
body.is-element-page #root {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var isComponent = false;
|
||||
if (document.body && (isComponent || window.location.pathname.includes('/components/'))) {
|
||||
document.body.classList.add('is-element-page');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div id="root"></div>
|
||||
|
||||
<script>window.__AXHUB_ANNOTATION_SOURCE_REFERENCE__={root:"source",manifest:"source/manifest.json"};</script>
|
||||
|
||||
<script src="./assets/react.production.min.js"></script>
|
||||
<script src="./assets/react-dom.production.min.js"></script>
|
||||
<script src="./assets/export-html-bootstrap.js"></script>
|
||||
|
||||
<script>
|
||||
function waitForBootstrap(timeoutMs) {
|
||||
timeoutMs = timeoutMs || 10000;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var startedAt = Date.now();
|
||||
function check() {
|
||||
if (window.HtmlTemplateBootstrap) {
|
||||
resolve(window.HtmlTemplateBootstrap);
|
||||
return;
|
||||
}
|
||||
if (Date.now() - startedAt >= timeoutMs) {
|
||||
reject(new Error('[Html Template] Bootstrap 初始化超时'));
|
||||
return;
|
||||
}
|
||||
setTimeout(check, 10);
|
||||
}
|
||||
check();
|
||||
});
|
||||
}
|
||||
|
||||
function loadEntryScript(src) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var script = document.createElement('script');
|
||||
script.src = src;
|
||||
script.async = false;
|
||||
script.onload = function () { resolve(); };
|
||||
script.onerror = function () { reject(new Error('[Html Template] 入口脚本加载失败: ' + src)); };
|
||||
document.body.appendChild(script);
|
||||
});
|
||||
}
|
||||
|
||||
async function bootstrapAndRender() {
|
||||
try {
|
||||
var bootstrap = await waitForBootstrap();
|
||||
var renderComponent = bootstrap.renderComponent;
|
||||
window.React = bootstrap.React;
|
||||
window.ReactDOM = bootstrap.ReactDOM;
|
||||
|
||||
await loadEntryScript('./index.js');
|
||||
window.__AXHUB_ANNOTATION_SOURCE_REFERENCE__={root:"source",manifest:"source/manifest.json"};
|
||||
|
||||
var Component = window.UserComponent && (window.UserComponent.Component || window.UserComponent.default || window.UserComponent);
|
||||
if (!Component) {
|
||||
throw new Error('[Html Template] 入口脚本未暴露 UserComponent');
|
||||
}
|
||||
|
||||
renderComponent(Component);
|
||||
} catch (error) {
|
||||
console.error('[Html Template] 页面初始化失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
bootstrapAndRender();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user