fix: 埋点统计和日志查询修复
- track.vue: 修复日期格式化(处理 ISO 格式) - track.vue: 筛选标签改为可滚动 - logs.ts: 修复 queryLogs 参数传递(移除 undefined date)
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
<text class="card-title">最近7天</text>
|
||||
<view class="daily-list">
|
||||
<view v-for="day in stats.daily" :key="day.date" class="daily-item">
|
||||
<text class="daily-date">{{ day.date.slice(5) }}</text>
|
||||
<text class="daily-date">{{ formatDate(day.date) }}</text>
|
||||
<view class="daily-bar">
|
||||
<view class="bar-fill" :style="{ width: getBarWidth(day.count) + '%' }"></view>
|
||||
</view>
|
||||
@@ -57,13 +57,14 @@
|
||||
<view class="query-section">
|
||||
<view class="query-header">
|
||||
<text class="section-title">事件记录</text>
|
||||
<view class="filter-tabs">
|
||||
<scroll-view class="filter-tabs" scroll-x>
|
||||
<view class="filter-tab" :class="{ active: !filterEvent }" @tap="filterEvent = ''">全部</view>
|
||||
<view class="filter-tab" :class="{ active: filterEvent === 'page_view' }" @tap="filterEvent = 'page_view'">页面</view>
|
||||
<view class="filter-tab" :class="{ active: filterEvent === 'action' }" @tap="filterEvent = 'action'">操作</view>
|
||||
<view class="filter-tab" :class="{ active: filterEvent === 'error' }" @tap="filterEvent = 'error'">错误</view>
|
||||
<view class="filter-tab" :class="{ active: filterEvent === 'api_error' }" @tap="filterEvent = 'api_error'">API错误</view>
|
||||
</view>
|
||||
<view class="filter-tab" :class="{ active: filterEvent === 'app_launch' }" @tap="filterEvent = 'app_launch'">启动</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<scroll-view class="event-record-list" scroll-y @scrolltolower="loadMore">
|
||||
@@ -187,6 +188,18 @@ function getEventClass(event: string): string {
|
||||
return 'page'
|
||||
}
|
||||
|
||||
/** 格式化日期(处理 MySQL DATE 类型的 ISO 格式) */
|
||||
function formatDate(dateStr: string): string {
|
||||
if (!dateStr) return ''
|
||||
// 处理 2026-06-08T00:00:00.000Z 格式
|
||||
const datePart = dateStr.split('T')[0]
|
||||
const parts = datePart.split('-')
|
||||
if (parts.length === 3) {
|
||||
return `${parseInt(parts[1])}/${parseInt(parts[2])}`
|
||||
}
|
||||
return dateStr
|
||||
}
|
||||
|
||||
function formatTime(dateStr: string): string {
|
||||
const d = new Date(dateStr)
|
||||
const now = new Date()
|
||||
@@ -371,7 +384,8 @@ function goBack() {
|
||||
.filter-tabs {
|
||||
display: flex;
|
||||
gap: $space-xs;
|
||||
flex-wrap: wrap;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.filter-tab {
|
||||
|
||||
Reference in New Issue
Block a user