Files
smart-project/h5/css/variables.css

706 lines
12 KiB
CSS

/* WeUI CDN - HTML 中直接引用,避免 @import 加载顺序问题 */
/* remixicon CDN 在 HTML 中直接引用 */
/* 智慧工地主题色 - 覆盖 WeUI 默认色 */
:root {
/* 主色 */
--color-primary: #1e3a5f;
--color-primary-light: #2d5a8a;
--color-secondary: #3b82f6;
/* 警示色 */
--color-danger: #f97316;
--color-warning: #eab308;
--color-success: #22c55e;
/* 中性色 */
--color-bg: #f8fafc;
--color-card: #ffffff;
--color-text: #1f2937;
--color-text-secondary: #6b7280;
--color-border: #e5e7eb;
/* 状态色 */
--color-online: #22c55e;
--color-offline: #9ca3af;
/* 字体 */
--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
--font-mono: 'SF Mono', 'Fira Code', Consolas, monospace;
}
/* ===== 全局覆盖 ===== */
body {
font-family: var(--font-family);
background-color: var(--color-bg);
color: var(--color-text);
-webkit-font-smoothing: antialiwebkit;
-webkit-tap-highlight-color: transparent;
}
/* ===== WeUI 变量覆盖 ===== */
.weui-cells {
margin-top: 0;
font-size: 14px;
}
.weui-cell {
padding: 14px 16px;
}
.weui-cells__title {
font-size: 13px;
color: var(--color-text-secondary);
padding: 12px 16px 6px;
}
.weui-btn {
font-size: 14px;
}
.weui-btn_primary {
background-color: var(--color-primary);
}
.weui-btn_primary:not(.weui-btn_disabled):active {
background-color: var(--color-primary-light);
}
.weui-btn_danger {
background-color: var(--color-danger);
}
.weui-btn_plain-primary {
color: var(--color-primary);
border-color: var(--color-primary);
}
.weui-tabbar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 50px;
background: var(--color-card);
border-top: 1px solid var(--color-border);
z-index: 200;
}
.weui-tabbar__item {
padding: 4px 0;
}
.weui-tabbar__icon {
width: 24px;
height: 24px;
font-size: 22px;
line-height: 1;
}
.weui-tabbar__label {
font-size: 10px;
line-height: 1.4;
}
.weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon,
.weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon > i {
color: var(--color-primary);
}
.weui-tabbar__item.weui-bar__item_on .weui-tabbar__label {
color: var(--color-primary);
}
/* ===== 顶栏 ===== */
.page-hd {
position: sticky;
top: 0;
z-index: 100;
background: var(--color-primary);
color: #fff;
padding: 12px 16px;
display: flex;
align-items: center;
justify-content: space-between;
}
.hd-title {
font-size: 16px;
font-weight: 600;
flex: 1;
text-align: center;
}
.hd-back {
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 20px;
text-decoration: none;
}
.hd-right {
width: 32px;
}
/* ===== 页面容器 ===== */
.page-bd {
padding-bottom: 60px;
}
.page-content {
padding: 12px;
}
/* ===== 统计卡片 ===== */
.stat-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
padding: 12px;
}
.stat-card {
background: var(--color-card);
border-radius: 8px;
padding: 16px;
text-align: center;
box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-label {
font-size: 12px;
color: var(--color-text-secondary);
margin-bottom: 4px;
}
.stat-value {
font-size: 28px;
font-weight: 700;
font-family: var(--font-mono);
line-height: 1.2;
}
.stat-sub {
font-size: 11px;
color: var(--color-text-secondary);
margin-top: 2px;
}
/* ===== 设备卡片网格 ===== */
.device-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
padding: 12px;
}
.device-card {
background: var(--color-card);
border-radius: 8px;
padding: 14px;
cursor: pointer;
text-decoration: none;
color: inherit;
display: block;
box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.device-card:active {
opacity: 0.85;
}
.device-card-hd {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.device-card-icon {
font-size: 24px;
line-height: 1;
}
.device-status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.device-status-dot.online { background: var(--color-online); }
.device-status-dot.offline { background: var(--color-offline); }
.device-name {
font-weight: 600;
font-size: 14px;
color: var(--color-text);
margin-bottom: 2px;
}
.device-model {
font-size: 12px;
color: var(--color-text-secondary);
}
.device-location {
font-size: 11px;
color: var(--color-text-secondary);
margin-top: 4px;
}
/* ===== 预警列表 ===== */
.alert-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
background: var(--color-card);
text-decoration: none;
color: inherit;
}
.alert-item:active {
background: var(--color-bg);
}
.alert-icon-wrap {
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
font-size: 16px;
}
.alert-icon-wrap.danger { background: #fff3e6; color: var(--color-danger); }
.alert-icon-wrap.warning { background: #fef9c3; color: var(--color-warning); }
.alert-icon-wrap.handled { background: #f3f4f6; color: var(--color-text-secondary); }
.alert-body { flex: 1; min-width: 0; }
.alert-title {
font-weight: 600;
font-size: 14px;
color: var(--color-text);
margin-bottom: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.alert-meta {
font-size: 12px;
color: var(--color-text-secondary);
}
/* ===== 子 Tab ===== */
.weui-tabs {
background: var(--color-card);
}
.weui-tabs__bar {
border-bottom: 1px solid var(--color-border);
}
.weui-tab {
position: relative;
padding: 10px 0;
font-size: 13px;
color: var(--color-text-secondary);
}
.weui-tab.active {
color: var(--color-primary);
}
.weui-tab.active::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 24px;
height: 2px;
background: var(--color-primary);
border-radius: 1px;
}
/* ===== 照片上传 ===== */
.photo-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
padding: 12px 16px;
}
.photo-item {
aspect-ratio: 1;
border-radius: 6px;
overflow: hidden;
background: var(--color-bg);
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.photo-item img {
width: 100%;
height: 100%;
object-fit: cover;
}
.photo-add {
border: 1px dashed var(--color-border);
color: var(--color-text-secondary);
font-size: 24px;
cursor: pointer;
}
.photo-remove {
position: absolute;
top: 2px;
right: 2px;
width: 18px;
height: 18px;
border-radius: 50%;
background: rgba(0,0,0,0.5);
color: #fff;
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
line-height: 1;
}
/* ===== GPS 栏 ===== */
.gps-bar {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 16px;
background: var(--color-bg);
border-radius: 6px;
font-size: 12px;
color: var(--color-text-secondary);
margin: 0 12px;
}
.gps-bar.active { color: var(--color-success); }
/* ===== 设备详情数据 ===== */
.data-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1px;
background: var(--color-border);
border-radius: 6px;
overflow: hidden;
}
.data-item {
background: var(--color-card);
padding: 12px;
text-align: center;
}
.data-label {
font-size: 12px;
color: var(--color-text-secondary);
margin-bottom: 4px;
}
.data-value {
font-size: 18px;
font-weight: 700;
font-family: var(--font-mono);
line-height: 1.2;
}
.data-unit {
font-size: 12px;
font-weight: 400;
color: var(--color-text-secondary);
}
.alert-banner {
background: #fff3e6;
border: 1px solid var(--color-danger);
border-radius: 6px;
padding: 10px 14px;
margin-top: 10px;
display: flex;
align-items: center;
gap: 8px;
color: var(--color-danger);
font-size: 13px;
}
.alert-banner.warning {
background: #fef9c3;
border-color: var(--color-warning);
color: var(--color-warning);
}
/* ===== 施工日志 ===== */
.log-item {
padding: 12px 16px;
background: var(--color-card);
border-bottom: 1px solid var(--color-border);
cursor: pointer;
text-decoration: none;
color: inherit;
display: block;
}
.log-item:active { background: var(--color-bg); }
.log-date {
font-size: 13px;
font-weight: 600;
color: var(--color-primary);
margin-bottom: 4px;
}
.log-content-preview {
font-size: 13px;
color: var(--color-text);
margin-bottom: 4px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.log-meta-row {
font-size: 11px;
color: var(--color-text-secondary);
}
/* ===== 悬浮写日志按钮 ===== */
.fab-write {
position: fixed;
right: 20px;
bottom: 70px;
width: 48px;
height: 48px;
border-radius: 50%;
background: var(--color-primary);
color: #fff;
font-size: 22px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(30,58,95,0.35);
z-index: 150;
text-decoration: none;
cursor: pointer;
border: none;
}
/* ===== 个人中心 ===== */
.profile-header {
text-align: center;
padding: 32px 16px;
background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
color: #fff;
}
.profile-avatar {
width: 64px;
height: 64px;
border-radius: 50%;
background: rgba(255,255,255,0.2);
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
margin: 0 auto 10px;
line-height: 1;
}
.profile-name {
font-size: 17px;
font-weight: 700;
margin-bottom: 2px;
}
.profile-role {
font-size: 13px;
opacity: 0.8;
}
/* ===== Toast ===== */
.toast-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9999;
pointer-events: none;
}
/* ===== 登录页 ===== */
.login-page {
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
padding: 24px;
background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}
.login-logo {
text-align: center;
margin-bottom: 32px;
}
.login-logo-icon {
font-size: 56px;
line-height: 1;
margin-bottom: 10px;
}
.login-logo-text {
font-size: 18px;
font-weight: 700;
color: #fff;
}
.login-card {
background: var(--color-card);
border-radius: 12px;
padding: 28px 20px;
box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.login-title {
font-size: 16px;
font-weight: 700;
text-align: center;
margin-bottom: 20px;
color: var(--color-text);
}
/* ===== 空状态 ===== */
.empty-state {
padding: 48px 20px;
text-align: center;
color: var(--color-text-secondary);
}
.empty-state-icon {
font-size: 48px;
line-height: 1;
margin-bottom: 10px;
opacity: 0.4;
}
.empty-state-text {
font-size: 14px;
}
/* ===== 工具类 ===== */
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-secondary { color: var(--color-text-secondary); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-primary { color: var(--color-primary); }
.font-bold { font-weight: 700; }
.hidden { display: none; }
/* ===== 预警详情页 ===== */
.alert-detail-header {
text-align: center;
padding: 32px 16px;
background: var(--color-card);
margin-bottom: 12px;
}
.alert-icon-wrap--lg {
width: 64px;
height: 64px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 12px;
font-size: 28px;
}
.alert-icon-wrap--lg.danger { background: #fff3e6; color: var(--color-danger); }
.alert-icon-wrap--lg.warning { background: #fef9c3; color: var(--color-warning); }
.alert-level-text {
font-size: 18px;
font-weight: 700;
margin-bottom: 8px;
}
.alert-level-text.danger { color: var(--color-danger); }
.alert-level-text.warning { color: var(--color-warning); }
.alert-message {
font-size: 15px;
color: var(--color-text);
line-height: 1.5;
padding: 0 16px;
}
/* ===== 信息网格 ===== */
.info-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1px;
background: var(--color-border);
border-radius: 6px;
overflow: hidden;
}
.info-grid-item {
background: var(--color-card);
padding: 14px 12px;
text-align: center;
}
.info-grid-label {
font-size: 12px;
color: var(--color-text-secondary);
margin-bottom: 4px;
}
.info-grid-value {
font-size: 14px;
font-weight: 600;
color: var(--color-text);
word-break: break-all;
}
/* ===== 处理操作区 ===== */
.action-area {
padding: 12px 16px;
}
.weui-btn-area {
margin-bottom: 12px;
}
.weui-btn-area .weui-btn {
margin-bottom: 10px;
}
.weui-btn-area .weui-btn:last-child {
margin-bottom: 0;
}