数据分析ui补充完善,接入数据库
This commit is contained in:
@@ -265,6 +265,7 @@ import { ref, onMounted, computed } from 'vue'
|
||||
import supa from '@/components/supadb/aksupainstance.uts'
|
||||
import AnalyticsSidebarMenu from '@/components/analytics/AnalyticsSidebarMenu.uvue'
|
||||
import type { UserType } from '@/types/mall-types'
|
||||
import { formatTime } from '@/utils/utils.uts'
|
||||
|
||||
import type { RecentReport, OverviewData, ReportCounts, TodayInsights, TrendDatum } from '@/types/analytics/profile.uts'
|
||||
|
||||
@@ -607,20 +608,7 @@ function getReportStatusText(status: any): string {
|
||||
return statusMap[s] || '未知'
|
||||
}
|
||||
|
||||
function formatTime(dateStr: string): string {
|
||||
const date = new Date(dateStr)
|
||||
const now = new Date()
|
||||
const diff = now.getTime() - date.getTime()
|
||||
const hours = Math.floor(diff / (1000 * 60 * 60))
|
||||
|
||||
if (hours < 1) {
|
||||
return '刚刚'
|
||||
} else if (hours < 24) {
|
||||
return `${hours}小时前`
|
||||
} else {
|
||||
return `${Math.floor(hours / 24)}天前`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function changeTrendPeriod(period: string) {
|
||||
trendPeriod.value = period
|
||||
|
||||
Reference in New Issue
Block a user