Compare commits

...

2 Commits

Author SHA1 Message Date
JenniferW 363b3c998e 整体布局优化 2025-09-08 15:58:14 +08:00
JenniferW 9e8a9d518d 数据开放样式优化 2025-09-08 15:51:04 +08:00
3 changed files with 95 additions and 52 deletions

View File

@ -6,6 +6,30 @@
:key="index" :key="index"
class="ranking-item" class="ranking-item"
> >
<!-- 计算实际排名处理扩展列表的情况 -->
<div class="rank-item">
<template v-if="isTopThree(index)">
<img
v-if="getRealIndex(index) === 0"
src="@/assets/first.png"
alt="第一名"
class="rank-image"
/>
<img
v-if="getRealIndex(index) === 1"
src="@/assets/second.png"
alt="第二名"
class="rank-image"
/>
<img
v-else-if="getRealIndex(index) === 2"
src="@/assets/third.png"
alt="第三名"
class="rank-image"
/>
</template>
<div v-else class="rank-number">{{ getRealIndex(index) + 1 }}</div>
</div>
<span class="item-name">{{ item.name }}</span> <span class="item-name">{{ item.name }}</span>
<span class="item-count">{{ item.count }}</span> <span class="item-count">{{ item.count }}</span>
</li> </li>
@ -35,7 +59,7 @@ export default {
return { return {
scrollTimer: null, scrollTimer: null,
currentPosition: 0, currentPosition: 0,
itemHeight: 0, // itemHeight: 0,
}; };
}, },
computed: { computed: {
@ -47,7 +71,6 @@ export default {
}, },
}, },
mounted() { mounted() {
// DOM
this.$nextTick(() => { this.$nextTick(() => {
this.calculateItemHeight(); this.calculateItemHeight();
if (this.list.length > this.visibleCount) { if (this.list.length > this.visibleCount) {
@ -69,12 +92,10 @@ export default {
} }
}, },
methods: { methods: {
//
calculateItemHeight() { calculateItemHeight() {
const firstItem = this.$refs.rankingList?.querySelector(".ranking-item"); const firstItem = this.$refs.rankingList?.querySelector(".ranking-item");
if (firstItem) { if (firstItem) {
this.itemHeight = firstItem.offsetHeight; this.itemHeight = firstItem.offsetHeight;
//
this.$el.style.height = `${this.itemHeight * this.visibleCount}px`; this.$el.style.height = `${this.itemHeight * this.visibleCount}px`;
} }
}, },
@ -101,7 +122,6 @@ export default {
}px)`; }px)`;
rankingList.style.transition = "transform 0.5s ease"; rankingList.style.transition = "transform 0.5s ease";
//
if (this.currentPosition >= this.list.length) { if (this.currentPosition >= this.list.length) {
setTimeout(() => { setTimeout(() => {
this.currentPosition = 0; this.currentPosition = 0;
@ -110,6 +130,15 @@ export default {
}, 500); }, 500);
} }
}, },
//
getRealIndex(index) {
return index % this.list.length;
},
//
isTopThree(index) {
const realIndex = this.getRealIndex(index);
return realIndex < 3;
},
}, },
}; };
</script> </script>
@ -130,11 +159,12 @@ export default {
.ranking-item { .ranking-item {
display: flex; display: flex;
align-items: center;
justify-content: space-between; justify-content: space-between;
font-size: 13px; font-size: 16px;
color: rgba(255, 255, 255, 0.8); color: rgba(255, 255, 255, 0.9);
transition: all 0.3s ease; transition: all 0.3s ease;
padding: 6px 0; /* 增加内边距使条目高度更合适 */ padding: 6px 0;
&:hover { &:hover {
color: #fff; color: #fff;
@ -142,14 +172,46 @@ export default {
} }
} }
.rank-item {
margin-right: 8px;
display: flex;
align-items: center;
justify-content: center;
}
.rank-image {
width: 16px;
height: 16px;
object-fit: contain;
}
.rank-number {
width: 16px;
height: 16px;
border-radius: 3px;
background-color: rgba(74, 144, 226, 0.3);
color: #fff;
font-size: 11px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
.item-name { .item-name {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 70%; flex: 1;
margin-right: 10px;
} }
.item-count { .item-count {
font-weight: 500; font-weight: 500;
min-width: 40px;
text-align: right;
background: #17f5f8;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
} }
</style> </style>

View File

@ -38,14 +38,14 @@
<OpenShare class="component-container" /> <OpenShare class="component-container" />
</div> </div>
<!-- 3. 第三行数据仓库内容较多+ 数据质量检测左右布局 --> <!-- 3. 第三行数据仓库内容较多 -->
<div class="dashboard-row third-row"> <div class="dashboard-row third-row">
<div class="dashboard-col left-col"> <DataWarehouse class="component-container" />
<DataWarehouse class="component-container" /> </div>
</div>
<div class="dashboard-col right-col"> <!-- 4. 第四行数据源 -->
<DataQuality class="component-container" /> <div class="dashboard-row fourth-row">
</div> <DataQuality class="component-container" />
</div> </div>
</div> </div>
</div> </div>
@ -137,21 +137,9 @@ export default {
// //
&.first-row, &.first-row,
&.second-row { &.second-row,
width: 100%;
}
//
&.third-row { &.third-row {
flex-direction: row; width: 100%;
gap: 20px;
.dashboard-col {
flex: 1; //
display: flex;
flex-direction: column;
gap: 12px;
}
} }
} }

View File

@ -29,7 +29,7 @@
</div> </div>
<div class="stat-item"> <div class="stat-item">
<span class="stat-label">调用异常接口数</span> <span class="stat-label">调用异常接口数</span>
<span class="stat-value">1</span> <span class="stat-value abnormal">1</span>
</div> </div>
</div> </div>
</div> </div>
@ -201,34 +201,33 @@ export default {
.share-stats { .share-stats {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 15px;
width: 100%; width: 100%;
} }
.stat-item { .stat-item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
background: rgba(74, 144, 226, 0.1); align-items: center;
padding: 12px 10px; padding: 10px;
border-radius: 8px; border-radius: 8px;
transition: all 0.3s ease; transition: all 0.3s ease;
&:hover {
background: rgba(74, 144, 226, 0.2);
box-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}
.stat-label { .stat-label {
font-size: 13px; font-size: 16px;
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.9);
display: block; display: block;
margin-bottom: 6px;
} }
.stat-value { .stat-value {
font-size: 18px; font-size: 32px;
font-weight: bold; font-weight: bold;
background: linear-gradient(to top, #4a90e2, #fff); background: #17f5f8;
font-style: italic;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.abnormal {
background: #dd7149;
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
} }
@ -236,21 +235,15 @@ export default {
// //
.chart-item { .chart-item {
background: rgba(74, 144, 226, 0.1); padding: 10px;
padding: 12px 10px;
border-radius: 8px; border-radius: 8px;
transition: all 0.3s ease; transition: all 0.3s ease;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
&:hover {
background: rgba(74, 144, 226, 0.2);
box-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}
.chart-title { .chart-title {
font-size: 14px; font-size: 18px;
color: #fff; color: #fff;
margin-bottom: 10px; margin-bottom: 10px;
text-shadow: 0 0 3px rgba(74, 144, 226, 0.5); text-shadow: 0 0 3px rgba(74, 144, 226, 0.5);