mirror of
https://github.com/RhenCloud/Cloud-Index.git
synced 2025-12-06 15:26:10 +08:00
refactor: 模块化前端代码 - 将 main.js 和 main.css 拆分为专用模块
- 移除 main.js 并替换为8个 JS 模块 - 移除 main.css 并替换为7个 CSS 模块 - 更新 base.html 以加载模块化文件 - 通过 index.css 保持完全向后兼容 - 改进代码组织、可维护性和可复用性
This commit is contained in:
339
static/css/modals.css
Normal file
339
static/css/modals.css
Normal file
@@ -0,0 +1,339 @@
|
||||
/**
|
||||
* 预览模态框和对话框样式
|
||||
*/
|
||||
|
||||
/* 预览模态框 */
|
||||
.preview-modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.9);
|
||||
z-index: 1000;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.preview-modal.show {
|
||||
display: flex;
|
||||
opacity: 1;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.preview-container {
|
||||
position: relative;
|
||||
max-width: 90%;
|
||||
max-height: 90%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.preview-content {
|
||||
max-width: 100%;
|
||||
max-height: 85vh;
|
||||
object-fit: contain;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
video.preview-content {
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.preview-controls {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
.preview-btn {
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
border: none;
|
||||
color: #333;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
font-size: 1.2em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s ease;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.preview-btn:hover {
|
||||
background-color: white;
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.preview-info {
|
||||
margin-top: 15px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
font-size: 0.95em;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
padding: 10px 20px;
|
||||
border-radius: 20px;
|
||||
max-width: 80%;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.preview-loading {
|
||||
color: white;
|
||||
font-size: 1.2em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.preview-error {
|
||||
color: #ff6b6b;
|
||||
font-size: 1.1em;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
/* 音频预览样式 */
|
||||
.preview-audio-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
border-radius: 12px;
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.preview-audio {
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* 文本预览样式 */
|
||||
.preview-text {
|
||||
background-color: rgba(255, 255, 255, 0.95);
|
||||
color: #2c3e50;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
max-width: 90vw;
|
||||
max-height: 85vh;
|
||||
overflow: auto;
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .preview-text {
|
||||
background-color: rgba(45, 45, 45, 0.95);
|
||||
color: #e1e1e1;
|
||||
}
|
||||
|
||||
/* 不支持预览的文件样式 */
|
||||
.preview-unsupported {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 60px 40px;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
border-radius: 12px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.preview-unsupported p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.preview-unsupported .action-link {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.preview-unsupported .action-link:hover {
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
border-color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.preview-container {
|
||||
max-width: 95%;
|
||||
}
|
||||
|
||||
.preview-controls {
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.preview-btn {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.preview-info {
|
||||
font-size: 0.85em;
|
||||
padding: 8px 15px;
|
||||
}
|
||||
|
||||
.preview-audio-wrapper {
|
||||
min-width: 300px;
|
||||
padding: 30px 20px;
|
||||
}
|
||||
|
||||
.preview-unsupported {
|
||||
min-width: 300px;
|
||||
padding: 40px 20px;
|
||||
}
|
||||
|
||||
.preview-text {
|
||||
font-size: 12px;
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 自定义对话框 */
|
||||
.app-dialog[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.app-dialog {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: rgba(0, 0, 0, 0.35);
|
||||
backdrop-filter: blur(2px);
|
||||
z-index: 1100;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.app-dialog.is-visible {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.app-dialog__backdrop {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
.app-dialog__panel {
|
||||
position: relative;
|
||||
background-color: var(--container-bg);
|
||||
color: var(--text-color);
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
|
||||
padding: 24px;
|
||||
min-width: 320px;
|
||||
max-width: min(420px, 90vw);
|
||||
transform: translateY(20px);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.app-dialog.is-visible .app-dialog__panel {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.app-dialog__title {
|
||||
margin: 0 0 12px;
|
||||
font-size: 1.15em;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.app-dialog__message {
|
||||
margin-bottom: 18px;
|
||||
line-height: 1.5;
|
||||
color: var(--text-color);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.app-dialog__input {
|
||||
margin-bottom: 18px;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.app-dialog__input input {
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--border-color);
|
||||
background-color: var(--container-bg);
|
||||
color: var(--text-color);
|
||||
font-size: 0.95em;
|
||||
box-sizing: border-box;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.app-dialog__input input::placeholder {
|
||||
color: var(--secondary-text);
|
||||
}
|
||||
|
||||
.app-dialog__input input:focus {
|
||||
outline: none;
|
||||
border-color: var(--link-color);
|
||||
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
|
||||
}
|
||||
|
||||
.app-dialog__actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.app-dialog__btn {
|
||||
padding: 8px 16px;
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 0.95em;
|
||||
transition: transform 0.15s ease, background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.app-dialog__btn:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.app-dialog__cancel {
|
||||
background-color: var(--hover-bg);
|
||||
color: var(--secondary-text);
|
||||
}
|
||||
|
||||
.app-dialog__cancel:hover {
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.app-dialog__confirm {
|
||||
background-color: var(--danger-color);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.app-dialog__confirm:hover {
|
||||
background-color: var(--danger-hover-color);
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.app-dialog__panel {
|
||||
width: calc(100vw - 40px);
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user