256 lines
7.6 KiB
HTML
256 lines
7.6 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Goalfy 邀请码申请</title>
|
||
<style>
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
body {
|
||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||
min-height: 100vh;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
padding: 20px;
|
||
}
|
||
|
||
.container {
|
||
background: white;
|
||
border-radius: 20px;
|
||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
|
||
padding: 40px;
|
||
width: 100%;
|
||
max-width: 500px;
|
||
}
|
||
|
||
.logo {
|
||
text-align: center;
|
||
margin-bottom: 30px;
|
||
}
|
||
|
||
.logo h1 {
|
||
color: #333;
|
||
font-size: 32px;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.logo p {
|
||
color: #666;
|
||
margin-top: 10px;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.form-group {
|
||
margin-bottom: 25px;
|
||
}
|
||
|
||
label {
|
||
display: block;
|
||
margin-bottom: 8px;
|
||
color: #333;
|
||
font-weight: 500;
|
||
font-size: 14px;
|
||
}
|
||
|
||
input[type="email"],
|
||
textarea {
|
||
width: 100%;
|
||
padding: 12px 15px;
|
||
border: 2px solid #e0e0e0;
|
||
border-radius: 10px;
|
||
font-size: 14px;
|
||
transition: all 0.3s;
|
||
font-family: inherit;
|
||
}
|
||
|
||
input[type="email"]:focus,
|
||
textarea:focus {
|
||
outline: none;
|
||
border-color: #667eea;
|
||
background-color: #f8f9ff;
|
||
}
|
||
|
||
textarea {
|
||
resize: vertical;
|
||
min-height: 100px;
|
||
}
|
||
|
||
.required {
|
||
color: #ff4757;
|
||
}
|
||
|
||
.btn-submit {
|
||
width: 100%;
|
||
padding: 14px;
|
||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||
color: white;
|
||
border: none;
|
||
border-radius: 10px;
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
cursor: pointer;
|
||
transition: transform 0.3s, box-shadow 0.3s;
|
||
}
|
||
|
||
.btn-submit:hover {
|
||
transform: translateY(-2px);
|
||
box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
|
||
}
|
||
|
||
.btn-submit:disabled {
|
||
opacity: 0.6;
|
||
cursor: not-allowed;
|
||
transform: none;
|
||
}
|
||
|
||
.message {
|
||
padding: 12px;
|
||
border-radius: 8px;
|
||
margin-bottom: 20px;
|
||
display: none;
|
||
}
|
||
|
||
.message.success {
|
||
background-color: #d4edda;
|
||
border: 1px solid #c3e6cb;
|
||
color: #155724;
|
||
}
|
||
|
||
.message.error {
|
||
background-color: #f8d7da;
|
||
border: 1px solid #f5c6cb;
|
||
color: #721c24;
|
||
}
|
||
|
||
.loading {
|
||
display: inline-block;
|
||
width: 16px;
|
||
height: 16px;
|
||
border: 3px solid rgba(255, 255, 255, 0.3);
|
||
border-radius: 50%;
|
||
border-top-color: white;
|
||
animation: spin 1s ease-in-out infinite;
|
||
margin-right: 8px;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
@keyframes spin {
|
||
to { transform: rotate(360deg); }
|
||
}
|
||
|
||
.info {
|
||
background: #f0f4ff;
|
||
border-left: 4px solid #667eea;
|
||
padding: 15px;
|
||
border-radius: 5px;
|
||
margin-bottom: 25px;
|
||
font-size: 13px;
|
||
color: #555;
|
||
line-height: 1.6;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<div class="logo">
|
||
<h1>Goalfy</h1>
|
||
<p>申请邀请码,开启 AI 编程之旅</p>
|
||
</div>
|
||
|
||
<div class="info">
|
||
<strong>温馨提示:</strong>我们将在 1-2 个工作日内审核您的申请。审核结果将通过邮件通知,请确保填写正确的邮箱地址。
|
||
</div>
|
||
|
||
<div id="message" class="message"></div>
|
||
|
||
<form id="applyForm">
|
||
<div class="form-group">
|
||
<label for="email">
|
||
邮箱地址 <span class="required">*</span>
|
||
</label>
|
||
<input type="email" id="email" name="email" required placeholder="请输入您的邮箱地址">
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label for="reason">
|
||
申请理由 <span style="color: #999;">(选填)</span>
|
||
</label>
|
||
<textarea id="reason" name="reason" placeholder="请简单描述您的申请理由,有助于我们更快审核"></textarea>
|
||
</div>
|
||
|
||
<button type="submit" class="btn-submit" id="submitBtn">
|
||
提交申请
|
||
</button>
|
||
</form>
|
||
</div>
|
||
|
||
<script>
|
||
// API配置
|
||
const API_BASE_URL = 'http://localhost:8080'; // 根据实际情况修改
|
||
|
||
document.getElementById('applyForm').addEventListener('submit', async (e) => {
|
||
e.preventDefault();
|
||
|
||
const email = document.getElementById('email').value;
|
||
const reason = document.getElementById('reason').value;
|
||
const submitBtn = document.getElementById('submitBtn');
|
||
const messageEl = document.getElementById('message');
|
||
|
||
// 显示加载状态
|
||
submitBtn.disabled = true;
|
||
submitBtn.innerHTML = '<span class="loading"></span>提交中...';
|
||
|
||
try {
|
||
const response = await fetch(`${API_BASE_URL}/api/public/invite-code/apply`, {
|
||
method: 'POST',
|
||
headers: {
|
||
'Content-Type': 'application/json',
|
||
},
|
||
body: JSON.stringify({
|
||
email: email,
|
||
reason: reason
|
||
})
|
||
});
|
||
|
||
const data = await response.json();
|
||
|
||
if (response.ok && data.code === 0) {
|
||
// 成功
|
||
messageEl.className = 'message success';
|
||
messageEl.textContent = data.message || '申请已提交成功!我们将在1-2个工作日内处理您的申请,审核结果将发送至您的邮箱。';
|
||
messageEl.style.display = 'block';
|
||
|
||
// 清空表单
|
||
document.getElementById('applyForm').reset();
|
||
|
||
// 3秒后隐藏成功消息
|
||
setTimeout(() => {
|
||
messageEl.style.display = 'none';
|
||
}, 5000);
|
||
} else {
|
||
// 失败
|
||
messageEl.className = 'message error';
|
||
messageEl.textContent = data.error || '申请提交失败,请稍后再试。';
|
||
messageEl.style.display = 'block';
|
||
}
|
||
} catch (error) {
|
||
console.error('Error:', error);
|
||
messageEl.className = 'message error';
|
||
messageEl.textContent = '网络错误,请检查网络连接后重试。';
|
||
messageEl.style.display = 'block';
|
||
} finally {
|
||
// 恢复按钮状态
|
||
submitBtn.disabled = false;
|
||
submitBtn.innerHTML = '提交申请';
|
||
}
|
||
});
|
||
</script>
|
||
</body>
|
||
</html> |