feature: 面板
This commit is contained in:
parent
11575df4ae
commit
74ad433809
|
|
@ -26,7 +26,7 @@ class Doc extends Model
|
|||
|
||||
|
||||
|
||||
public function getUrlAttr($value, $data)
|
||||
public function getFileUrlAttr($value, $data)
|
||||
{
|
||||
$value = cdnurl($data['path']);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class Task extends Model
|
|||
return $this->belongsTo('app\admin\model\Admin', 'exec_admin_id', 'id', [], 'LEFT')->setEagerlyType(1);
|
||||
}
|
||||
|
||||
public function getUrlAttr($value, $data)
|
||||
public function getFileUrlAttr($value, $data)
|
||||
{
|
||||
$value = cdnurl($data['prove_file_path']);
|
||||
return $value;
|
||||
|
|
|
|||
|
|
@ -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.url}">预览</button></span>
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-type="{$row.filetype}" data-url="{$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><a href="{$row.url}" class="btn btn-primary btn-info btn-preview" data-type="{$row.filetype}">预览</a></span>
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-url="{$row.fileurl}" data-type="{$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.url}">预览</button></span>
|
||||
<span><button class="btn btn-primary btn-info btn-preview" data-type="{$row.filetype}" data-url="{$row.fileurl}">预览</button></span>
|
||||
{/if}
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-prove_file_path"></span>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
classname: 'btn btn-xs btn-primary btn-preview',
|
||||
icon: 'fa fa-list',
|
||||
extend: function(row) {
|
||||
return 'data-type="' + row.filetype + '" data-url="' + row.url + '"';
|
||||
return 'data-filetype="' + row.filetype + '" data-fileurl="' + row.fileurl + '"';
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -49,21 +49,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
|
||||
$(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
|
||||
});
|
||||
|
|
@ -72,10 +72,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
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');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -65,21 +65,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
|
||||
$(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
|
||||
});
|
||||
|
|
@ -88,10 +88,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
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