Prechádzať zdrojové kódy

fix: 优化学习记录筛选控件细节

彭峰 2 mesiacov pred
rodič
commit
0aba3faf06

+ 1 - 1
src/app/features/study-records/study-records-page.component.html

@@ -1,6 +1,6 @@
 <section class="records-page">
   @if (meta.path === 'pages/his/his') {
-    <form class="filter-row" (change)="onFilterChange()">@if (session.groupId() === 3) { <label><span>学员</span><select name="student" [(ngModel)]="studentId"><option [ngValue]="0">选择学员</option>@for (student of students(); track studentValue(student) || $index) { <option [ngValue]="studentValue(student)">{{ studentName(student) }}</option> }</select></label> }<label class="date-filter"><span>日期</span><div class="date-picker-field"><button type="button" class="date-trigger" [class.placeholder]="!selectedDate" (click)="toggleDatePicker()"><b>{{ selectedDateLabel() }}</b><lucide-icon [img]="icons.CalendarDays" [size]="22" /></button>@if (datePickerOpen()) { <button type="button" class="date-picker-backdrop" aria-label="关闭日期选择" (click)="closeDatePicker()"></button><section class="date-picker-popover" aria-label="选择学习记录日期"><header><strong>{{ datePickerMonthLabel() }}</strong><nav><button type="button" aria-label="上个月" (click)="shiftDatePickerMonth(-1)"><lucide-icon [img]="icons.ChevronLeft" [size]="22" /></button><button type="button" aria-label="下个月" (click)="shiftDatePickerMonth(1)"><lucide-icon [img]="icons.ChevronRight" [size]="22" /></button></nav></header><div class="date-picker-weekdays" aria-hidden="true"><span>日</span><span>一</span><span>二</span><span>三</span><span>四</span><span>五</span><span>六</span></div><div class="date-picker-grid">@for (day of datePickerDays(); track day.date) { <button type="button" class="date-picker-day" [class.outside]="!day.inMonth" [class.today]="day.isToday" [class.selected]="selectedDate === day.date" [attr.aria-pressed]="selectedDate === day.date" (click)="selectDate(day.date)">{{ day.day }}</button> }</div><footer><button type="button" (click)="clearDate()">清除</button><button type="button" (click)="selectToday()">今天</button></footer></section> }</div></label></form>
+    <form class="filter-row" (change)="onFilterChange()">@if (session.groupId() === 3) { <label class="student-filter"><span>学员</span><select name="student" [(ngModel)]="studentId"><option [ngValue]="0">选择学员</option>@for (student of students(); track studentValue(student) || $index) { <option [ngValue]="studentValue(student)">{{ studentName(student) }}</option> }</select></label> }<label class="date-filter"><span>日期</span><div class="date-picker-field"><button type="button" class="date-trigger" [class.placeholder]="!selectedDate" (click)="toggleDatePicker()"><b>{{ selectedDateLabel() }}</b><lucide-icon [img]="icons.CalendarDays" [size]="22" /></button>@if (datePickerOpen()) { <button type="button" class="date-picker-backdrop" aria-label="关闭日期选择" (click)="closeDatePicker()"></button><section class="date-picker-popover" aria-label="选择学习记录日期"><header><strong>{{ datePickerMonthLabel() }}</strong><nav><button type="button" aria-label="上个月" (click)="shiftDatePickerMonth(-1)"><lucide-icon [img]="icons.ChevronLeft" [size]="22" /></button><button type="button" aria-label="下个月" (click)="shiftDatePickerMonth(1)"><lucide-icon [img]="icons.ChevronRight" [size]="22" /></button></nav></header><div class="date-picker-weekdays" aria-hidden="true"><span>日</span><span>一</span><span>二</span><span>三</span><span>四</span><span>五</span><span>六</span></div><div class="date-picker-grid">@for (day of datePickerDays(); track day.date) { <button type="button" class="date-picker-day" [class.outside]="!day.inMonth" [class.today]="day.isToday" [class.selected]="selectedDate === day.date" [attr.aria-pressed]="selectedDate === day.date" (click)="selectDate(day.date)">{{ day.day }}</button> }</div><footer><button type="button" (click)="clearDate()">清除</button><button type="button" (click)="selectToday()">今天</button></footer></section> }</div></label></form>
   }
   @if (meta.path === 'pages/his/his') {
     <section class="ai-reading-feature" aria-labelledby="ai-reading-title">

+ 12 - 9
src/app/features/study-records/study-records-page.component.scss

@@ -1,31 +1,34 @@
 :host { display: block; min-height: 100%; background: var(--surface-muted); }
 .records-page { min-height: 100%; }
-.filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 16px; background: white; border-bottom: 1px solid var(--line); gap: 10px; }
+.filter-row { display: grid; position: relative; z-index: 50; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 16px; background: white; border-bottom: 1px solid var(--line); gap: 10px; }
 .filter-row label { display: grid; gap: 5px; }
 .filter-row label:only-child { grid-column: 1 / -1; }
 .filter-row span { color: var(--ink-soft); font-size: 11px; }
