|
|
@ -1,80 +1,78 @@
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>选择页面</title>
|
|
|
|
<title>选择页面</title>
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
body {
|
|
|
|
font-family: 'Arial', sans-serif;
|
|
|
|
font-family: 'Arial', sans-serif;
|
|
|
|
height: 100vh;
|
|
|
|
height: 100vh;
|
|
|
|
margin: 0;
|
|
|
|
margin: 0;
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
align-items: center;
|
|
|
|
background: linear-gradient(135deg, #6e45e2, #88d3ce);
|
|
|
|
background: linear-gradient(135deg, #6e45e2, #88d3ce);
|
|
|
|
color: white;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.container {
|
|
|
|
.container {
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
|
|
padding: 30px;
|
|
|
|
padding: 30px;
|
|
|
|
border-radius: 15px;
|
|
|
|
border-radius: 15px;
|
|
|
|
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
|
|
|
|
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#nameDisplay {
|
|
|
|
#nameDisplay {
|
|
|
|
font-size: 2.5em;
|
|
|
|
font-size: 2.5em;
|
|
|
|
margin-bottom: 30px;
|
|
|
|
margin-bottom: 30px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
button {
|
|
|
|
button {
|
|
|
|
padding: 12px 30px;
|
|
|
|
padding: 12px 30px;
|
|
|
|
font-size: 1.1em;
|
|
|
|
font-size: 1.1em;
|
|
|
|
border: none;
|
|
|
|
border: none;
|
|
|
|
border-radius: 50px;
|
|
|
|
border-radius: 50px;
|
|
|
|
background-color: #ff5722;
|
|
|
|
background-color: #ff5722;
|
|
|
|
color: white;
|
|
|
|
color: white;
|
|
|
|
cursor: pointer;
|
|
|
|
cursor: pointer;
|
|
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
|
|
transition: background-color 0.3s ease, box-shadow 0.3s ease;
|
|
|
|
transition: background-color 0.3s ease, box-shadow 0.3s ease;
|
|
|
|
margin: 10px;
|
|
|
|
margin: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
button:hover {
|
|
|
|
button:hover {
|
|
|
|
background-color: #ff3d00;
|
|
|
|
background-color: #ff3d00;
|
|
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
|
|
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="container">
|
|
|
|
<div class="container">
|
|
|
|
<div id="nameDisplay">欢迎, </div>
|
|
|
|
<div id="nameDisplay">欢迎, </div>
|
|
|
|
<button id="answerButton">老实回答问题</button>
|
|
|
|
<button id="answerButton">老实回答问题</button>
|
|
|
|
<button id="lotteryButton">消耗积分抽奖</button>
|
|
|
|
<button id="lotteryButton">消耗积分抽奖</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
// 获取URL中的参数(名字)
|
|
|
|
// 获取URL中的参数(名字)
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
const name = urlParams.get('name');
|
|
|
|
const name = urlParams.get('student_name');
|
|
|
|
|
|
|
|
const id = urlParams.get('student_id');
|
|
|
|
// 显示被抽中的名字
|
|
|
|
|
|
|
|
const nameDisplay = document.querySelector('#nameDisplay');
|
|
|
|
|
|
|
|
nameDisplay.textContent = ` ${name} 你的选择是:`;
|
|
|
|
// 显示被抽中的名字
|
|
|
|
// 初始化用户的积分
|
|
|
|
const nameDisplay = document.querySelector('#nameDisplay');
|
|
|
|
let userPoints = localStorage.getItem(name) ? parseInt(localStorage.getItem(name)) : 0;
|
|
|
|
nameDisplay.textContent = ` ${name} 你的选择是:`;
|
|
|
|
if (!localStorage.getItem(name)) {
|
|
|
|
|
|
|
|
localStorage.setItem(name, 0); // 如果没有积分记录,初始化为 0
|
|
|
|
// 回答问题功能,跳转到回答问题页面
|
|
|
|
}
|
|
|
|
document.querySelector('#answerButton').addEventListener('click', () => {
|
|
|
|
// 回答问题功能,跳转到回答问题页面
|
|
|
|
window.location.href = `answer.html?student_name=${encodeURIComponent(name)}&student_id=${encodeURIComponent(id)}`;
|
|
|
|
document.querySelector('#answerButton').addEventListener('click', () => {
|
|
|
|
});
|
|
|
|
window.location.href = `answer.html?name=${encodeURIComponent(name)}`;
|
|
|
|
|
|
|
|
});
|
|
|
|
// 抽奖功能,跳转到抽奖页面
|
|
|
|
|
|
|
|
document.querySelector('#lotteryButton').addEventListener('click', () => {
|
|
|
|
// 抽奖功能,跳转到抽奖页面
|
|
|
|
window.location.href = `lottery.html?student_name=${encodeURIComponent(name)}&student_id=${encodeURIComponent(id)}`;
|
|
|
|
document.querySelector('#lotteryButton').addEventListener('click', () => {
|
|
|
|
});
|
|
|
|
window.location.href = `lottery.html?name=${encodeURIComponent(name)}`;
|
|
|
|
</script>
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|
|
|
|
|
|
|
|