fix: 扣分合计点击定位明细

This commit is contained in:
renshen 2026-11-05 21:43:14 +08:00
parent 155bfedc37
commit dbefb472c6
2 changed files with 24 additions and 1 deletions

View File

@ -193,6 +193,7 @@
border: 1px solid var(--vip-border, #D8D2C7);
border-radius: 8px;
background: var(--vip-surface, #fff);
scroll-margin-top: 5rem;
}
.log-statistics-panel__head {
@ -379,7 +380,7 @@
@endphp
<div class="log-statistics-cards">
@if ($hasWorklogPenalty)
<a class="log-statistics-card is-link" href="#worklog-penalty" title="点击查看扣分明细">
<a class="log-statistics-card is-link" href="#worklog-penalty" title="点击查看扣分明细" data-worklog-jump="worklog-penalty">
<span>{{ $worklogPenalty['start_date'] ?: '2026-11-04' }} 起扣分合计</span>
<strong>{{ $worklogPenalty['total_points_formatted'] }}</strong>
<span class="log-statistics-card__hint">点击查看扣分明细</span>
@ -554,4 +555,25 @@
@endif
</section>
@endif
<script>
(function () {
var link = document.querySelector('[data-worklog-jump="worklog-penalty"]');
var target = document.getElementById('worklog-penalty');
if (!link || !target) { return; }
target.setAttribute('tabindex', '-1');
link.addEventListener('click', function (event) {
event.preventDefault();
if (window.history && typeof window.history.replaceState === 'function') {
window.history.replaceState(null, '', '#worklog-penalty');
} else {
window.location.hash = 'worklog-penalty';
}
var reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
target.scrollIntoView({ behavior: reduceMotion ? 'auto' : 'smooth', block: 'start' });
target.focus({ preventScroll: true });
});
})();
</script>
</div>

View File

@ -179,6 +179,7 @@ class PagesTest extends FeatureTestCase
->assertSeeText('点击查看提交人')
->assertSeeText('点击查看日志明细')
->assertDontSeeText('点击查看每日统计')
->assertSee('data-worklog-jump="worklog-penalty"', false)
->assertSee('data-worklog-penalty', false)
->assertSeeText('2026-11-04 起扣分合计')
->assertSeeText('第 1 次漏写扣 10 分')