feat: 添加关闭按钮及其逻辑到邀请码验证弹窗
This commit is contained in:
@ -11,13 +11,14 @@ export function getInvitationModalContent(qrCodeUri?: string): string {
|
||||
<div id="invitationModal" class="invitation-modal" style="display: none;">
|
||||
<div class="invitation-modal-overlay"></div>
|
||||
<div class="invitation-modal-content">
|
||||
<button id="invitationCloseBtn" class="invitation-close-btn" title="关闭">×</button>
|
||||
<div class="invitation-modal-header">
|
||||
<h2>验证邀请码</h2>
|
||||
<p class="invitation-modal-subtitle">仅供企业端用户和内部人员使用</p>
|
||||
</div>
|
||||
<div class="invitation-modal-body">
|
||||
<div class="invitation-qrcode-section">
|
||||
<p class="invitation-qrcode-text">欢迎企业端用户扫码添加微信获取邀请码</p>
|
||||
<p class="invitation-qrcode-text">欢迎扫码添加微信获取邀请码</p>
|
||||
<img src="${qrCodeUri}" alt="微信二维码" class="invitation-qrcode-image" />
|
||||
</div>
|
||||
<div class="invitation-input-section">
|
||||
@ -80,6 +81,36 @@ export function getInvitationModalStyles(): string {
|
||||
animation: modalSlideIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.invitation-close-btn {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--vscode-foreground);
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
opacity: 0.6;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.invitation-close-btn:hover {
|
||||
opacity: 1;
|
||||
background: var(--vscode-toolbar-hoverBackground);
|
||||
}
|
||||
|
||||
.invitation-close-btn:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
@keyframes modalSlideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
@ -216,6 +247,7 @@ export function getInvitationModalScript(): string {
|
||||
const modal = document.getElementById('invitationModal');
|
||||
const input = document.getElementById('invitationCodeInput');
|
||||
const submitBtn = document.getElementById('invitationSubmitBtn');
|
||||
const closeBtn = document.getElementById('invitationCloseBtn');
|
||||
const errorDiv = document.getElementById('invitationError');
|
||||
|
||||
// 显示邀请码弹窗
|
||||
@ -270,6 +302,11 @@ export function getInvitationModalScript(): string {
|
||||
// 点击提交按钮
|
||||
submitBtn.addEventListener('click', submitInvitationCode);
|
||||
|
||||
// 点击关闭按钮
|
||||
closeBtn.addEventListener('click', function() {
|
||||
hideInvitationModal();
|
||||
});
|
||||
|
||||
// 回车键提交
|
||||
input.addEventListener('keypress', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
@ -277,6 +314,11 @@ export function getInvitationModalScript(): string {
|
||||
}
|
||||
});
|
||||
|
||||
// 点击遮罩层关闭弹窗
|
||||
document.querySelector('.invitation-modal-overlay').addEventListener('click', function() {
|
||||
hideInvitationModal();
|
||||
});
|
||||
|
||||
// 阻止点击弹窗内容时关闭
|
||||
document.querySelector('.invitation-modal-content').addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
Reference in New Issue
Block a user