样式调整

This commit is contained in:
qweasdzxclm 2026-01-19 18:02:08 +08:00
parent b43219eacb
commit c0ac349a0f
11 changed files with 95 additions and 179 deletions

View File

@ -114,7 +114,6 @@
"lint-staged": "^15.2.2",
"postcss": "^8.4.35",
"postcss-html": "^1.6.0",
"postcss-pxtorem": "^6.1.0",
"postcss-scss": "^4.0.9",
"prettier": "^3.2.5",
"prettier-eslint": "^16.3.0",

View File

@ -1,15 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {},
'postcss-pxtorem': {
rootValue: 16, // 设计稿基准值1rem = 16px
unitPrecision: 5, // rem 的小数位数
propList: ['*'], // 需要转换的属性,* 表示所有属性
selectorBlackList: [], // 忽略的选择器,可以使用正则表达式
replace: true, // 是否替换而不是添加
mediaQuery: false, // 是否在媒体查询中转换 px
minPixelValue: 0, // 设置要替换的最小像素值0 表示所有值都转换
exclude: /node_modules/i // 排除 node_modules 目录
}
autoprefixer: {}
}
}

View File

@ -25,10 +25,6 @@ import '@/styles/index.scss'
// 引入动画
import '@/plugins/animate.css'
// 初始化 rem 移动端适配
import { initRem } from '@/utils/rem'
initRem()
// 路由
import router, { setupRouter } from '@/router'

View File

@ -535,6 +535,3 @@ export const subString = (str: string, start: number, end: number) => {
}
return str
}
// rem 移动端适配
export { initRem, getRem } from './rem'

View File

@ -1,65 +0,0 @@
/**
* rem
*
*/
// 设计稿基准宽度根据你的设计稿调整常见值375、750
const DESIGN_WIDTH = 375
// 基准字体大小(与 postcss.config.js 中的 rootValue 保持一致)
const BASE_FONT_SIZE = 16
/**
* rem
*/
function setRem() {
const docEl = document.documentElement
const width = docEl.clientWidth || window.innerWidth
// 计算根字体大小:屏幕宽度 / 设计稿宽度 * 基准字体大小
const rem = (width / DESIGN_WIDTH) * BASE_FONT_SIZE
// 设置根元素字体大小
docEl.style.fontSize = `${rem}px`
// 限制最大和最小字体大小(可选)
const maxRem = BASE_FONT_SIZE * 1.5 // 最大 24px
const minRem = BASE_FONT_SIZE * 0.8 // 最小 12.8px
if (rem > maxRem) {
docEl.style.fontSize = `${maxRem}px`
} else if (rem < minRem) {
docEl.style.fontSize = `${minRem}px`
}
}
/**
* rem
*/
export function initRem() {
// 初始设置
setRem()
// 监听窗口大小变化
window.addEventListener('resize', setRem)
// 监听屏幕方向变化(移动端横竖屏切换)
window.addEventListener('orientationchange', () => {
setTimeout(setRem, 100)
})
// 监听页面显示(处理浏览器标签页切换)
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
setRem()
}
})
}
/**
* rem
*/
export function getRem(): number {
const docEl = document.documentElement
const fontSize = window.getComputedStyle(docEl).fontSize
return parseFloat(fontSize)
}

View File

