Files
smart_grid_iot/client/src/assets/styles/global.less
T
andyesfly ae79d5157b refactor(client): 优化页面多处细节与样式兼容性
1. 调整全局滚动条样式仅适配Firefox浏览器,修复Chrome下表头错位问题
2. 替换站点logo为Ant Design风格图标并优化样式
3. 重构客户拜访列表操作栏:合并详情按钮到下拉菜单,缩小操作列宽度
4. 优化操作按钮文本与主键判断逻辑,使用key替代文本匹配
2026-09-19 16:12:41 +08:00

314 lines
5.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 引入变量
@import "./variables.less";
// ==================== 全局重置 ====================
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: 14px;
line-height: 1.5715;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: @font-family;
color: @text-primary;
background-color: @bg-base;
line-height: @line-height-base;
}
// 链接
a {
color: @primary-color;
text-decoration: none;
transition: color @transition-fast;
&:hover {
color: @primary-color-hover;
}
}
// 图片
img {
max-width: 100%;
vertical-align: middle;
}
// 列表
ul,
ol {
list-style: none;
}
// ==================== 工具类 ====================
// 文本工具类
.text-center {
text-align: center;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-primary {
color: @text-primary !important;
}
.text-secondary {
color: @text-secondary !important;
}
.text-success {
color: @success-color !important;
}
.text-warning {
color: @warning-color !important;
}
.text-error {
color: @error-color !important;
}
.font-bold {
font-weight: @font-weight-bold;
}
.font-medium {
font-weight: @font-weight-medium;
}
// 间距工具类
.mt-xs {
margin-top: @spacing-xs;
}
.mt-sm {
margin-top: @spacing-sm;
}
.mt-md {
margin-top: @spacing-md;
}
.mt-lg {
margin-top: @spacing-lg;
}
.mt-xl {
margin-top: @spacing-xl;
}
.mb-xs {
margin-bottom: @spacing-xs;
}
.mb-sm {
margin-bottom: @spacing-sm;
}
.mb-md {
margin-bottom: @spacing-md;
}
.mb-lg {
margin-bottom: @spacing-lg;
}
.mb-xl {
margin-bottom: @spacing-xl;
}
.p-xs {
padding: @spacing-xs;
}
.p-sm {
padding: @spacing-sm;
}
.p-md {
padding: @spacing-md;
}
.p-lg {
padding: @spacing-lg;
}
.p-xl {
padding: @spacing-xl;
}
// Flex工具类
.flex {
display: flex;
}
.flex-center {
display: flex;
align-items: center;
justify-content: center;
}
.flex-between {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex-column {
flex-direction: column;
}
.flex-1 {
flex: 1;
}
// 显示/隐藏
.hidden {
display: none !important;
}
.visible {
visibility: visible;
}
.invisible {
visibility: hidden;
}
// 溢出控制
.overflow-hidden {
overflow: hidden;
}
.overflow-auto {
overflow: auto;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
// 光标
.cursor-pointer {
cursor: pointer;
}
.cursor-not-allowed {
cursor: not-allowed;
}
// ==================== 页面容器 ====================
.page-container {
padding: @content-padding;
min-height: calc(100vh - @header-height - @content-padding * 2);
}
.page-header {
margin-bottom: @spacing-lg;
h2 {
font-size: @font-size-xxl;
font-weight: @font-weight-semibold;
margin-bottom: @spacing-xs;
}
p {
color: @text-secondary;
}
}
// ==================== 卡片统一样式 ====================
.custom-card {
background: @bg-white;
border-radius: @border-radius-lg;
box-shadow: @shadow-base;
transition: box-shadow @transition-base;
&:hover {
box-shadow: @shadow-lg;
}
}
// ==================== 表格增强样式 ====================
.enhanced-table {
.ant-table-thead > tr > th {
background: #fafafa;
font-weight: @font-weight-semibold;
color: @text-primary;
}
.ant-table-tbody > tr:hover > td {
background: @bg-hover;
}
}
// ==================== 表单统一样式 ====================
.search-form {
background: @bg-white;
padding: @spacing-lg;
border-radius: @border-radius-lg;
margin-bottom: @spacing-md;
}
// ==================== 动画 ====================
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes slideInUp {
from {
transform: translateY(20px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.animate-fade-in {
animation: fadeIn 0.3s ease-out;
}
.animate-slide-up {
animation: slideInUp 0.3s ease-out;
}
// ==================== 滚动条美化(iOS 风格) ====================
// iOS 风格特征:极细(4px)、全圆角胶囊形、无轨道、半透明 thumb 悬浮在内容上
::-webkit-scrollbar {
width: 4px;
height: 4px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.2);
border-radius: 999px;
&:hover {
background: rgba(0, 0, 0, 0.35);
}
}
// 深色背景下的滚动条变体(侧边栏等)
.sider-inner ::-webkit-scrollbar-thumb,
.ant-layout-sider ::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.25);
}
.sider-inner ::-webkit-scrollbar-thumb:hover,
.ant-layout-sider ::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.4);
}
// Firefox 专用(Chrome/Edge 不支持 -moz-appearance,会忽略整块)
// 注意:Chrome 121+ 一旦设置 scrollbar-width,就会覆盖上面的 ::-webkit-scrollbar,
// 导致滚动条实际 10px 而 ::-webkit-scrollbar 仍报 4px,antd 据此计算固定列偏移会让表头与表体错位 6px
@supports (-moz-appearance: none) {
* {
scrollbar-width: thin;
scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}
}
// Firefox 深色变体
.sider-inner,
.ant-layout-sider {
scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}