1.add.html
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Video')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-video" class="form-control" size="50" name="row[video]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-video" class="btn btn-danger faupload" data-input-id="c-video" data-mimetype="mp4,mp3,avi,flv,wmv" data-multiple="false" data-preview-id="p-video"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-video" class="btn btn-primary fachoose" data-input-id="c-video" data-mimetype="mp4,mp3,avi,flv,wmv" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-video"></ul>
</div>
</div>
2.edit.html
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Video')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-video" class="form-control" size="50" name="row[video]" type="text" value="{$row.video|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-video" class="btn btn-danger faupload" data-input-id="c-video" data-mimetype="mp4,mp3,avi,flv,wmv" data-multiple="false" data-preview-id="p-video"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-video" class="btn btn-primary fachoose" data-input-id="c-video" data-mimetype="mp4,mp3,avi,flv,wmv" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-video"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-video"></ul>
</div>
</div>
3.后台列表js
{
field: 'video_image',
title: __('Video_image'),
operate: false,
formatter: function (value, row, index) {
// 假设value是视频文件的路径或URL,但在这个上下文中,如果value是文件名,你可能需要构建一个完整的URL
var baseUrl = '/uploads/'; // 假设你的视频文件都存放在这个目录下
var videoUrl = baseUrl + value; // 拼接完整的视频URL
// 返回视频HTML标签
return '<video width="200" controls><source src="' + videoUrl + '" type="video/mp4">Your browser does not support the video tag.</video>';
}
}