修改功能
This commit is contained in:
+21
-10
@@ -13,6 +13,15 @@
|
||||
})(typeof globalThis !== 'undefined' ? globalThis : window, function (root) {
|
||||
'use strict';
|
||||
|
||||
function confirmAction(message) {
|
||||
if (root.ProfileUI && typeof root.ProfileUI.confirmAction === 'function') {
|
||||
return root.ProfileUI.confirmAction(message);
|
||||
}
|
||||
return Promise.resolve(!root['confirm'] || root['confirm'](message));
|
||||
}
|
||||
|
||||
var MediaDisplay = root.MediaDisplay || (typeof require === 'function' ? require('./media-display.js') : null);
|
||||
|
||||
var documentRef = root.document;
|
||||
var videosById = Object.create(null);
|
||||
var canEditContent = false;
|
||||
@@ -134,8 +143,8 @@
|
||||
function normalizeVideo(item) {
|
||||
var videoId = normalizeId(item && item.videoId);
|
||||
var genealogyId = normalizeId(item && item.genealogyId);
|
||||
var videoOssId = normalizeId(item && item.videoOssId);
|
||||
var coverOssId = normalizeId(item && item.coverOssId);
|
||||
var videoFile = MediaDisplay && MediaDisplay.normalizeFileAccess(item && item.videoFile);
|
||||
var coverFile = MediaDisplay && MediaDisplay.normalizeFileAccess(item && item.coverFile);
|
||||
var publisherUserId = normalizeId(item && item.publisherUserId);
|
||||
var title = String(item && item.videoTitle || '').trim();
|
||||
var status = stringValue(item && item.status);
|
||||
@@ -144,8 +153,8 @@
|
||||
var viewCount;
|
||||
var sortOrder;
|
||||
|
||||
if (!videoId || !genealogyId || !videoOssId || !title || (status !== '0' && status !== '1')) return null;
|
||||
if (item.coverOssId !== undefined && item.coverOssId !== null && item.coverOssId !== '' && !coverOssId) return null;
|
||||
if (!videoId || !genealogyId || !videoFile || !title || (status !== '0' && status !== '1')) return null;
|
||||
if (item.coverFile !== undefined && item.coverFile !== null && !coverFile) return null;
|
||||
if (item.publisherUserId !== undefined && item.publisherUserId !== null && item.publisherUserId !== '' && !publisherUserId) return null;
|
||||
video = {
|
||||
videoId: videoId,
|
||||
@@ -155,14 +164,14 @@
|
||||
surname: stringValue(item.surname),
|
||||
videoTitle: title,
|
||||
videoDesc: stringValue(item.videoDesc),
|
||||
videoOssId: videoOssId,
|
||||
videoFile: videoFile,
|
||||
publisherNickName: stringValue(item.publisherNickName),
|
||||
publisherPhone: stringValue(item.publisherPhone),
|
||||
publishTime: stringValue(item.publishTime),
|
||||
status: status,
|
||||
remark: stringValue(item.remark)
|
||||
};
|
||||
if (coverOssId) video.coverOssId = coverOssId;
|
||||
if (coverFile) video.coverFile = coverFile;
|
||||
if (publisherUserId) video.publisherUserId = publisherUserId;
|
||||
duration = optionalInteger(item.durationSeconds, 0);
|
||||
viewCount = optionalInteger(item.viewCount, 0);
|
||||
@@ -236,16 +245,18 @@
|
||||
if (managementAccess) {
|
||||
actions = '<div class="bottom-actions"><a class="btn ghost" href="' +
|
||||
escapeHtml(buildEditUrl(video.genealogyId, video.videoId)) + '">编辑视频</a>' +
|
||||
'<button class="btn ghost" type="button" data-video-delete-id="' + escapeHtml(video.videoId) + '">删除视频</button></div>';
|
||||
'<button class="btn danger" type="button" data-video-delete-id="' + escapeHtml(video.videoId) + '">删除视频</button></div>';
|
||||
}
|
||||
return '<div class="form-like video-detail">' +
|
||||
return (MediaDisplay ? MediaDisplay.renderVideo(video.videoFile, {
|
||||
posterFile: video.coverFile, title: video.videoTitle, className: 'video-detail-media'
|
||||
}) : '') + '<div class="form-like video-detail">' +
|
||||
detailValue('视频标题', video.videoTitle) +
|
||||
detailValue('视频说明', video.videoDesc) +
|
||||
detailValue('所属家谱', video.genealogyName || video.genealogyNo) +
|
||||
detailValue('发布人', video.publisherNickName) +
|
||||
detailValue('发布时间', video.publishTime) +
|
||||
detailValue('视频文件', '已上传') +
|
||||
detailValue('封面文件', video.coverOssId ? '已上传' : '未上传') +
|
||||
detailValue('封面文件', video.coverFile ? '已上传' : '未上传') +
|
||||
detailValue('视频时长', formatDuration(video.durationSeconds)) +
|
||||
detailValue('浏览量', video.viewCount === undefined ? '' : String(video.viewCount)) +
|
||||
detailValue('状态', video.status === '0' ? '正常' : '停用') +
|
||||
@@ -594,7 +605,7 @@
|
||||
var video = videosById[videoId];
|
||||
|
||||
if (writePending || !canEditContent || !genealogyId || !normalizeId(videoId) || redirectUnauthorized(api)) return;
|
||||
if (root.confirm && !root.confirm('确认删除“' + (video ? video.videoTitle : '该视频') + '”吗?删除会释放视频和封面文件引用。')) return;
|
||||
if (!await confirmAction('确认删除“' + (video ? video.videoTitle : '该视频') + '”吗?删除会释放视频和封面文件引用。')) return;
|
||||
setWritePending(true);
|
||||
try {
|
||||
await api.deleteVideo(genealogyId, videoId);
|
||||
|
||||
Reference in New Issue
Block a user