fix(admin): 观看时间统一格式化为 yyyy-MM-dd HH:mm:ss
后端改输出格式后仍保留前端兜底,同时修掉用户详情里的原始 ISO 展示。
This commit is contained in:
1 parent
111bbdaeb7
commit
daf681ae1a
3 files changed
+14
-3
No files matched your search
@@ -9,6 +9,7 @@ import { useRbac } from '@/stores/rbac'
|
||||
import {
|
||||
APP_USER_STATUS,
|
||||
COUNTRY_OPTIONS,
|
||||
formatDateTime,
|
||||
formatDuration,
|
||||
statusMeta,
|
||||
systemText,
|
||||
@@ -312,7 +313,9 @@ function canBeBanned(row) {
|
||||
SOURCE_TEXT[row.source] || row.source || '—'
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="watchedAt" label="时间" width="160" show-overflow-tooltip />
|
||||
<el-table-column label="时间" width="160">
|
||||
<template #default="{ row }">{{ formatDateTime(row.watchedAt) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { onMounted, reactive, ref } from 'vue'
|
||||
import PageHeading from '@/views/components/PageHeading.vue'
|
||||
import AppUserCell from '@/views/components/AppUserCell.vue'
|
||||
import { pageWatchHistoryApi } from '@/api/admin/appUser'
|
||||
import { formatDuration, platformText } from './composables/useAppUsers'
|
||||
import { formatDateTime, formatDuration, platformText } from './composables/useAppUsers'
|
||||
|
||||
const SOURCE_OPTIONS = [
|
||||
{ value: '', label: '全部' },
|
||||
@@ -190,7 +190,9 @@ onMounted(load)
|
||||
class="drama-el-table"
|
||||
empty-text="暂无符合条件的观看记录"
|
||||
>
|
||||
<el-table-column prop="watchedAt" label="观看时间" min-width="170" show-overflow-tooltip />
|
||||
<el-table-column label="观看时间" min-width="170">
|
||||
<template #default="{ row }">{{ formatDateTime(row.watchedAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用户" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<AppUserCell :row="row" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
getAppUserApi,
|
||||
@@ -50,6 +51,11 @@ export function systemText(row) {
|
||||
return text || '—'
|
||||
}
|
||||
|
||||
/** 后端返回 ISO 时间串,统一格式化成后台可读的本地时间 */
|
||||
export function formatDateTime(value) {
|
||||
return value && dayjs(value).isValid() ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '—'
|
||||
}
|
||||
|
||||
/** 毫秒转 mm:ss,观看流水里的进度用 */
|
||||
export function formatDuration(ms) {
|
||||
const total = Math.max(0, Math.floor((ms || 0) / 1000))
|
||||
|
||||
Reference in new issue
Block a user