Accept Merge Request #78: (feature/zy -> develop)
Merge Request: feature: 面板 Created By: @zhuyu Accepted By: @zhuyu URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/78?initial=true
This commit is contained in:
commit
831a47b19b
|
|
@ -86,6 +86,40 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
Controller.api.bindevent();
|
Controller.api.bindevent();
|
||||||
},
|
},
|
||||||
edit: function () {
|
edit: function () {
|
||||||
|
|
||||||
|
$(document).on('click', '.btn-preview', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var fileType = $(this).data('filetype'); // 自动从 data-type 获取,比如 pdf, jpg, doc
|
||||||
|
var fileUrl = $(this).data('fileurl');
|
||||||
|
|
||||||
|
if (fileType === 'pdf') {
|
||||||
|
Layer.open({
|
||||||
|
type: 2,
|
||||||
|
title: '预览PDF文件',
|
||||||
|
area: ['80%', '80%'],
|
||||||
|
content: fileUrl
|
||||||
|
});
|
||||||
|
} else if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(fileType)) {
|
||||||
|
Layer.photos({
|
||||||
|
photos: {
|
||||||
|
"title": "图片预览",
|
||||||
|
"data": [{"src": fileUrl}]
|
||||||
|
},
|
||||||
|
anim: 5
|
||||||
|
});
|
||||||
|
} else if (['mp4', 'webm', 'ogg'].includes(fileType)) {
|
||||||
|
Layer.open({
|
||||||
|
type: 1,
|
||||||
|
title: '视频预览',
|
||||||
|
area: ['800px', '500px'],
|
||||||
|
content: `<video src="${fileUrl}" width="100%" height="100%" controls autoplay></video>`
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
window.open(fileUrl, '_blank');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Controller.api.bindevent();
|
Controller.api.bindevent();
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user