377 lines
8.9 KiB
CSS
377 lines
8.9 KiB
CSS
|
|
/* ===========================================================
|
|||
|
|
全局样式文件 (global.css)
|
|||
|
|
定义 CSS 变量、基础重置样式、通用工具类
|
|||
|
|
适用于整个竞赛报名系统前端项目
|
|||
|
|
=========================================================== */
|
|||
|
|
|
|||
|
|
/* ============ CSS 变量定义 ============ */
|
|||
|
|
:root {
|
|||
|
|
/* 主色调:深蓝色,用于导航栏、按钮等关键元素 */
|
|||
|
|
--primary-color: #1a3a5c;
|
|||
|
|
/* 辅助色:金色,用于强调、高亮、获奖标识等 */
|
|||
|
|
--accent-color: #c9a84c;
|
|||
|
|
/* 背景色:浅灰,用于页面整体背景 */
|
|||
|
|
--bg-color: #f5f6f8;
|
|||
|
|
/* 文字主色 */
|
|||
|
|
--text-color: #303133;
|
|||
|
|
/* 文字辅助色 */
|
|||
|
|
--text-secondary: #909399;
|
|||
|
|
/* 边框色 */
|
|||
|
|
--border-color: #dcdfe6;
|
|||
|
|
/* 成功色 */
|
|||
|
|
--success-color: #67c23a;
|
|||
|
|
/* 警告色 */
|
|||
|
|
--warning-color: #e6a23c;
|
|||
|
|
/* 危险色 */
|
|||
|
|
--danger-color: #f56c6c;
|
|||
|
|
/* 信息色 */
|
|||
|
|
--info-color: #909399;
|
|||
|
|
|
|||
|
|
/* 中文字体优先级 */
|
|||
|
|
--font-family: 'Noto Sans CJK SC', 'WenQuanYi Micro Hei', 'Microsoft YaHei',
|
|||
|
|
sans-serif;
|
|||
|
|
|
|||
|
|
/* 基础行高 */
|
|||
|
|
--line-height: 1.6;
|
|||
|
|
|
|||
|
|
/* Element Plus 主题色变量(防止 getThemeColors 解构 undefined 报错) */
|
|||
|
|
--el-color-primary: #1a3a5c;
|
|||
|
|
--el-color-primary-light-3: #4a6a8c;
|
|||
|
|
--el-color-primary-light-5: #7a9abc;
|
|||
|
|
--el-color-primary-light-7: #aacadc;
|
|||
|
|
--el-color-primary-light-8: #c5dae8;
|
|||
|
|
--el-color-primary-light-9: #e0eaf4;
|
|||
|
|
--el-color-primary-dark-2: #152e4a;
|
|||
|
|
--el-color-success: #67c23a;
|
|||
|
|
--el-color-warning: #e6a23c;
|
|||
|
|
--el-color-danger: #f56c6c;
|
|||
|
|
--el-color-error: #f56c6c;
|
|||
|
|
--el-color-info: #909399;
|
|||
|
|
--el-color-white: #ffffff;
|
|||
|
|
--el-color-black: #000000;
|
|||
|
|
--el-bg-color: #ffffff;
|
|||
|
|
--el-bg-color-page: #f5f6f8;
|
|||
|
|
--el-bg-color-overlay: #ffffff;
|
|||
|
|
--el-text-color-primary: #303133;
|
|||
|
|
--el-text-color-regular: #606266;
|
|||
|
|
--el-text-color-secondary: #909399;
|
|||
|
|
--el-text-color-placeholder: #a8abb2;
|
|||
|
|
--el-border-color: #dcdfe6;
|
|||
|
|
--el-border-color-light: #e4e7ed;
|
|||
|
|
--el-border-color-lighter: #ebeef5;
|
|||
|
|
--el-border-color-extra-light: #f2f6fc;
|
|||
|
|
--el-fill-color: #f0f2f5;
|
|||
|
|
--el-fill-color-light: #f5f7fa;
|
|||
|
|
--el-fill-color-blank: #ffffff;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* ============ 基础重置 ============ */
|
|||
|
|
|
|||
|
|
/* 全局盒模型重置:所有元素使用 border-box 计算宽高 */
|
|||
|
|
*,
|
|||
|
|
*::before,
|
|||
|
|
*::after {
|
|||
|
|
box-sizing: border-box;
|
|||
|
|
margin: 0;
|
|||
|
|
padding: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* HTML 根元素设置 */
|
|||
|
|
html {
|
|||
|
|
/* 平滑滚动效果 */
|
|||
|
|
scroll-behavior: smooth;
|
|||
|
|
/* 防止 iOS 弹性滚动导致的问题 */
|
|||
|
|
-webkit-overflow-scrolling: touch;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 页面主体样式 */
|
|||
|
|
body {
|
|||
|
|
/* 字体 */
|
|||
|
|
font-family: var(--font-family);
|
|||
|
|
/* 字号 */
|
|||
|
|
font-size: 14px;
|
|||
|
|
/* 字体颜色 */
|
|||
|
|
color: var(--text-color);
|
|||
|
|
/* 背景色 */
|
|||
|
|
background-color: var(--bg-color);
|
|||
|
|
/* 行高 */
|
|||
|
|
line-height: var(--line-height);
|
|||
|
|
/* 文本渲染优化 */
|
|||
|
|
-webkit-font-smoothing: antialiased;
|
|||
|
|
-moz-osx-font-smoothing: grayscale;
|
|||
|
|
/* 最小宽度 */
|
|||
|
|
min-width: 320px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 链接默认样式重置 */
|
|||
|
|
a {
|
|||
|
|
color: var(--primary-color);
|
|||
|
|
text-decoration: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
a:hover {
|
|||
|
|
color: var(--accent-color);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 图片默认样式 */
|
|||
|
|
img {
|
|||
|
|
max-width: 100%;
|
|||
|
|
height: auto;
|
|||
|
|
/* 去除图片底部间隙 */
|
|||
|
|
vertical-align: middle;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 列表样式重置 */
|
|||
|
|
ul,
|
|||
|
|
ol {
|
|||
|
|
list-style: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 表单元素字体继承 */
|
|||
|
|
input,
|
|||
|
|
button,
|
|||
|
|
textarea,
|
|||
|
|
select {
|
|||
|
|
font-family: inherit;
|
|||
|
|
font-size: inherit;
|
|||
|
|
line-height: inherit;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 清除 input 自动填充的背景色 */
|
|||
|
|
input:-webkit-autofill {
|
|||
|
|
-webkit-box-shadow: 0 0 0 1000px white inset !important;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* ============ 通用工具类 ============ */
|
|||
|
|
|
|||
|
|
/* 文字居中对齐 */
|
|||
|
|
.text-center {
|
|||
|
|
text-align: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 文字左对齐 */
|
|||
|
|
.text-left {
|
|||
|
|
text-align: left;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 文字右对齐 */
|
|||
|
|
.text-right {
|
|||
|
|
text-align: right;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 外边距工具类 - 顶部 */
|
|||
|
|
.mt-10 {
|
|||
|
|
margin-top: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.mt-20 {
|
|||
|
|
margin-top: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.mt-30 {
|
|||
|
|
margin-top: 30px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 外边距工具类 - 底部 */
|
|||
|
|
.mb-10 {
|
|||
|
|
margin-bottom: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.mb-20 {
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.mb-30 {
|
|||
|
|
margin-bottom: 30px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 外边距工具类 - 左侧 */
|
|||
|
|
.ml-10 {
|
|||
|
|
margin-left: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.ml-20 {
|
|||
|
|
margin-left: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 外边距工具类 - 右侧 */
|
|||
|
|
.mr-10 {
|
|||
|
|
margin-right: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.mr-20 {
|
|||
|
|
margin-right: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 内边距工具类 */
|
|||
|
|
.p-10 {
|
|||
|
|
padding: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.p-20 {
|
|||
|
|
padding: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.p-30 {
|
|||
|
|
padding: 30px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 弹性布局容器:水平排列 */
|
|||
|
|
.flex {
|
|||
|
|
display: flex;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 弹性布局 + 水平垂直居中 */
|
|||
|
|
.flex-center {
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: center;
|
|||
|
|
align-items: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 弹性布局 + 两端对齐(垂直居中) */
|
|||
|
|
.flex-between {
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
align-items: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 弹性布局 + 垂直方向 */
|
|||
|
|
.flex-column {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 弹性布局列居中 */
|
|||
|
|
.flex-column-center {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
justify-content: center;
|
|||
|
|
align-items: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 文字溢出省略(单行) */
|
|||
|
|
.text-ellipsis {
|
|||
|
|
overflow: hidden;
|
|||
|
|
text-overflow: ellipsis;
|
|||
|
|
white-space: nowrap;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 宽度工具类 */
|
|||
|
|
.w-full {
|
|||
|
|
width: 100%;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 隐藏元素 */
|
|||
|
|
.hidden {
|
|||
|
|
display: none;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 卡片容器通用样式 */
|
|||
|
|
.card {
|
|||
|
|
background: #fff;
|
|||
|
|
border-radius: 8px;
|
|||
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
|
|||
|
|
padding: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 页面标题通用样式 */
|
|||
|
|
.page-title {
|
|||
|
|
font-size: 24px;
|
|||
|
|
font-weight: 600;
|
|||
|
|
color: var(--primary-color);
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
padding-bottom: 12px;
|
|||
|
|
border-bottom: 2px solid var(--accent-color);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 内容区域包装器 */
|
|||
|
|
.content-wrapper {
|
|||
|
|
max-width: 1200px;
|
|||
|
|
margin: 0 auto;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* ============ 滚动条美化 ============ */
|
|||
|
|
|
|||
|
|
/* 整个滚动条 */
|
|||
|
|
::-webkit-scrollbar {
|
|||
|
|
width: 6px;
|
|||
|
|
height: 6px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 滚动条轨道 */
|
|||
|
|
::-webkit-scrollbar-track {
|
|||
|
|
background: transparent;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 滚动条滑块 */
|
|||
|
|
::-webkit-scrollbar-thumb {
|
|||
|
|
background-color: rgba(0, 0, 0, 0.15);
|
|||
|
|
border-radius: 3px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* 滚动条滑块悬停 */
|
|||
|
|
::-webkit-scrollbar-thumb:hover {
|
|||
|
|
background-color: rgba(0, 0, 0, 0.25);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* ============ Element Plus 图标+文字按钮居中对齐兜底 ============
|
|||
|
|
说明:Element Plus 会把按钮 slot 包进 .el-button__content 并设
|
|||
|
|
display:inline-flex;align-items:center,按规范图标与文字应垂直居中。
|
|||
|
|
但本项目的全局重置 button{line-height:inherit} 与部分组件 CSS 加载
|
|||
|
|
顺序可能导致个别环境下内部容器未正确居中(图标回退 baseline 对齐、
|
|||
|
|
文字显得偏高或偏左)。此处用 !important 强制按钮内部内容严格居中,
|
|||
|
|
并令 .el-button__content 占满按钮宽度,使 justify-content 真正生效。
|
|||
|
|
覆盖范围:全项目所有 .el-button(含 el-link 型“返回”链接)。 */
|
|||
|
|
.el-button,
|
|||
|
|
.el-button > span,
|
|||
|
|
.el-button .el-button__content {
|
|||
|
|
display: inline-flex !important;
|
|||
|
|
align-items: center !important;
|
|||
|
|
justify-content: center !important;
|
|||
|
|
}
|
|||
|
|
.el-button .el-button__content {
|
|||
|
|
width: 100% !important;
|
|||
|
|
}
|
|||
|
|
.el-button .el-icon {
|
|||
|
|
vertical-align: middle !important;
|
|||
|
|
flex-shrink: 0 !important;
|
|||
|
|
}
|
|||
|
|
.el-button .el-icon + span {
|
|||
|
|
margin-left: 6px !important;
|
|||
|
|
}
|
|||
|
|
.el-link,
|
|||
|
|
.el-link > span,
|
|||
|
|
.el-link .el-link__inner {
|
|||
|
|
display: inline-flex !important;
|
|||
|
|
align-items: center !important;
|
|||
|
|
justify-content: center !important;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/* ===========================================================
|
|||
|
|
文字型按钮 hover 态对比度保障(全局,根治「白底白字」)
|
|||
|
|
-----------------------------------------------------------
|
|||
|
|
根因(已取证):Element Plus 的规则为
|
|||
|
|
element-plus/dist/index.css:
|
|||
|
|
.el-button.is-text:not(.is-disabled):hover{background-color:var(--el-fill-color-light)}
|
|||
|
|
--el-fill-color-light:#f5f7fa ← 不透明的「近白」底
|
|||
|
|
该选择器有 4 个类级特异性,高于页面内 .back-btn:hover
|
|||
|
|
(1 个类 + scoped [data-v-x] = 2 个类级),因此必然胜出,导致两类不可读:
|
|||
|
|
① 页面自定义的「深色底 + 白字」hover:深色底被近白底压掉,
|
|||
|
|
白字留下 → 白底白字,完全不可读;
|
|||
|
|
已复现:选手工作台 Dashboard.vue「返回首页」。
|
|||
|
|
② 深色页头上的白字文字按钮(未自定义 hover 颜色):
|
|||
|
|
hover 时铺上近白底,白字同样不可读;
|
|||
|
|
已复现:管理后台 Admin.vue 顶栏「返回首页」(inline color 白色、无 hover 覆盖)。
|
|||
|
|
|
|||
|
|
全局对策:把「不透明浅色填充」换成「半透明中性底」。
|
|||
|
|
· 半透明 → 深色页头上呈轻微变亮、浅色页面上呈轻微变暗,
|
|||
|
|
始终与所在背景同色系,不会凭空造出与文字同色的实底;
|
|||
|
|
· 中性灰蓝 → 不引入新色相,不干扰各页面既有配色;
|
|||
|
|
· 仍保留清晰的 hover 反馈,不牺牲可感知性。
|
|||
|
|
本规则只改背景、不动文字颜色,故不会影响任何页面的文字配色设计。
|
|||
|
|
新增页面自动继承此保障,无需逐页排查。
|
|||
|
|
=========================================================== */
|
|||
|
|
.el-button.is-text:not(.is-disabled):hover,
|
|||
|
|
.el-button.is-text:not(.is-disabled):focus {
|
|||
|
|
background-color: rgba(120, 130, 145, 0.16);
|
|||
|
|
}
|