-.filter-row :is(select, input) { width: 100%; min-height: 40px; padding: 7px 9px; background: white; border: 1px solid var(--line); border-radius: var(--radius-sm); }
+.filter-row :is(select, input) { width: 100%; height: 48px; padding: 0 14px; color: var(--ink); background-color: white; border: 1px solid var(--line); border-radius: var(--radius-md); font-size: 16px; font-weight: 750; }
+.student-filter { position: relative; }
+.student-filter select { padding-right: 44px; appearance: none; }
+.student-filter::after { content: ""; position: absolute; right: 19px; bottom: 19px; width: 8px; height: 8px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
 .date-filter { position: relative; }
 .date-picker-field { position: relative; }
-.date-trigger { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; padding: 0 14px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: var(--radius-md); }
+.date-trigger { display: flex; width: 100%; height: 48px; align-items: center; justify-content: space-between; padding: 0 14px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: var(--radius-md); }
 .date-trigger b { overflow: hidden; font-size: 16px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
-.date-trigger.placeholder b { color: var(--ink-faint); font-weight: 650; }
+.date-trigger.placeholder b { color: var(--ink-faint); }
 .date-trigger lucide-icon { color: var(--brand-strong); }
-.date-picker-backdrop { position: fixed; inset: 0; z-index: 29; background: transparent; border: 0; }
-.date-picker-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(520px, calc(100vw - 32px)); padding: 16px; background: white; border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); border-radius: 22px; box-shadow: 0 18px 44px rgb(15 84 70 / 18%); }
+.date-picker-backdrop { position: fixed; inset: 0; z-index: 999; background: transparent; border: 0; }
+.date-picker-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 1000; width: min(520px, calc(100vw - 32px)); padding: 16px; background: white; border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); border-radius: 22px; box-shadow: 0 18px 44px rgb(15 84 70 / 18%); }
 .date-picker-popover header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
 .date-picker-popover header strong { color: var(--ink); font-size: 18px; }
 .date-picker-popover nav { display: flex; align-items: center; gap: 8px; }
-.date-picker-popover nav button { display: grid; width: 42px; height: 42px; color: var(--brand-strong); background: var(--brand-pale); border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line)); border-radius: 999px; place-items: center; }
+.date-picker-popover nav button { display: grid; width: 42px; height: 42px; color: var(--brand-strong); background: var(--brand-pale); border: 0; border-radius: 999px; place-items: center; }
 .date-picker-weekdays, .date-picker-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
 .date-picker-weekdays { margin-bottom: 8px; }
 .date-picker-weekdays span { color: var(--ink-soft); font-size: 12px; font-weight: 700; text-align: center; }
 .date-picker-day { min-width: 0; height: 50px; color: var(--ink); background: var(--surface-muted); border: 1px solid transparent; border-radius: 16px; font: inherit; font-size: 16px; font-weight: 750; cursor: pointer; }
 .date-picker-day.outside { color: var(--ink-faint); background: transparent; }
 .date-picker-day.today { color: var(--brand-strong); border-color: color-mix(in srgb, var(--brand) 38%, var(--line)); }
-.date-picker-day.selected { color: white; background: linear-gradient(135deg, var(--brand-strong), var(--brand)); border-color: var(--brand-strong); box-shadow: 0 8px 18px rgb(20 126 96 / 25%); }
+.date-picker-day.selected { color: white; background: var(--brand-strong); border-color: var(--brand-strong); }
 .date-picker-popover footer { display: flex; justify-content: space-between; margin-top: 14px; }
-.date-picker-popover footer button { min-height: 38px; padding: 0 14px; color: var(--brand-strong); background: var(--brand-pale); border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line)); border-radius: 999px; font-size: 13px; font-weight: 750; }
+.date-picker-popover footer button { min-height: 38px; padding: 0 14px; color: var(--brand-strong); background: var(--brand-pale); border: 0; border-radius: 999px; font-size: 13px; font-weight: 750; }
 .record-tabs { display: grid; grid-template-columns: 1fr 1fr; background: white; border-bottom: 1px solid var(--line); }
 .record-tabs button { min-height: 46px; color: var(--ink-soft); background: transparent; border: 0; border-bottom: 2px solid transparent; }
 .record-tabs button.active { color: var(--brand-strong); border-bottom-color: var(--brand-strong); }