feat: 右侧浮窗组件重写 — 4 种模块 + JS 动态渲染
All checks were successful
continuous-integration/drone/push Build is passing

新增文件:
- css/float-widget.css: 浮窗按钮/弹出面板/QQ列表/二维码样式
- js/float-widget.js: 4 种模块渲染 + 回到顶部 + 后台数据接口

修改文件:
- header.html: 引入新 CSS/JS
- public/header.html: 替换旧 aside-tools 为 float-widget 容器

模块类型:
1. QQ客服: hover 弹出 QQ 号列表+在线时间
2. 在线客服: 点击新标签页跳转
3. 群聊: hover 弹出二维码
4. 公众号: hover 弹出二维码

数据来源: window.__FLOAT_WIDGET_DATA__ (后台注入) 或 JS 内 demo 数据
This commit is contained in:
yiqiu
2026-03-18 22:06:15 +08:00
parent f96b967474
commit c4dd22ac10
4 changed files with 391 additions and 82 deletions

242
css/float-widget.css Normal file
View File

@@ -0,0 +1,242 @@
/* ============================================
右侧浮窗组件 — float-widget
============================================ */
.float-widget {
position: fixed;
right: 20px;
bottom: 100px;
z-index: 9998;
display: flex;
flex-direction: column;
gap: 6px;
}
/* 单个浮窗按钮 */
.fw-item {
position: relative;
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(14, 16, 26, 0.88);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 12px;
cursor: pointer;
transition: all 0.25s ease;
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
.fw-item:hover {
background: rgba(30, 41, 59, 0.95);
border-color: rgba(56, 189, 248, 0.15);
transform: translateX(-4px);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.fw-item svg {
width: 22px;
height: 22px;
opacity: 0.7;
transition: opacity 0.2s ease;
}
.fw-item:hover svg {
opacity: 1;
}
/* ---- 弹出面板 ---- */
.fw-popup {
position: absolute;
right: calc(100% + 12px);
top: 50%;
transform: translateY(-50%);
min-width: 200px;
background: rgba(14, 16, 26, 0.96);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 14px;
padding: 16px 20px;
opacity: 0;
visibility: hidden;
transition: all 0.2s ease;
pointer-events: none;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
white-space: nowrap;
}
/* 小三角 */
.fw-popup::after {
content: '';
position: absolute;
right: -6px;
top: 50%;
transform: translateY(-50%) rotate(45deg);
width: 10px;
height: 10px;
background: rgba(14, 16, 26, 0.96);
border-right: 1px solid rgba(255, 255, 255, 0.08);
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.fw-item:hover .fw-popup {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
/* 面板标题 */
.fw-popup-title {
font-size: 13px;
font-weight: 600;
color: rgba(226, 232, 240, 0.9);
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 6px;
}
.fw-popup-title svg {
width: 14px;
height: 14px;
opacity: 0.5;
}
/* ---- QQ 客服样式 ---- */
.fw-qq-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.fw-qq-entry {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
background: rgba(30, 41, 59, 0.3);
border-radius: 8px;
transition: background 0.2s ease;
}
.fw-qq-entry:hover {
background: rgba(30, 41, 59, 0.5);
}
.fw-qq-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: rgba(56, 189, 248, 0.1);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.fw-qq-avatar svg {
width: 18px;
height: 18px;
opacity: 0.6;
}
.fw-qq-info {
display: flex;
flex-direction: column;
gap: 2px;
}
.fw-qq-num {
font-size: 13px;
color: rgba(226, 232, 240, 0.85);
font-weight: 500;
}
.fw-qq-time {
font-size: 11px;
color: rgba(148, 163, 184, 0.5);
}
/* 在线状态点 */
.fw-qq-status {
width: 6px;
height: 6px;
border-radius: 50%;
background: #22C55E;
flex-shrink: 0;
box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}
/* ---- 二维码样式(群聊 / 公众号) ---- */
.fw-qr {
text-align: center;
}
.fw-qr img {
width: 140px;
height: 140px;
border-radius: 8px;
background: #fff;
padding: 6px;
margin-bottom: 8px;
}
.fw-qr-hint {
font-size: 11px;
color: rgba(148, 163, 184, 0.5);
}
/* ---- 在线客服 —— 无弹出框,直接跳转 ---- */
.fw-item[data-type="service"] .fw-popup {
padding: 10px 16px;
min-width: auto;
}
.fw-service-hint {
font-size: 12px;
color: rgba(226, 232, 240, 0.7);
}
/* ---- 回到顶部按钮融合 ---- */
.fw-back-top {
opacity: 0;
visibility: hidden;
transition: all 0.25s ease;
}
.fw-back-top.show {
opacity: 1;
visibility: visible;
}
.fw-back-top svg {
width: 18px;
height: 18px;
}
/* ---- 移动端 ---- */
@media (max-width: 768px) {
.float-widget {
right: 12px;
bottom: 80px;
gap: 4px;
}
.fw-item {
width: 38px;
height: 38px;
border-radius: 10px;
}
.fw-item svg {
width: 18px;
height: 18px;
}
.fw-popup {
display: none !important;
}
}