style(课表小组件): 下拉选中态改品牌色(#5979ea/#eef2ff);表格限高 352px 只露 7 节、超出滚动、表头 sticky 常驻
build / build (push) Successful in 41s

- .cls-item.on 由 #2d8cf0/#f0f7ff 改为 var(--color-primary, #5979ea) / var(--color-primary-weak, #eef2ff),
  与 WsToastLayer.vue 既有约定一致(CSS 变量 + 回退值);hover 改 #f4f7ff
- 表格外套 .tt-scroll:max-height 352px(表头 44 + 7×44)+ overflow-y auto + 6px 细滚动条
- th 加 position sticky / top 0 / background #fff;因 sticky + border-collapse 会丢 cell border,
  分隔线由 border-bottom 改为 box-shadow inset 0 -1px 0 #e9edf1
This commit is contained in:
chenxing
2026-10-14 09:08:06 +08:00
parent 3a7502f106
commit 27ce68a76e
+46 -20
View File
@@ -34,22 +34,25 @@
</Teleport> </Teleport>
<div v-if="slots.length > 0" class="table-wrap"> <div v-if="slots.length > 0" class="table-wrap">
<table class="tt"> <!-- 超过 7 节(表头 44 + 7×44 = 352px)纵向滚动,表头 sticky 常驻 -->
<thead> <div class="tt-scroll">
<tr> <table class="tt">
<th>节</th> <thead>
<th v-for="day in dayCols" :key="day.index">{{ day.name }}</th> <tr>
</tr> <th>节</th>
</thead> <th v-for="day in dayCols" :key="day.index">{{ day.name }}</th>
<tbody> </tr>
<tr v-for="slot in slots" :key="slot.slotNo"> </thead>
<td class="sec">{{ cnNum(slot.slotNo) }}</td> <tbody>
<td v-for="day in dayCols" :key="day.index"> <tr v-for="slot in slots" :key="slot.slotNo">
<span class="sub" :title="subjectOf(slot, day.index)">{{ subjectOf(slot, day.index) }}</span> <td class="sec">{{ cnNum(slot.slotNo) }}</td>
</td> <td v-for="day in dayCols" :key="day.index">
</tr> <span class="sub" :title="subjectOf(slot, day.index)">{{ subjectOf(slot, day.index) }}</span>
</tbody> </td>
</table> </tr>
</tbody>
</table>
</div>
</div> </div>
<!-- 空态:模板内联 SVG,不依赖外部图片 / CSS 背景 --> <!-- 空态:模板内联 SVG,不依赖外部图片 / CSS 背景 -->
@@ -225,11 +228,11 @@ function reportHeight() {
white-space: nowrap; white-space: nowrap;
&:hover { &:hover {
background: #f5f8fb; background: #f4f7ff;
} }
&.on { &.on {
color: #2d8cf0; color: var(--color-primary, #5979ea);
background: #f0f7ff; background: var(--color-primary-weak, #eef2ff);
font-weight: 600; font-weight: 600;
} }
} }
@@ -240,6 +243,24 @@ function reportHeight() {
.table-wrap { .table-wrap {
padding: 8px 8px 10px; padding: 8px 8px 10px;
} }
/* 最多露出 7 节课(表头 44 + 7×44 = 352),再多则纵向滚动,表头 sticky 常驻 */
.tt-scroll {
max-height: 352px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #d5dbe3 transparent;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background: #d5dbe3;
border-radius: 3px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
}
.tt { .tt {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
@@ -255,7 +276,12 @@ function reportHeight() {
// 否则表头文字按基线对齐、偏上,视觉上像"贴住卡片 header" // 否则表头文字按基线对齐、偏上,视觉上像"贴住卡片 header"
vertical-align: middle; vertical-align: middle;
border: 0; border: 0;
border-bottom: 1px solid #e9edf1; // sticky + border-collapse 时 cell 的 border 会随滚动丢失 ⇒ 用 inset box-shadow 画分隔线
box-shadow: inset 0 -1px 0 #e9edf1;
position: sticky;
top: 0;
z-index: 1;
background: #fff;
} }
th:first-child, th:first-child,
td:first-child { td:first-child {