增加视频播放共用方法

This commit is contained in:
丁瑞超 2020-11-06 13:53:41 +08:00
parent 79d1527adc
commit 54cc032fb5
2 changed files with 22 additions and 1 deletions

View File

@ -336,6 +336,22 @@ var table = {
return $.common.nullToStr(value); return $.common.nullToStr(value);
} }
}, },
// 图片预览
videoView: function (value, height, width, target) {
if ($.common.isEmpty(width)) {
width = 'auto';
}
if ($.common.isEmpty(height)) {
height = 'auto';
}
// blank or self
var _target = $.common.isEmpty(target) ? 'self' : target;
if ($.common.isNotEmpty(value)) {
return $.common.sprintf("<video controls data-height='%s' data-width='%s' data-target='%s'><source src='%s' type='video/mp4'></video>", height, width, _target, value);
} else {
return $.common.nullToStr(value);
}
},
// 搜索-默认第一个form // 搜索-默认第一个form
search: function(formId, tableId) { search: function(formId, tableId) {
table.set(tableId); table.set(tableId);

View File

@ -136,7 +136,12 @@
}, },
{ {
field: 'videoUrl', field: 'videoUrl',
title: '视频地址' title: '视频地址',
width : 200,
height : 300,
formatter: function(value, row, index) {
return $.table.videoView(value);
}
}, },
{ {
field: 'status', field: 'status',