fix: 日志时区修复 + 日期选择器

- logger.ts: 使用 UTC+8 时区记录日志
- logs.ts: 统计使用 UTC+8 今日日期
- logs.vue: 日期选择器改用 picker 组件
- 移除未使用的 showDatePicker 变量
This commit is contained in:
2026-06-08 15:35:50 +08:00
parent fc3491742f
commit 3ce5ff4b65
3 changed files with 32 additions and 11 deletions

View File

@@ -53,10 +53,12 @@
<view class="query-section">
<view class="query-header">
<text class="section-title">日志查询</text>
<view class="date-picker" @tap="showDatePicker = true">
<Icon name="calendar" :size="28" color="#8B7E7E" />
<text class="date-text">{{ selectedDate }}</text>
</view>
<picker mode="date" :value="selectedDate" @change="onDateChange">
<view class="date-picker">
<Icon name="calendar" :size="28" color="#8B7E7E" />
<text class="date-text">{{ selectedDate }}</text>
</view>
</picker>
</view>
<!-- 筛选条件 -->
@@ -109,7 +111,6 @@ const logLines = ref<string[]>([])
const loading = ref(false)
const page = ref(1)
const total = ref(0)
const showDatePicker = ref(false)
const noMore = computed(() => logLines.value.length >= total.value && total.value > 0)
@@ -178,6 +179,12 @@ function selectDate(date: string) {
loadLogs()
}
function onDateChange(e: any) {
selectedDate.value = e.detail.value
page.value = 1
loadLogs()
}
function getBarWidth(count: number): number {
if (!stats.value) return 0
const max = Math.max(...stats.value.daily.map(d => d.total), 1)