diff --git a/src/components/widgets/SyllabusWidget.vue b/src/components/widgets/SyllabusWidget.vue index e2b5d36..f8ddb4a 100644 --- a/src/components/widgets/SyllabusWidget.vue +++ b/src/components/widgets/SyllabusWidget.vue @@ -9,12 +9,12 @@ animated /> - @@ -75,7 +88,7 @@ const WEEK_NAMES = ["周一", "周二", "周三", "周四", "周五", "周六", const refRoot = ref(null); const loading = ref(true); -/** oapi data[]:每项一个班级(classId/className/timetable.slots…) */ +/** oapi data[]:每项一个班级(classId/className/gradeName/timetable.slots…) */ const classes = ref([]); const clsIdx = ref(0); const ddOpen = ref(false); @@ -83,14 +96,14 @@ let observer: ResizeObserver | null = null; const currentClass = computed(() => classes.value[clsIdx.value] || {}); -/** 节次行:按 slotNo 升序(R2:按接口实际返回渲染) */ +/** 节次行:按 slotNo 升序(按接口实际返回渲染) */ const slots = computed(() => { const list = currentClass.value && currentClass.value.timetable && currentClass.value.timetable.slots; if (!Array.isArray(list)) return []; return [...list].sort((a, b) => ((a && a.slotNo) || 0) - ((b && b.slotNo) || 0)); }); -/** 星期列:恒 周一~周五;周六/周日有课才追加(R3) */ +/** 星期列:恒 周一~周五;周六/周日有课才追加 */ const dayCols = computed(() => { const cols = [0, 1, 2, 3, 4]; if (slots.value.some(slot => subjectOf(slot, 5))) cols.push(5); @@ -98,6 +111,14 @@ const dayCols = computed(() => { return cols.map(index => ({ index, name: WEEK_NAMES[index] })); }); +/** 班级展示名 = 年级 + 班级(如「高一 1班」);无年级时退化为班级名 */ +function classLabel(cls: any): string { + if (!cls) return ""; + const grade = cls.gradeName ? String(cls.gradeName) : ""; + const name = cls.className ? String(cls.className) : ""; + return grade ? `${grade} ${name}` : name; +} + function subjectOf(slot: any, index: number): string { const arr = slot && slot.subjects; if (!Array.isArray(arr) || !arr[index]) return ""; @@ -212,46 +233,59 @@ function reportHeight() { } /* ---------- 课表 ---------- */ +/* ⚠️ 表格类名必须用私有名(tt):用 my-table 会命中全局 componets/_my_table.scss, + 带进 #c7c7c7 竖线与 th 灰底 ⇒「竖线明显 / 表头与卡头糊成一片 / 横线被压得看不见」 */ .table-wrap { - padding: 0 15px; + padding: 2px 15px 12px; } -.my-table { +.tt { width: 100%; border-collapse: collapse; + table-layout: fixed; + th { height: 44px; font-size: 13px; font-weight: 700; - color: #6e7c87; + color: #344449; text-align: center; + border: 0; + border-bottom: 1px solid #e9edf1; + } + th:first-child, + td:first-child { + width: 46px; } td { height: 52px; - border-top: 1px solid #f2f4f6; + border-bottom: 1px solid #eef1f4; padding: 4px 2px; text-align: center; font-size: 13px; vertical-align: middle; } + tr:last-child td { + border-bottom: 0; + } td.sec { color: #6e7c87; font-weight: 700; } - .cla { - color: #344449; - line-height: 1.35; - } - .sub { - color: #98a2b0; - line-height: 1.35; - font-size: 12px; - } } -/* 空态:沿用原版 no-data-box.svg(插画 + 转曲「暂无数据」文案)。 - 原版规则为 background-size:100px 100px(会压扁),此处取 100px auto 保比例。 */ -.no-data-box { - min-height: 130px; - background: url("../../assets/image/no-data-box.svg") no-repeat 50% 50%; - background-size: 100px auto; + +/* ---------- 空态(模板内联 SVG,不依赖外部图片 / CSS 背景) ---------- */ +.wg-empty { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 6px; + min-height: 132px; + padding: 16px 0 20px; + + .txt { + font-size: 12px; + color: #98a2b0; + } }