Files
workspace/code/allapp/allapp-rn/test.html
T
2026-03-03 17:28:56 +08:00

130 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>加入其它空间 Demo</title>
<style>
body {
font-family: sans-serif;
background: #f5f6f8;
margin: 0;
padding: 0;
}
/* 页面列表项 */
.space-option {
padding: 16px;
background: #fff;
margin: 16px;
border-radius: 12px;
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.space-option:hover {
background: #f0f0f0;
}
/* modal 背景 */
.modal-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.4);
display: none;
justify-content: center;
align-items: center;
}
/* modal 内容 */
.modal {
background: #fff;
border-radius: 16px;
padding: 24px;
width: 90%;
max-width: 400px;
}
.modal h2 {
margin: 0 0 16px 0;
font-size: 20px;
color: #333;
}
.modal input {
width: 100%;
padding: 12px;
margin-bottom: 16px;
border-radius: 8px;
border: 1px solid #ccc;
font-size: 16px;
}
.modal button {
width: 100%;
padding: 12px;
border-radius: 8px;
border: none;
background: #333;
color: #fff;
font-size: 16px;
cursor: pointer;
margin-bottom: 8px;
}
.modal .scan-button {
background: #f0f0f0;
color: #333;
}
</style>
</head>
<body>
<!-- 加入其它空间选项 -->
<div class="space-option" id="joinSpaceBtn">
<span>加入其它空间</span>
<span>→</span>
</div>
<!-- Modal -->
<div class="modal-backdrop" id="modalBackdrop">
<div class="modal">
<h2>加入空间</h2>
<input type="text" placeholder="请输入邀请码" id="inviteInput" />
<button id="joinBtn">加入</button>
<button class="scan-button" id="scanBtn">扫码加入</button>
</div>
</div>
<script>
const joinBtnEl = document.getElementById('joinSpaceBtn');
const modalEl = document.getElementById('modalBackdrop');
joinBtnEl.addEventListener('click', () => {
modalEl.style.display = 'flex';
});
modalEl.addEventListener('click', (e) => {
if (e.target === modalEl) {
modalEl.style.display = 'none';
}
});
document.getElementById('joinBtn').addEventListener('click', () => {
const code = document.getElementById('inviteInput').value;
alert(`尝试加入空间:${code}`);
});
document.getElementById('scanBtn').addEventListener('click', () => {
alert('扫码功能触发(可接入扫码库)');
});
</script>
</body>
</html>