Files
hsa/Html/apps/templates/saveindex.html
2025-08-27 19:39:38 +08:00

138 lines
5.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Code Development Platform</title>
<style>
</style>
<link rel="stylesheet" href="static/css/index.css">
<script>
document.cookie = "vscode-tkn=44edc269-6f88-46ab-9790-dc253f66ac36; path=/; SameSite=None; Secure";
</script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.1/socket.io.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="maxcontainer">
<!-- 左侧内容 -->
<div class="sidebar" id="leftSidebar" style="width: 20%;">
<h2>教材或题目</h2>
<p>这里是提供给学生的教材或题目后台提供给Agent针对不同教材题目的Prompt。</p>
<div id="markdown-content">
<!-- 动态加载的 HTML 会显示在这里 -->
</div>
</div>
<!-- 拖动条 -->
<div class="resizer" id="dragbar"></div>
<!-- 中间嵌入的Vscode-web窗口带有tkn参数 -->
<iframe src="http://127.0.0.1:9888/?workspace=/mnt/c/CAKE/vscode/example_folder&folder=/mnt/c/CAKE/vscode/example_folder" class="vscode-web" id="vscodeWeb" style="flex-grow: 1;"></iframe>
<!-- 拖动条 -->
<div class="resizer" id="dragbar2"></div>
<!-- 右侧内容 -->
<div class="sidebar" id="rightSidebar" >
<!-- 工具栏 -->
<div class="chatbox-header">
<!-- 字体大小调节滑块 -->
<div class="slider-container">
<label for="fontSizeSlider">Aa</label>
<input type="range" id="fontSizeSlider" min="12" max="24" value="16" />
</div>
<!-- 语言切换按钮 -->
<div class="language-toggle btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-outline-secondary active">
<input type="radio" name="language" id="english" autocomplete="off" checked> En
</label>
<label class="btn btn-outline-secondary">
<input type="radio" name="language" id="chinese" autocomplete="off"> Zn
</label>
</div>
</div>
<div class="chatbox" id="chatbox">
<!-- 消息会在这里显示 -->
</div>
<div class="input-area">
<textarea id="messageInput" rows="2" class="form-control" placeholder="输入你的消息 (支持 Markdown 语法)"></textarea>
<button class="btn btn-primary" onclick="sendMessage()">发送</button>
</div>
<!-- 聊天室js获取 -->
<script src="static/js/chatbox.js"></script>
</div>
</div>
<script>
// 实现左右边栏可拖动
const leftSidebar = document.getElementById('leftSidebar');
const rightSidebar = document.getElementById('rightSidebar');
const dragbar = document.getElementById('dragbar');
const dragbar2 = document.getElementById('dragbar2');
const vscodeWeb = document.getElementById('vscodeWeb');
let isDragging = false;
dragbar.addEventListener('mousedown', function(e) {
isDragging = true;
document.addEventListener('mousemove', resizeLeftSidebar);
});
dragbar2.addEventListener('mousedown', function(e) {
isDragging = true;
document.addEventListener('mousemove', resizeRightSidebar);
});
document.addEventListener('mouseup', function() {
isDragging = false;
document.removeEventListener('mousemove', resizeLeftSidebar);
document.removeEventListener('mousemove', resizeRightSidebar);
});
function resizeLeftSidebar(e) {
if (isDragging) {
let newWidth = e.clientX / window.innerWidth * 100;
leftSidebar.style.width = `${newWidth}%`;
vscodeWeb.style.flexGrow = 1;
}
}
function resizeRightSidebar(e) {
if (isDragging) {
let newWidth = (window.innerWidth - e.clientX) / window.innerWidth * 100;
rightSidebar.style.width = `${newWidth}%`;
vscodeWeb.style.flexGrow = 1;
}
}
// 动态加载 Markdown 文件
function loadMarkdown(filename) {
fetch(`/${filename}-markdown`)
.then(response => response.json())
.then(data => {
if (data.html_url) {
document.getElementById('markdown-content').innerHTML = `<iframe src="${data.html_url}" width="100%" height="600px"></iframe>`;
} else {
console.error('Markdown file not found');
}
})
.catch(error => {
console.error('Error loading markdown:', error);
});
}
window.onload = function() {
loadMarkdown('example');
};
</script>
</body>
</html>