feat: 设置页新增登录管理 TAB
- Session 结构体新增 IP、UserAgent、Remark 字段,登录/注册时记录设备信息 - Store 接口新增 ListByUID、DeleteByUIDExclude 方法,MemoryStore 完整实现 - SessionManager 新增 ListByUID、DestroyOtherByUID、UpdateRemark 方法 - 新增 UA 轻量解析器(session/ua.go),提取浏览器/OS/设备类型 - 新增 settings_api_sessions.go,提供列表/踢出/一键踢出/备注 4 个 API - 控制器层声明 sessionManager 最小接口(ISP),SettingsController 注入依赖 - Auth 中间件注入 sid 到 gin context,支持识别当前会话 - 设置页左侧导航增加登录管理入口,tab 白名单新增 sessions - 前端实现设备列表展示(浏览器/OS/设备图标/IP/时间)、当前设备标识、备注输入、踢出按钮、一键踢出 - settings.css 新增会话管理全套样式及响应式适配
This commit is contained in:
@ -568,3 +568,200 @@ body {
|
||||
opacity: .6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* ---------- Session Management ---------- */
|
||||
.session-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.session-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 1rem;
|
||||
padding: 1.1rem 0;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.session-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.session-item.session-current {
|
||||
background: rgba(46, 204, 113, .04);
|
||||
margin: 0 -2rem;
|
||||
padding: 1.1rem 2rem;
|
||||
border-radius: 6px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.session-icon {
|
||||
flex-shrink: 0;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f5f7fa;
|
||||
border-radius: 10px;
|
||||
color: var(--color-text-light);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.session-current .session-icon {
|
||||
background: rgba(46, 204, 113, .1);
|
||||
color: #2ecc71;
|
||||
}
|
||||
|
||||
.session-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.session-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: .4rem;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: .3rem;
|
||||
}
|
||||
|
||||
.session-browser {
|
||||
font-size: .92rem;
|
||||
font-weight: 600;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.session-os {
|
||||
font-size: .85rem;
|
||||
color: var(--color-text-light);
|
||||
}
|
||||
|
||||
.session-badge {
|
||||
display: inline-block;
|
||||
padding: 1px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: .75rem;
|
||||
font-weight: 600;
|
||||
background: #e8f5e9;
|
||||
color: #2e7d32;
|
||||
margin-left: .2rem;
|
||||
}
|
||||
|
||||
.session-meta {
|
||||
display: flex;
|
||||
gap: .8rem;
|
||||
flex-wrap: wrap;
|
||||
font-size: .8rem;
|
||||
color: #aaa;
|
||||
margin-bottom: .5rem;
|
||||
}
|
||||
|
||||
.session-ip {
|
||||
font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
|
||||
font-size: .78rem;
|
||||
background: #f5f5f5;
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.session-remark-row {
|
||||
margin-top: .25rem;
|
||||
}
|
||||
|
||||
.session-remark-input {
|
||||
width: 100%;
|
||||
max-width: 320px;
|
||||
padding: .35rem .6rem;
|
||||
font-size: .82rem;
|
||||
font-family: inherit;
|
||||
color: var(--color-text);
|
||||
background: #f9fafb;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 5px;
|
||||
outline: none;
|
||||
transition: border-color .15s ease, box-shadow .15s ease;
|
||||
}
|
||||
|
||||
.session-remark-input:focus {
|
||||
border-color: var(--color-accent);
|
||||
box-shadow: 0 0 0 3px rgba(52, 152, 219, .15);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.session-remark-input[readonly] {
|
||||
background: transparent;
|
||||
border-color: transparent;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.session-remark-input[readonly]:focus {
|
||||
box-shadow: none;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.session-action {
|
||||
flex-shrink: 0;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.session-kick-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: .35rem .9rem;
|
||||
font-size: .82rem;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
color: #e74c3c;
|
||||
background: #fff5f5;
|
||||
border: 1px solid #fecaca;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: all .15s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.session-kick-btn:hover {
|
||||
background: #fee2e2;
|
||||
border-color: #e74c3c;
|
||||
}
|
||||
|
||||
.session-kick-btn:disabled {
|
||||
opacity: .5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.session-empty {
|
||||
text-align: center;
|
||||
padding: 2rem 0;
|
||||
color: #bbb;
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
/* ---------- Session Responsive ---------- */
|
||||
@media (max-width: 768px) {
|
||||
.session-item {
|
||||
flex-wrap: wrap;
|
||||
gap: .75rem;
|
||||
}
|
||||
|
||||
.session-item.session-current {
|
||||
margin: 0 -1.25rem;
|
||||
padding: 1.1rem 1.25rem;
|
||||
}
|
||||
|
||||
.session-action {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.session-kick-btn {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.session-remark-input {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user