You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
5.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>question</title>
<link rel="stylesheet" href="styles.css">
<style>
/* 其他样式保持不变 */
.login-button {
cursor: pointer; /* 将鼠标指针设置为点击状态 */
}
.sign-up-link {
cursor: pointer;
color: black;
font-size: 20px;
font-family: Inter;
font-weight: 500;
text-decoration: none; /* 去掉超链接的下划线 */
}
</style>
<script>
function redirectToPage() {
window.location.href = 'page.html'; //
}
</script>
</head>
<body>
<div style="width: device-width; height: 832px; position: relative; background: linear-gradient(90deg, rgba(231, 100, 42, 0.69) 0%, rgba(225.24, 187.68, 232.90, 0.69) 50%, rgba(21.28, 44.63, 169.15, 0.69) 100%)">
<div style="width: 479px; height: 322px; left: 15%; top: 94px; position: absolute">
<div style="width: 479px; height: 290px; left: 0px; top: 0px; position: absolute; background: rgba(217, 217, 217, 0.70); border-radius: 45px"></div>
<div style="left: 57px; top: 180px; position: absolute; color: black; font-size: 48px; font-family: Inter; font-weight: 500; word-wrap: break-word">学号</div>
<div id="pname" style="left: 150px; top: 180px; position: absolute; color: black; font-size: 48px; font-family: Inter; font-weight: 500; word-wrap: break-word"></div>
<div style="width: 96px; height: 264px; left: 57px; top: 60px; position: absolute; color: black; font-size: 48px; font-family: Inter; font-weight: 500; word-wrap: break-word">姓名</div>
<div id="pnum" style="width: 96px; height: 264px; left: 150px; top: 60px; position: absolute; color: black; font-size: 48px; font-family: Inter; font-weight: 500; word-wrap: break-word"></div>
<div style="width: 230px; height: 0px; left: 32%; top: 114px; position: absolute; border: 1px black solid"></div>
<div style="width: 230px; height: 0px; left: 32%; top: 236px; position: absolute; border: 1px black solid"></div>
</div>
<img style="width: 532px; height: 524px; left: 55%; top: 79px; position: absolute" src="E:\softwareengineer\work2\frontend\assets\d6.png" />
<div style="width: 477px; left: 58%; top: 635px; position: absolute; color: #F11E11; font-size: 48px; font-family: Inter; font-weight: 500; word-wrap: break-word">就是你了,我的盆友</div>
<div style="width: 438px; height: 200px; left: 16%; top: 416px; position: absolute; color: black; font-size: 30px; font-family: Inter; font-weight: 500; word-wrap: break-word">能够准确重复所提问的问题则加0.5分,否则加-1分准确回答问题根据情况加0.5-3分</div>
<form id="getgrade">
<div style="width: 480px; height: 100px; left: 25%; top: 580px; position: absolute">
<div class="input-container">
<label for="grade" style="left: 0px; top: -35px; position: absolute; color: black; font-size: 25px; font-family: Inter; font-weight: 500; word-wrap: break-word">请输入:</label>
<input type="text" id="grade" name="grade" style="width: 180px; height: 20px" required><br><br>
</div>
</div>
<button style="width: 282px; height: 56px; left: 22%; top: 650px; position: absolute;border-radius: 71px" type="submit">
<div style="width: 282px; height: 56px; left: 0px; top: 0px; position: absolute; background: linear-gradient(180deg, #152DA9 0%, #E7642A 100%); border-radius: 71px"></div>
<div style="width: 40px; height: 23px; left: 121px; top: 16.50px; position: absolute; color: white; font-size: 20px; font-family: Inter; font-weight: 500; word-wrap: break-word">确定</div>
</button>
</form>
</div>
<script>
// 获取标签和输入字段
var label = document.querySelector('.input-label');
var input = document.querySelector('.input-field');
fetch('/api/data')
.then(response => response.json())
.then(data =>
{
const pname = document.getElementById('name');
pname.innerHTML = `
<h2>${data.title}</h2>
<p>${data.description}</p>
`;
const pnum = document.getElementById('num');
pnum.innerHTML = `
<h2>${data.title}</h2>
<p>${data.description}</p>
`;
})
.catch(error => {
console.error('Error:',error);
});
// 为标签添加点击事件
label.addEventListener('click', function() {
// 点击标签时,聚焦到输入字段
input.focus();
});
document.getElementById('getgrade').addEventListener('submit', function(event) {
event.preventDefault(); // 阻止表单默认提交行为
const formData = {
grade: document.getElementById('grade').value,
};
fetch('/api/submit-grade', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
})
.then(response => response.json())
.then(data => {
console.log('Success:', data);
// 数据提交成功后跳转
window.location.href = 'E:\softwareengineer\work2\frontend\page.html';
})
.catch((error) => {
console.error('Error:', error);
// 数据提交失败时跳转
alert('上传失败!');
});
});
</script>
</body>
</html>