feature: 面板
This commit is contained in:
parent
74ad433809
commit
faa9d20ab8
|
|
@ -28,7 +28,7 @@
|
|||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="plupload-path" class="btn btn-danger plupload" data-input-id="c-prove_file_path" data-mimetype="*" data-multiple="false" data-preview-id="p-path"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
{if $row->prove_file_path}
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-type="{$row.filetype}" data-url="{$row.fileurl}">预览</button></span>
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-filetype="{$row.filetype}" data-fileurl="{$row.fileurl}">预览</button></span>
|
||||
{/if}
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-prove_file_path"></span>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<input id="c-path" data-rule="required" class="form-control" size="50" name="row[path]" type="text" value="{$row.path|htmlentities}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="plupload-path" class="btn btn-danger plupload" data-input-id="c-path" data-mimetype="*" data-multiple="false" data-preview-id="p-path"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-url="{$row.fileurl}" data-type="{$row.filetype}">预览</button></span>
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-fileurl="{$row.fileurl}" data-filetype="{$row.filetype}">预览</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-path"></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
<input id="c-prove_file_path" class="form-control" size="50" readonly="readonly" name="row[prove_file_path]" type="text" value="{$row.prove_file_path}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
{if $row.prove_file_path}
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-type="{$row.filetype}" data-url="{$row.fileurl}">预览</button></span>
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-filetype="{$row.filetype}" data-fileurl="{$row.fileurl}">预览</button></span>
|
||||
{/if}
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-prove_file_path"></span>
|
||||
|
|
|
|||
|
|
@ -100,21 +100,21 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
|
|||
|
||||
$(document).on('click', '.btn-preview', function (e) {
|
||||
e.preventDefault();
|
||||
var fileType = $(this).data('type'); // 自动从 data-type 获取,比如 pdf, jpg, doc
|
||||
var url = $(this).data('url');
|
||||
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: url
|
||||
content: fileUrl
|
||||
});
|
||||
} else if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(fileType)) {
|
||||
Layer.photos({
|
||||
photos: {
|
||||
"title": "图片预览",
|
||||
"data": [{"src": url}]
|
||||
"data": [{"src": fileUrl}]
|
||||
},
|
||||
anim: 5
|
||||
});
|
||||
|
|
@ -123,10 +123,10 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
|
|||
type: 1,
|
||||
title: '视频预览',
|
||||
area: ['800px', '500px'],
|
||||
content: `<video src="${url}" width="100%" height="100%" controls autoplay></video>`
|
||||
content: `<video src="${fileUrl}" width="100%" height="100%" controls autoplay></video>`
|
||||
});
|
||||
} else {
|
||||
window.open(url, '_blank');
|
||||
window.open(fileUrl, '_blank');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user