{{ define "main" }}
<style>
/* 弹窗样式 */
.custom-popup {
width: 500px;
padding: 20px;
background-color: #e9f3fb;
border: 1px solid #ddd;
border-radius: 5px;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
text-align: center;
font-family: ipx;
color: #8aa2d3;
margin: 0 auto;
}
.custom-popup input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
.custom-popup button {
background-color: #34495e;
color: #fff;
border: none;
border-radius: 3px;
padding: 10px 20px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.custom-popup button:hover {
background-color: #465b70; /* 鼠标悬停时的背景颜色 */
}
/* 密码错误提示样式 */
.error-message {
color: red;
font-size: 14px;
margin-top: 10px;
}
body[data-theme='dark'] .overlay {
background-color: #2f3136; /* 黑夜模式下的背景颜色 */
}
body[data-theme='dark'] .custom-popup {
background-color: #1e1e1e; /* 黑夜模式下的背景颜色 */
color: #8aa2d3; /* 黑夜模式下的文字颜色 */
}
body[data-theme='dark'] .custom-popup button {
background-color: #2c3e50; /* 黑夜模式下的按钮背景颜色 */
}
body[data-theme='dark'] .custom-popup button:hover {
background-color: #34495e; /* 黑夜模式下按钮悬停时的背景颜色 */
}
</style>
<div class="custom-popup">
<h2>请输入页面认证密钥</h2>
<input type="password" id="password" placeholder="密码">
<button id="submit-button">开启</button>
<div class="error-message" id="error-message"></div> <!-- 密码错误提示 -->
</div>
<script>
var passwordInput = document.getElementById('password');
var submitButton = document.getElementById('submit-button');
var errorMessage = document.getElementById('error-message');
passwordInput.addEventListener('keyup', function(event) {
if (event.key === 'Enter') {
submitButton.click(); // 模拟点击提交按钮
}
});
submitButton.addEventListener('click', function() {
var inputPassword = passwordInput.value;
if (inputPassword === '密码1) {
window.location.href = '/跳转页面';
} else if (inputPassword === '密码2') {
window.location.href = '跳转页面';
} else {
errorMessage.textContent = '认证失败!'; // 显示错误提示
}
});
</script>
{{ end }}
#e9f3fb #ddd #8aa2d3 #ccc #34495e #fff #465b70 #2f3136 #1e1e1e #2c3e50
{{ define "main" }}
<style>
/* 弹窗样式 */
.custom-popup {
width: 500px;
padding: 20px;
background-color: #e9f3fb;
border: 1px solid #ddd;
border-radius: 5px;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
text-align: center;
font-family: ipx;
color: #8aa2d3;
margin: 0 auto;
}
.custom-popup input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
.custom-popup button {
background-color: #34495e;
color: #fff;
border: none;
border-radius: 3px;
padding: 10px 20px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.custom-popup button:hover {
background-color: #465b70; /* 鼠标悬停时的背景颜色 */
}
/* 密码错误提示样式 */
.error-message {
color: red;
font-size: 14px;
margin-top: 10px;
}
body[data-theme='dark'] .overlay {
background-color: #2f3136; /* 黑夜模式下的背景颜色 */
}
body[data-theme='dark'] .custom-popup {
background-color: #1e1e1e; /* 黑夜模式下的背景颜色 */
color: #8aa2d3; /* 黑夜模式下的文字颜色 */
}
body[data-theme='dark'] .custom-popup button {
background-color: #2c3e50; /* 黑夜模式下的按钮背景颜色 */
}
body[data-theme='dark'] .custom-popup button:hover {
background-color: #34495e; /* 黑夜模式下按钮悬停时的背景颜色 */
}
</style>
<div class="custom-popup">
<h2>请输入页面认证密钥</h2>
<input type="password" id="password" placeholder="密码">
<button id="submit-button">开启</button>
<div class="error-message" id="error-message"></div> <!-- 密码错误提示 -->
</div>
<script>
var passwordInput = document.getElementById('password');
var submitButton = document.getElementById('submit-button');
var errorMessage = document.getElementById('error-message');
passwordInput.addEventListener('keyup', function(event) {
if (event.key === 'Enter') {
submitButton.click(); // 模拟点击提交按钮
}
});
submitButton.addEventListener('click', function() {
var inputPassword = passwordInput.value;
if (inputPassword === '密码1) {
window.location.href = '/跳转页面';
} else if (inputPassword === '密码2') {
window.location.href = '跳转页面';
} else {
errorMessage.textContent = '认证失败!'; // 显示错误提示
}
});
</script>
{{ end }}
#e9f3fb #ddd #8aa2d3 #ccc #34495e #fff #465b70 #2f3136 #1e1e1e #2c3e50