diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index c17ccc2..23173be 100755 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -266,7 +266,7 @@ - {{ log.date }} {{ log.time || '' }} + {{ formatLogTime(log.date, log.time) }} @@ -577,6 +577,21 @@ const getCurrencySymbol = (currency?: string): string => { return symbols[currency || 'CNY'] || '¥'; }; +const formatLogTime = (date?: string, time?: string): string => { + if (!date) return ''; + const today = new Date(); + const todayStr = today.toISOString().split('T')[0]; + const isToday = date === todayStr; + + const datePart = isToday ? '' : date.slice(5); + const timePart = time ? time.slice(0, 5) : ''; + + if (isToday) { + return timePart || '今天'; + } + return datePart + (timePart ? ' ' + timePart : ''); +}; + const portfolioId = ref(''); const portfolioData = ref({ id: '',