前端优化了点界面

main^2
QMZ 4 months ago
parent 6bd23e83a6
commit 9a6c7e45ce

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>模态框示例</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<style>
.modal {
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: #fff;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
</style>
</head>
<body>
<div id="app">
<button @click="tanchuang">创建房间</button>
<div class="modal" v-if="isModalVisible">
<div class="modal-content">
<span @click="closeModal" style="cursor:pointer; float:right;">&times;</span>
<h2>创建房间</h2>
<p>这里是房间创建的内容...</p>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data: {
isModalVisible : false
},
methods: {
tanchuang() {
this.isModalVisible = true; // 打开模态框
},
closeModal() {
this.isModalVisible = false; // 关闭模态框
}
}
});
</script>
</body>
</html>

@ -6,9 +6,10 @@
<title>课堂点名系统</title> <title>课堂点名系统</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script> <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<style> <style>
.move-button { .joinbutton {
margin-top: 300px; /* 向下移动 30 像素 */
margin-left: 200px; /* 向右移动 20 像素 */ border-radius: 15px;
} }
body { body {
font-family: 'Arial', sans-serif; font-family: 'Arial', sans-serif;
@ -17,18 +18,24 @@
padding: 20px; padding: 20px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center; /* 垂直居中 */
justify-content: center; /* 水平居中 */
height: 90vh; /* 使 body 高度占满视口 */
} }
h1 { h1 {
color: #333; color: #333;
margin-bottom: 20px; margin-bottom: 20px;
} }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"] { input[type="file"] {
margin-bottom: 10px; margin-bottom: 10px;
padding: 10px; padding: 10px;
border: 2px solid #007BFF; border: 2px solid #007BFF;
border-radius: 5px; border-radius: 20px;
width: 250px; width: 250px;
top
} }
button { button {
background-color: #020202; background-color: #020202;
@ -39,8 +46,6 @@
cursor: pointer; cursor: pointer;
margin: 5px; margin: 5px;
transition: background-color 0.3s; transition: background-color 0.3s;
margin-top: 20px; /* 向下移动 20 像素 */
margin: 5px 0;
} }
button:hover { button:hover {
background-color: #0056b3; background-color: #0056b3;
@ -55,22 +60,52 @@
text-align: center; text-align: center;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
} }
.modal {
position: fixed;
z-index: 1; /* 在最上层 */
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色背景 */
}
.modal-content {
background-color: #fff;
margin: 15% auto;
padding: 40px;
border: 1px solid #888;
width: 40%; /* 可以根据需要调整宽度 */
}
</style> </style>
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<h1>课堂点名系统</h1> <h1>课堂点名系统</h1>
<input type="text" placeholder="请输入房间号..." />
<div> <button class="joinbutton" @click="tanchuang">加入(创建)房间</button> </div>
<!-- 模态框 -->
<div class="modal" v-if="isModalVisible">
<div class="modal-content">
<span @click="closeModal" style="cursor:pointer; float:right;">&times;</span>
<h1>当前房间号没有被创建是否创建房间</h1>
<button @click="goToAboutPage">确认创建房间</button>
</div>
</div>
<button @click="goToAboutPage">创建房间</button>
<button @click="goToAboutPage">加入房间</button> <!-- 结束模态框 -->
<!-- <input type="file" id="fileInput" accept=".xlsx" @change="handleFileUpload" /> -->
</div> </div>
</div>
<script> <script>
new Vue({ new Vue({
el: '#app', el: '#app',
data: { data: {
result: '' isModalVisible:false,
isModalVisible2:false
}, },
methods: { methods: {
goToAboutPage() { goToAboutPage() {
@ -78,6 +113,19 @@
}, },
handleFileUpload(event) { handleFileUpload(event) {
// 这里可以添加处理文件上传的逻辑 // 这里可以添加处理文件上传的逻辑
},
tanchuang()
{
this.isModalVisible = true;
},
uploadFile() {
// 调用外部的 uploadFile 函数
uploadFile();
},
closeModal() {
this.isModalVisible = false; // 关闭模态框
} }
} }
}); });

@ -69,3 +69,5 @@ async function backpoints()
document.getElementById('result').innerText = `Selected: ${student.name} (ID: ${student.id}) (points: ${student.points})`; document.getElementById('result').innerText = `Selected: ${student.name} (ID: ${student.id}) (points: ${student.points})`;
} }

Loading…
Cancel
Save