@ -4,7 +4,7 @@
<div class="stats-cards">
<div v-for="(card, index) in statsCards" :key="index" class="stat-card">
<div class="stat-card-icon" :class="`icon-${card.type}`">
<Icon :icon="card.icon" :size="20" />
<Icon :icon="card.icon" :size="24" />
</div>
<div class="stat-card-content">
<div class="stat-card-title">{{ card.title }}</div>
@ -25,7 +25,7 @@
<div class="chart-card">
<div class="chart-title">风险等级分布</div>
<div class="chart-content">
<EChart :options="riskDistributionOptions" :width="'100%'" :height="'300px'" />
<EChart :options="riskDistributionOptions" :height="'200px'" />
</div>
</div>
@ -33,7 +33,7 @@
<div class="chart-card">
<div class="chart-title">风险趋势图</div>
<div class="chart-content">
<EChart :options="riskTrendOptions" :height="'300px'" />
<EChart :options="riskTrendOptions" :height="'200px'" />
</div>
</div>
</div>
@ -165,7 +165,7 @@ const riskDistributionOptions = computed<EChartsOption>(() => ({
emphasis: {
label: {
show: true,
fontSize: 14,
fontSize: 12,
fontWeight: 'bold'
}
},
@ -185,7 +185,7 @@ const riskTrendOptions = computed<EChartsOption>(() => ({
},
legend: {
data: ['高危', '预警', '普通'],
bottom: 10
bottom: 0
},
grid: {
left: '3%',
@ -320,7 +320,7 @@ const handleView = (row: any) => {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
margin-bottom: 20px;
margin-bottom: 15px;
width: 100%;
box-sizing: border-box;
}
@ -347,14 +347,13 @@ const handleView = (row: any) => {
position: absolute;
top: 10px;
right: 0;
width: 20px;
height: 20px;
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 16px;
font-size: 28px;
&.icon-all {
background: #e6f4ff;
@ -384,26 +383,26 @@ const handleView = (row: any) => {
}
.stat-card-title {
font-size: 9px;
font-size: 14px;
color: #666;
margin-bottom: 8px;
margin-bottom: 6px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.stat-card-value {
font-size: 10px;
font-size: 16px;
font-weight: bold;
color: #333;
margin-bottom: 8px;
margin-bottom: 6px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.stat-card-subtitle {
font-size: 8px;
font-size: 14px;
color: #999;
white-space: nowrap;
overflow: hidden;
@ -426,25 +425,25 @@ const handleView = (row: any) => {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
margin-bottom: 20px;
margin-bottom: 15px;
}
.chart-card {
background: #ffffff;
border-radius: 8px;
padding: 20px;
padding: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.chart-title {
font-size: 11px;
font-size: 15px;
font-weight: bold;
color: #333;
margin-bottom: 16px;
}
.chart-content {
height: 250px;
height: 200px;
}
//
@ -456,14 +455,14 @@ const handleView = (row: any) => {
}
.table-title {
font-size: 11px;
font-size: 15px;
font-weight: bold;
color: #333;
margin-bottom: 16px;
}
:deep(.name-column) {
padding-left: 20px;
padding-left: 32px;
}
.new-tag {
@ -472,12 +471,11 @@ const handleView = (row: any) => {
top: 50%;
transform: translateY(-50%);
left: 0;
padding: 1px 3px;
padding: 2px 8px;
background: #1890ff;
color: #ffffff;
font-size: 9px;
border-radius: 2px;
margin-right: 8px;
font-size: 13px;
border-radius: 4px;
}
.risk-level {

View File

@ -272,23 +272,23 @@ onUnmounted(() => {
.prison-name {
position: fixed;
top: 12px;
top: 18px;
left: 50%;
transform: translateX(-48%);
transform: translateX(-50%);
color: white;
text-align: center;
width: 100%;
z-index: 1000;
font-size: 20px;
font-size: 26px;
font-weight: bold;
}
.current-time {
position: fixed;
top: 12px;
right: 32px;
right: 50px;
color: white;
font-size: 12px;
font-size: 16px;
z-index: 1000;
font-weight: 500;
}
@ -349,14 +349,14 @@ onUnmounted(() => {
background: #2d3d5f;
border: 1px solid rgba(56, 102, 141, 0.5);
display: flex;
padding-left: 10px;
padding-left: 18px;
justify-content: start;
align-items: center;
}
.list-card-item-icon {
width: 18px;
height: 18px;
width: 26px;
height: 26px;
margin-right: 10px;
}
.icon-location {
@ -376,7 +376,7 @@ onUnmounted(() => {
background-size: 100% 100%;
}
.list-card-item-value {
font-size: 10px;
font-size: 14px;
font-weight: bold;
color: #ffffff;
}
@ -403,7 +403,7 @@ onUnmounted(() => {
//
.info-card-item {
border-radius: 2px;
padding: 5px 10px;
padding: 18px 20px;
box-shadow: inset 0 0 15px 0 #2b4183;
border: 1px solid #2b4183;
display: flex;
@ -421,16 +421,16 @@ onUnmounted(() => {
}
.card-number {
font-size: 10px;
font-size: 14px;
font-weight: bold;
color: #ffffff;
line-height: 1.3;
margin-bottom: 6px;
margin-bottom: 10px;
white-space: nowrap;
}
.card-label {
font-size: 7px;
font-size: 10px;
color: rgba(255, 255, 255, 0.65);
line-height: 1.3;
white-space: nowrap;
@ -476,7 +476,7 @@ onUnmounted(() => {
justify-content: center;
align-items: center;
.dashboard-content-bottom-right-title {
font-size: 12px;
font-size: 14px;
font-weight: bold;
color: #ffffff;
margin-bottom: 12px;

View File

@ -260,16 +260,16 @@ if (props.remitData && props.remitData.length > 0) {
height: 100%;
display: flex;
flex-direction: column;
gap: 10px;
gap: 14px;
overflow: hidden;
border-radius: 8px;
padding: 12px 8px;
padding: 20px 16px;
border: 1px solid rgba(56, 102, 141, 0.3);
}
.consumption-records-title {
text-align: center;
font-size: 10px;
font-size: 14px;
font-weight: bold;
color: #ffffff;
}
@ -278,7 +278,7 @@ if (props.remitData && props.remitData.length > 0) {
width: 100%;
flex: 1;
display: flex;
gap: 16px;
gap: 20px;
overflow: hidden;
}
.consumption-records {
@ -292,15 +292,15 @@ if (props.remitData && props.remitData.length > 0) {
//
.records-header {
flex-shrink: 0;
padding: 8px;
padding: 14px;
background: #2c3d7e;
border-radius: 10px 10px 0 0;
border-radius: 14px 14px 0 0;
display: flex;
align-items: center;
}
.header-title {
font-size: 9px;
font-size: 13px;
font-weight: bold;
color: #ffffff;
}
@ -322,7 +322,7 @@ if (props.remitData && props.remitData.length > 0) {
.record-item {
display: grid;
grid-template-columns: 1.4fr 0.8fr 1fr 0.8fr;
padding: 2px 8px;
padding: 4px 10px;
border-bottom: 1px solid rgba(56, 102, 141, 0.15);
align-items: center;
@ -332,12 +332,12 @@ if (props.remitData && props.remitData.length > 0) {
}
.record-date {
font-size: 7px;
font-size: 11px;
color: rgba(255, 255, 255, 0.9);
}
.record-name {
font-size: 7px;
font-size: 11px;
font-weight: 500;
&.name-purple {
@ -366,12 +366,12 @@ if (props.remitData && props.remitData.length > 0) {
}
.record-category {
font-size: 7px;
font-size: 11px;
color: rgba(255, 255, 255, 0.9);
}
.record-amount {
font-size: 7px;
font-size: 11px;
font-weight: 500;
color: white;
text-align: right;
@ -382,7 +382,7 @@ if (props.remitData && props.remitData.length > 0) {
}
.relationship-item {
background: #422b1f;
padding: 4px 8px;
padding: 6px 10px;
border-radius: 4px;
display: flex;
align-items: center;
@ -410,8 +410,8 @@ if (props.remitData && props.remitData.length > 0) {
flex-shrink: 0;
margin-top: 1.5px;
svg {
width: 8px;
height: 9px;
width: 12px;
height: 13px;
}
&.icon-orange {
color: #ffa500;
@ -428,9 +428,9 @@ if (props.remitData && props.remitData.length > 0) {
}
.relationship-name {
font-size: 7px;
font-size: 11px;
}
.relationship-relate {
font-size: 7px;
font-size: 11px;
}
</style>

View File

@ -146,7 +146,7 @@ const props = withDefaults(
height: 100%;
background: rgba(13, 30, 50, 0.9);
border-radius: 10px;
padding: 4px 8px;
padding: 10px 16px;
gap: 24px;
border: 1px solid rgba(56, 102, 141, 0.3);
}
@ -164,18 +164,18 @@ const props = withDefaults(
.section-header {
display: flex;
align-items: center;
margin-bottom: 12px;
margin-bottom: 18px;
}
.header-title {
font-size: 8px;
font-size: 14px;
margin-right: 2px;
color: white;
}
.header-icon {
width: 12px;
height: 12px;
width: 18px;
height: 18px;
background: url('@/assets/imgs/dashboard/pie.svg') no-repeat center center;
background-size: 100% 100%;
}
@ -193,7 +193,7 @@ const props = withDefaults(
background: #3f6973;
border: 1px solid rgba(56, 102, 141, 0.5);
border-radius: 2px;
font-size: 5px;
font-size: 9px;
color: #d8f0ff;
white-space: nowrap;
}
@ -201,11 +201,11 @@ const props = withDefaults(
.info-detail {
display: flex;
gap: 2px;
margin-top: 8px;
margin-top: 18px;
}
.records-content-title {
font-size: 6px;
font-size: 10px;
color: #d8f0ff;
}
@ -218,7 +218,7 @@ const props = withDefaults(
.info-item {
display: flex;
align-items: center;
font-size: 6px;
font-size: 10px;
color: white;
}
@ -237,7 +237,7 @@ const props = withDefaults(
display: flex;
flex-direction: column;
gap: 2px;
height: 105px;
height: 150px;
overflow-y: auto;
&::-webkit-scrollbar {
display: none;
@ -251,8 +251,8 @@ const props = withDefaults(
}
.record-bullet {
width: 5px;
height: 5px;
width: 8px;
height: 8px;
border-radius: 50%;
background: #10a0f2;
flex-shrink: 0;
@ -266,7 +266,7 @@ const props = withDefaults(
left: 50%;
transform: translateX(-50%);
width: 2px;
height: calc(100% + 4px);
height: calc(100% + 14px);
background: rgba(56, 102, 141, 0.5);
}
}
@ -281,14 +281,14 @@ const props = withDefaults(
}
.record-date {
font-size: 6px;
font-size: 10px;
font-weight: 600;
color: white;
margin-bottom: 1px;
}
.record-text {
font-size: 6px;
font-size: 10px;
color: #d8f0ff;
}
</style>

View File

@ -119,7 +119,7 @@ if (props.data && props.data.length > 0) {
overflow: hidden;
border: 1px solid rgba(56, 102, 141, 0.5);
border-radius: 8px;
padding: 12px;
padding: 20px;
}
//
@ -128,11 +128,11 @@ if (props.data && props.data.length > 0) {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
margin-bottom: 14px;
}
.header-title {
font-size: 10px;
font-size: 14px;
font-weight: bold;
color: #ffffff;
}
@ -143,8 +143,8 @@ if (props.data && props.data.length > 0) {
}
.filter-tab {
padding: 2px 4px;
font-size: 7px;
padding: 4px 6px;
font-size: 11px;
color: rgba(255, 255, 255, 0.85);
background: rgba(56, 102, 141, 0.2);
border-radius: 2px;
@ -160,7 +160,7 @@ if (props.data && props.data.length > 0) {
flex: 1 1 0;
min-height: 0;
overflow-y: auto;
padding-left: 6px;
padding-left: 10px;
&::-webkit-scrollbar {
width: 0px;
@ -178,12 +178,13 @@ if (props.data && props.data.length > 0) {
left: -2px;
top: 0;
bottom: 0;
width: 1px;
width: 2px;
background: #5e7fef;
}
.timeline-items {
position: relative;
margin-left: 2px;
}
// 线
@ -191,17 +192,17 @@ if (props.data && props.data.length > 0) {
position: relative;
display: flex;
align-items: flex-start;
margin-bottom: 4px;
margin-bottom: 10px;
}
// 线
.timeline-dot {
position: absolute;
left: -5px;
left: -8px;
top: 50%;
transform: translateY(-50%);
width: 7px;
height: 7px;
width: 11px;
height: 11px;
border-radius: 50%;
border: 2px solid rgba(13, 30, 50, 0.8);
background: rgba(13, 30, 50, 0.8);
@ -224,11 +225,11 @@ if (props.data && props.data.length > 0) {
background: rgba(56, 102, 141, 0.15);
border: 1px solid rgba(56, 102, 141, 0.3);
border-radius: 2px;
padding: 4px 8px;
padding: 6px 14px;
}
.card-type {
font-size: 7px;
font-size: 11px;
font-weight: 500;
margin-bottom: 2px;
color: rgba(255, 255, 255, 0.9);
@ -243,7 +244,7 @@ if (props.data && props.data.length > 0) {
}
.card-description {
font-size: 5px;
font-size: 8px;
color: rgba(255, 255, 255, 0.7);
line-height: 1.4;
}

View File

@ -192,14 +192,14 @@ if (props.data && props.data.length > 0) {
}
.header-title {
font-size: 8px;
font-size: 14px;
margin-right: 2px;
color: white;
}
.header-icon {
width: 12px;
height: 12px;
width: 18px;
height: 18px;
background: url('@/assets/imgs/dashboard/pie.svg') no-repeat center center;
background-size: 100% 100%;
}
@ -218,11 +218,11 @@ if (props.data && props.data.length > 0) {
flex: 0 0 auto;
display: grid;
grid-template-columns: 1.5fr 1fr 1fr 1fr;
padding: 4px 2px;
padding: 10px 12px;
}
.header-cell {
font-size: 6px;
font-size: 11px;
color: rgba(255, 255, 255, 0.85);
font-weight: 500;
display: flex;
@ -232,8 +232,8 @@ if (props.data && props.data.length > 0) {
.required-star {
background: url('@/assets/imgs/dashboard/icon-require.svg') no-repeat center center;
background-size: 100% 100%;
width: 7px;
height: 7px;
width: 10px;
height: 10px;
margin-right: 2px;
}
@ -251,19 +251,19 @@ if (props.data && props.data.length > 0) {
.score-table-row {
display: grid;
grid-template-columns: 1.5fr 1fr 1fr 1fr;
padding: 2px;
padding: 4px 12px;
}
.row-icon {
background: url('@/assets/imgs/dashboard/icon-arrow.svg') no-repeat center center;
background-size: 100% 100%;
width: 7px;
height: 7px;
width: 10px;
height: 10px;
margin-right: 2px;
}
.row-cell {
font-size: 6px;
font-size: 11px;
color: #ffffff;
display: flex;
align-items: center;