From ecd4199f54f2529738f2d07ab3527e0059e5daaf Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 26 五月 2025 18:11:30 +0800
Subject: [PATCH] 视频管理-展示视频时长
---
manager/src/views/video/VideoList.vue | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/manager/src/views/video/VideoList.vue b/manager/src/views/video/VideoList.vue
index b704db2..8e2e6b0 100644
--- a/manager/src/views/video/VideoList.vue
+++ b/manager/src/views/video/VideoList.vue
@@ -92,6 +92,9 @@
</div>
</div>
</Form-item>
+ <Form-item label="瑙嗛鏃堕暱锛�" :label-width="72">
+ <div>{{formatSeconds(detail.videoDuration)}}</div>
+ </Form-item>
<Form-item class="video-warp" :label-width="0">
<video :src="detail.videoUrl" autoplay controls style="width: 768px;height: 432px"/>
</Form-item>
@@ -150,6 +153,9 @@
</template>
<template slot-scope="{ row, index }" slot="videoFileKey">
<div class="play-text" @click="playVideo(row.videoFileKey, row.title)">鐐瑰嚮鎾斁</div>
+ </template>
+ <template slot-scope="{ row, index }" slot="videoDuration">
+ <div>{{formatSeconds(row.videoDuration)}}</div>
</template>
<template slot-scope="{ row, index }" slot="recommend">
<i-switch v-model="row.recommend" :before-change="() => handleBeforeChange(row)" true-color="#13ce66"/>
@@ -284,6 +290,13 @@
slot: "videoFileKey"
},
{
+ title: "鏃堕暱",
+ key: "videoDuration",
+ width: 80,
+ align: 'center',
+ slot: "videoDuration",
+ },
+ {
title: "鎾斁閲�",
key: "playNum",
width: 80,
@@ -339,6 +352,18 @@
this.getTags('')
},
methods: {
+ // 绉掕浆x鍒唜绉�
+ formatSeconds(seconds) {
+ if (isNaN(seconds) || seconds < 0) return '0绉�';
+
+ const mins = Math.floor(seconds / 60);
+ const secs = seconds % 60;
+
+ if (mins === 0) return `${secs}绉抈;
+ if (secs === 0) return `${mins}鍒哷;
+
+ return `${mins}鍒�${secs}绉抈;
+ },
// 鑾峰彇鏍囩鍒楄〃
getTags(tagName) {
let params = {
--
Gitblit v1.8.0