diff --git a/src/web/static/css/style.css b/src/web/static/css/style.css
index 0a69693..bd003c6 100644
--- a/src/web/static/css/style.css
+++ b/src/web/static/css/style.css
@@ -40,7 +40,7 @@
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
-/* 悬停提示样式 */
+/* 悬停提示样式 - 改为点击样式 */
.chess-item, .synergy-item {
cursor: pointer;
position: relative;
@@ -52,48 +52,160 @@
z-index: 5;
}
-/* 增强提示框样式 */
-#tft-tooltip {
- transition: all 0.3s ease;
- max-height: 80vh;
+/* 模态框样式 */
+#tft-modal-backdrop {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ background-color: rgba(0, 0, 0, 0.5);
+ z-index: 50;
+ display: none;
+ backdrop-filter: blur(2px);
+ animation: backdropFadeIn 0.3s ease;
+}
+
+#tft-modal-backdrop.open {
+ display: block;
+}
+
+#tft-modal {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ z-index: 51;
+ max-width: 90%;
+ width: 450px;
+ max-height: 85vh;
+ background-color: #1f2937;
+ border-radius: 0.5rem;
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
+ display: none;
+ overflow: hidden; /* 改为hidden,让滚动发生在内部容器 */
+ border: 1px solid rgba(99, 102, 241, 0.3);
+ animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
+ color: #f3f4f6; /* 设置模态框内默认文字颜色为浅灰色 */
+}
+
+#tft-modal.open {
+ display: block;
+}
+
+/* 模态框内部包装容器 */
+.modal-wrapper {
+ width: 100%;
+ height: 100%;
+ max-height: 85vh;
overflow-y: auto;
overflow-x: hidden;
- border: 1px solid rgba(99, 102, 241, 0.3);
- box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
- transform-origin: top left;
- animation: tooltipFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
scrollbar-width: thin;
scrollbar-color: rgba(79, 70, 229, 0.4) rgba(17, 24, 39, 0.2);
+ position: relative;
+}
+
+@keyframes backdropFadeIn {
+ from { opacity: 0; }
+ to { opacity: 1; }
+}
+
+@keyframes modalFadeIn {
+ from {
+ opacity: 0;
+ transform: translate(-50%, -48%) scale(0.96);
+ }
+ to {
+ opacity: 1;
+ transform: translate(-50%, -50%) scale(1);
+ }
}
/* 自定义滚动条样式 */
-#tft-tooltip::-webkit-scrollbar {
+.modal-wrapper::-webkit-scrollbar {
width: 6px;
}
-#tft-tooltip::-webkit-scrollbar-track {
+.modal-wrapper::-webkit-scrollbar-track {
background: rgba(17, 24, 39, 0.1);
border-radius: 3px;
}
-#tft-tooltip::-webkit-scrollbar-thumb {
+.modal-wrapper::-webkit-scrollbar-thumb {
background-color: rgba(79, 70, 229, 0.4);
border-radius: 3px;
transition: background-color 0.3s;
}
-#tft-tooltip::-webkit-scrollbar-thumb:hover {
+.modal-wrapper::-webkit-scrollbar-thumb:hover {
background-color: rgba(79, 70, 229, 0.6);
}
-/* 提示框内容淡入效果 */
-#tft-tooltip .tooltip-content {
+/* 仅在滚动时显示滚动条 */
+.modal-wrapper {
+ -ms-overflow-style: none; /* IE and Edge */
+ scrollbar-width: none; /* Firefox */
+}
+
+.modal-wrapper::-webkit-scrollbar {
+ width: 6px;
+ /* 初始隐藏滚动条 */
+ opacity: 0;
+ transition: opacity 0.3s ease;
+}
+
+.modal-wrapper:hover::-webkit-scrollbar,
+.modal-wrapper:focus::-webkit-scrollbar,
+.modal-wrapper:active::-webkit-scrollbar {
+ /* 悬停、聚焦或激活时显示滚动条 */
+ opacity: 1;
+}
+
+/* 解决模态框内容加载时可能导致的布局偏移 */
+.modal-content {
+ min-height: 150px; /* 设置最小高度,减少加载时的布局变化 */
+ position: relative;
+ /* 保持右侧边距一致,不管是否有滚动条 */
+ padding: 20px;
+ padding-right: 26px; /* 16px基础 + 10px给滚动条预留 */
+ box-sizing: border-box;
+}
+
+/* 模态框内容淡入效果 */
+#tft-modal .modal-content {
word-break: break-word;
opacity: 0;
animation: contentFadeIn 0.2s ease forwards;
animation-delay: 0.1s;
}
+/* 模态框中的标题和文本颜色 */
+#tft-modal .font-bold {
+ color: #ffffff;
+}
+
+#tft-modal .text-gray-800,
+#tft-modal .text-gray-700 {
+ color: #e5e7eb;
+}
+
+#tft-modal .text-gray-500,
+#tft-modal .text-gray-400 {
+ color: #9ca3af;
+}
+
+#tft-modal .text-indigo-300 {
+ color: #a5b4fc;
+}
+
+#tft-modal .bg-gray-700 {
+ background-color: #374151;
+}
+
+#tft-modal .bg-gray-600 {
+ background-color: #4b5563;
+}
+
@keyframes contentFadeIn {
from {
opacity: 0;
@@ -105,23 +217,12 @@
}
}
-@keyframes tooltipFadeIn {
- from {
- opacity: 0;
- transform: translateY(-5px) scale(0.97);
- }
- to {
- opacity: 1;
- transform: translateY(0) scale(1);
- }
-}
-
/* 提示框中的费用标识 */
-#tft-tooltip .cost-1 { border-left: 3px solid #94a3b8; } /* 1费 - 灰色 */
-#tft-tooltip .cost-2 { border-left: 3px solid #65a30d; } /* 2费 - 绿色 */
-#tft-tooltip .cost-3 { border-left: 3px solid #2563eb; } /* 3费 - 蓝色 */
-#tft-tooltip .cost-4 { border-left: 3px solid #7e22ce; } /* 4费 - 紫色 */
-#tft-tooltip .cost-5 { border-left: 3px solid #f59e0b; } /* 5费 - 金色 */
+#tft-modal .cost-1 { border-left: 3px solid #94a3b8; } /* 1费 - 灰色 */
+#tft-modal .cost-2 { border-left: 3px solid #65a30d; } /* 2费 - 绿色 */
+#tft-modal .cost-3 { border-left: 3px solid #2563eb; } /* 3费 - 蓝色 */
+#tft-modal .cost-4 { border-left: 3px solid #7e22ce; } /* 4费 - 紫色 */
+#tft-modal .cost-5 { border-left: 3px solid #f59e0b; } /* 5费 - 金色 */
/* 提示框内交互元素样式 */
.chess-item-mini, .synergy-item-mini {
@@ -147,34 +248,51 @@
border-radius: 2px;
}
-/* 提示框中的各部分样式 */
-#tft-tooltip .tooltip-content {
- word-break: break-word;
- padding-top: 5px;
- padding-right: 36px; /* 为右侧关闭按钮留出空间 */
-}
-
-/* 关闭按钮样式 */
-#tft-tooltip .tooltip-close-btn {
+/* 模态框关闭按钮样式 */
+#tft-modal .modal-close-btn {
+ position: absolute;
+ top: 12px;
+ right: 12px;
+ width: 36px;
+ height: 36px;
+ background-color: #374151;
+ color: #9ca3af;
+ border-radius: 9999px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
transition: all 0.2s ease;
opacity: 0.9;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
+ z-index: 2;
}
-#tft-tooltip .tooltip-close-btn:hover {
+#tft-modal .modal-close-btn:hover {
opacity: 1;
+ color: #ffffff;
+ background-color: #4b5563;
transform: scale(1.05);
}
+/* 模态框返回按钮样式 */
+#tft-modal .modal-back-btn {
+ background-color: #4f46e5;
+}
+
+#tft-modal .modal-back-btn:hover {
+ background-color: #4338ca;
+}
+
/* 特殊介绍文本样式 */
-#tft-tooltip .skill-introduce,
-#tft-tooltip .synergy-introduce {
+#tft-modal .skill-introduce,
+#tft-modal .synergy-introduce {
border-left: 3px solid rgba(79, 70, 229, 0.7);
background-color: rgba(79, 70, 229, 0.1);
padding-left: 8px;
}
-#tft-tooltip .loading-spinner {
+#tft-modal .loading-spinner {
opacity: 0.8;
}
@@ -249,121 +367,147 @@
border-radius: 4px;
}
-/* 移动设备上的提示框样式优化 */
+/* 模态框额外样式 - 文字颜色优化 */
+#tft-modal .text-sm {
+ color: #e5e7eb;
+}
+
+#tft-modal .text-xs {
+ color: #d1d5db;
+}
+
+#tft-modal .font-medium {
+ color: #f3f4f6;
+}
+
+#tft-modal .font-semibold {
+ color: #f9fafb;
+}
+
+/* 模态框中棋子列表项 */
+#tft-modal .chess-item-mini {
+ background-color: #374151;
+ border-radius: 4px;
+}
+
+#tft-modal .chess-item-mini .text-sm {
+ color: #f3f4f6;
+}
+
+/* 模态框中羁绊列表项 */
+#tft-modal .synergy-item-mini {
+ background-color: #374151;
+ border-radius: 4px;
+}
+
+#tft-modal .synergy-item-mini .text-sm {
+ color: #f3f4f6;
+}
+
+/* 移动端样式优化 */
@media (max-width: 768px) {
- #tft-tooltip {
- box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
- border: 1px solid rgba(99, 102, 241, 0.5);
- max-width: calc(100vw - 40px);
- animation: mobileTooltipFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
- max-height: 70vh;
- /* 固定位置在屏幕中央 */
- position: fixed;
- top: 50% !important;
- left: 50% !important;
- transform: translate(-50%, -50%);
- margin: 0 auto;
- width: calc(100vw - 40px) !important;
+ #tft-modal {
+ width: 95%;
+ max-height: 80vh;
}
-
- #tft-tooltip .tooltip-close-btn {
- width: 38px;
- height: 38px;
- top: 10px;
- right: 10px;
+
+ #tft-modal .modal-content {
+ padding: 16px;
}
-
- #tft-tooltip .tooltip-content {
- margin-top: 10px;
- padding-right: 20px;
- padding-bottom: 5px;
- }
-
- /* 增大移动端触摸目标大小 */
+
.chess-item-mini, .synergy-item-mini {
- padding: 12px;
- margin-bottom: 10px;
- position: relative;
- overflow: hidden;
- /* 增加右侧间距,避免文本与按钮重叠 */
- padding-right: 80px;
+ margin-bottom: 5px;
}
-
- /* 移动端使用更明显的交互提示 */
+
.chess-item-mini::after, .synergy-item-mini::after {
- content: '点击查看';
- position: absolute;
- top: 50%;
- right: 10px;
- transform: translateY(-50%);
- color: white;
- font-size: 10px;
- background-color: rgba(79, 70, 229, 0.5);
- padding: 3px 8px;
- border-radius: 10px;
- white-space: nowrap;
- z-index: 5;
+ display: none;
}
-
- /* 防止棋子费用与点击按钮重叠 */
+
+ /* 移动端字体和边距调整 */
+ #tft-modal .text-xs {
+ font-size: 0.7rem;
+ }
+
+ #tft-modal .text-sm {
+ font-size: 0.8rem;
+ }
+
+ #tft-modal .px-2 {
+ padding-left: 0.4rem;
+ padding-right: 0.4rem;
+ }
+
+ #tft-modal .py-1 {
+ padding-top: 0.2rem;
+ padding-bottom: 0.2rem;
+ }
+
+ /* 为移动端优化小标签 */
.chess-item-mini .text-xs.px-1\.5.py-0\.5.bg-gray-600.rounded {
- margin-right: 65px;
+ font-size: 0.65rem;
+ padding: 0.1rem 0.25rem;
}
-
- /* 防止羁绊类型与点击按钮重叠 */
+
.synergy-item-mini .bg-gray-600.text-xs.px-1\.5.py-0\.5.rounded {
- margin-right: 65px;
+ font-size: 0.65rem;
+ padding: 0.1rem 0.25rem;
}
-
- /* 移动端提示框内部元素间距优化 */
- #tft-tooltip .mb-2 {
- margin-bottom: 10px;
+
+ /* 移动端间距调整 */
+ #tft-modal .mb-2 {
+ margin-bottom: 0.4rem;
}
-
- #tft-tooltip .mb-3 {
- margin-bottom: 15px;
+
+ #tft-modal .mb-3 {
+ margin-bottom: 0.6rem;
}
-
- #tft-tooltip .p-2 {
- padding: 10px;
+
+ #tft-modal .p-2 {
+ padding: 0.4rem;
}
-
- /* 移动端动画效果 */
- @keyframes mobileTooltipFadeIn {
+
+ /* 移动端动画优化 */
+ @keyframes mobileModalFadeIn {
from {
opacity: 0;
- transform: translate(-50%, -45%);
+ transform: translate(-50%, -46%);
}
to {
opacity: 1;
transform: translate(-50%, -50%);
}
}
-
- /* 提示框内部滚动优化 */
- #tft-tooltip::-webkit-scrollbar {
- width: 5px;
+
+ #tft-modal {
+ animation: mobileModalFadeIn 0.25s ease;
}
-
- /* 移动端加载状态优化 */
- #tft-tooltip .loading-spinner .animate-spin {
- height: 45px;
- width: 45px;
- border-width: 3px;
+
+ /* 移动端滚动条优化 */
+ #tft-modal::-webkit-scrollbar {
+ width: 4px;
}
-
- #tft-tooltip .loading-spinner .text-xs {
- font-size: 12px;
- margin-top: 8px;
+
+ /* 移动端加载动画优化 */
+ #tft-modal .loading-spinner .animate-spin {
+ height: 8vw;
+ width: 8vw;
+ border-width: 2px;
+ margin-bottom: 0.3rem;
}
-
- /* 移动端表格布局优化 */
- #tft-tooltip .grid.grid-cols-2 {
+
+ #tft-modal .loading-spinner .text-xs {
+ font-size: 0.65rem;
+ }
+
+ /* 移动端网格布局优化 */
+ #tft-modal .grid.grid-cols-2 {
grid-template-columns: 1fr;
+ grid-gap: 0.3rem;
}
-
- /* 改进相关棋子列表显示 */
- #tft-tooltip .grid.grid-cols-2.gap-1.mt-1 {
- grid-template-columns: 1fr 1fr;
+
+ #tft-modal .grid.grid-cols-2.gap-1.mt-1 {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.3rem;
}
}
\ No newline at end of file
diff --git a/src/web/static/js/main.js b/src/web/static/js/main.js
index fb5fbb3..27d60dd 100644
--- a/src/web/static/js/main.js
+++ b/src/web/static/js/main.js
@@ -658,59 +658,57 @@ function toggleActiveChessVisibility(showOnlyActive) {
let tooltipHistory = [];
/**
- * 创建提示框
+ * 创建模态框
*/
function createTooltip() {
- // 如果已经存在提示框,不重复创建
- if ($('#tft-tooltip').length) {
- return;
- }
-
- const tooltip = $(`
-
- `);
-
- // 添加到页面
- $('body').append(tooltip);
+ // 已经在HTML中创建了模态框结构,不需要动态创建
+ // 为模态框按钮绑定事件
+ const modal = $('#tft-modal');
+ const modalBackdrop = $('#tft-modal-backdrop');
// 绑定关闭按钮事件
- tooltip.find('.tooltip-close-btn').on('click', function(e) {
+ modal.find('.modal-close-btn').on('click', function(e) {
e.stopPropagation();
- tooltip.addClass('hidden');
- currentHoveredId = null;
- $('.tooltip-active').removeClass('tooltip-active');
- // 重置历史记录
- tooltipHistory = [];
+ closeModal();
});
- // 防止点击提示框本身触发关闭
- tooltip.on('click', function(e) {
+ // 点击背景关闭模态框
+ modalBackdrop.on('click', function() {
+ closeModal();
+ });
+
+ // 防止点击模态框本身触发关闭
+ modal.on('click', function(e) {
e.stopPropagation();
});
}
/**
- * 显示提示的返回按钮(重构为返回功能)
- * @param {jQuery} tooltipContent 提示内容元素
+ * 关闭模态框
*/
-function showTooltipBackButton(tooltipContent) {
- const tooltip = tooltipContent.closest('#tft-tooltip');
+function closeModal() {
+ $('#tft-modal').removeClass('open');
+ $('#tft-modal-backdrop').removeClass('open');
+ currentHoveredId = null;
+ $('.tooltip-active').removeClass('tooltip-active');
+ // 重置历史记录
+ tooltipHistory = [];
+
+ // 重置滚动位置
+ setTimeout(() => {
+ $('.modal-wrapper').scrollTop(0);
+ }, 300); // 等待模态框关闭动画完成
+}
+
+/**
+ * 显示模态框的返回按钮(重构为返回功能)
+ * @param {jQuery} modalContent 模态框内容元素
+ */
+function showTooltipBackButton(modalContent) {
+ const modal = $('#tft-modal');
// 获取关闭按钮
- const closeButton = tooltip.find('.tooltip-close-btn');
+ const closeButton = modal.find('.modal-close-btn');
// 如果历史记录中有内容,则显示返回功能
if (tooltipHistory.length > 0) {
@@ -731,37 +729,44 @@ function showTooltipBackButton(tooltipContent) {
// 弹出上一个提示内容
const prevItem = tooltipHistory.pop();
if (prevItem) {
+ // 滚动到顶部
+ $('.modal-wrapper').scrollTop(0);
+
// 恢复ID和内容
currentHoveredId = prevItem.id;
- tooltipContent.html(prevItem.content);
- // 如果仍有历史记录,保持返回按钮
- if (tooltipHistory.length > 0) {
- showTooltipBackButton(tooltipContent);
- } else {
- // 没有更多历史,切换回关闭按钮
- resetCloseButton(closeButton, tooltip);
- }
-
- // 重新绑定事件处理程序
- bindTooltipInteractions(tooltipContent);
+ // 使用淡入效果显示内容
+ modalContent.fadeOut(100, function() {
+ $(this).html(prevItem.content).fadeIn(100);
+
+ // 如果仍有历史记录,保持返回按钮
+ if (tooltipHistory.length > 0) {
+ showTooltipBackButton(modalContent);
+ } else {
+ // 没有更多历史,切换回关闭按钮
+ resetCloseButton(closeButton);
+ }
+
+ // 重新绑定事件处理程序
+ bindTooltipInteractions(modalContent);
+ });
}
});
// 使用返回样式
- closeButton.removeClass('bg-gray-700 hover:bg-gray-600').addClass('bg-indigo-600 hover:bg-indigo-700');
+ closeButton.removeClass('bg-gray-700 hover:bg-gray-600')
+ .addClass('modal-back-btn');
} else {
// 没有历史,重置为关闭按钮
- resetCloseButton(closeButton, tooltip);
+ resetCloseButton(closeButton);
}
}
/**
* 重置为关闭按钮
* @param {jQuery} closeButton 按钮元素
- * @param {jQuery} tooltip 提示框元素
*/
-function resetCloseButton(closeButton, tooltip) {
+function resetCloseButton(closeButton) {
// 修改按钮图标为关闭图标
closeButton.html(`