PyBot/web/templates/log.html
2024-12-15 02:14:39 +08:00

53 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>日志查询</title>
<!-- 引入 Layui 的 CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui-src/dist/css/layui.css">
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
color: #333;
}
#markdown-content {
white-space: pre-wrap; /* Preserve whitespace and wrap lines */
}
</style>
</head>
<body>
<div class="layui-container">
<h1 class="layui-title">程序运行日志</h1>
<pre>{{ log_content }}</pre>
<div id="markdown-content" class="layui-card-body"></div>
</div>
<!-- 引入 Layui 的 JS -->
<script src="https://cdn.jsdelivr.net/npm/layui-src/dist/layui.js"></script>
<!-- <script>
layui.use(['layer'], function(){
var layer = layui.layer;
fetch('/get-log')
.then(response => response.json())
.then(data => {
if (data.content) {
const htmlContent = marked.parse(data.content);
document.getElementById('markdown-content').innerHTML = htmlContent;
} else {
document.getElementById('markdown-content').innerHTML = '<p>Error loading markdown.</p>';
}
})
.catch(error => {
console.error('Error fetching the markdown:', error);
document.getElementById('markdown-content').innerHTML = '<p>Failed to load markdown.</p>';
layer.msg('Failed to load markdown.', {icon: 5});
});
});
</script> -->
</body>
</html>