feat(workbench): show progress update time first
This commit is contained in:
@@ -205,6 +205,11 @@
|
||||
class="progress-row"
|
||||
@click="openWorkbenchTarget(item)"
|
||||
>
|
||||
<span class="progress-time">
|
||||
<time :datetime="item.updatedAt || ''">{{ item.displayTime }}</time>
|
||||
<small>更新</small>
|
||||
</span>
|
||||
|
||||
<span class="progress-identity">
|
||||
<strong>{{ item.id }}</strong>
|
||||
<small>{{ item.title }}</small>
|
||||
@@ -459,9 +464,26 @@ const visibleProgressItems = computed(() => {
|
||||
const rows = Array.isArray(props.workbenchSummary.progressItems)
|
||||
? props.workbenchSummary.progressItems
|
||||
: []
|
||||
return rows.slice(0, 5)
|
||||
return rows.slice(0, 5).map((item) => ({
|
||||
...item,
|
||||
displayTime: formatProgressTime(item?.updatedAt)
|
||||
}))
|
||||
})
|
||||
|
||||
function formatProgressTime(value) {
|
||||
const text = String(value || '').trim()
|
||||
if (!text) {
|
||||
return '最近更新'
|
||||
}
|
||||
|
||||
const match = /^(\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2}))?/.exec(text)
|
||||
if (match) {
|
||||
return match[4] ? `${match[2]}-${match[3]} ${match[4]}:${match[5]}` : `${match[2]}-${match[3]}`
|
||||
}
|
||||
|
||||
return text
|
||||
}
|
||||
|
||||
function buildSelectedFileKey(file) {
|
||||
return [file?.name, file?.size, file?.lastModified, file?.type].join('__')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user