mirror of https://gitee.com/karson/fastadmin.git
parent
9f04fcdb66
commit
82966e07c3
|
|
@ -19,5 +19,7 @@ return [
|
|||
'Storage' => '存储引擎',
|
||||
'Upload to third' => '上传到第三方',
|
||||
'Upload to local' => '上传到本地',
|
||||
'Upload to third by chunk' => '上传到第三方(分片模式)',
|
||||
'Upload to local by chunk' => '上传到本地(分片模式)',
|
||||
'Upload from editor' => '从编辑器上传'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
|
||||
{if $config.upload.cdnurl}
|
||||
<div class="form-group">
|
||||
<label for="c-third" class="control-label col-xs-12 col-sm-2">{:__('Upload')}:</label>
|
||||
<label for="c-third" class="control-label col-xs-12 col-sm-2">{:__('Upload to third')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input type="text" name="row[third]" id="c-third" class="form-control" />
|
||||
</div>
|
||||
|
|
@ -11,12 +11,15 @@
|
|||
<label for="c-third" class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="button" id="faupload-third" class="btn btn-danger faupload" data-multiple="true" data-input-id="c-third" ><i class="fa fa-upload"></i> {:__("Upload to third")}</button>
|
||||
{if config('upload.chunking')}
|
||||
<button type="button" id="faupload-third-chunk" class="btn btn-danger faupload" data-chunking="true" data-multiple="true" data-input-id="c-third" ><i class="fa fa-upload"></i> {:__("Upload to third by chunk")}</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="c-local" class="control-label col-xs-12 col-sm-2">{:__('Upload')}:</label>
|
||||
<label for="c-local" class="control-label col-xs-12 col-sm-2">{:__('Upload to local')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input type="text" name="row[local]" id="c-local" class="form-control" />
|
||||
</div>
|
||||
|
|
@ -26,9 +29,13 @@
|
|||
<label for="c-local" class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="button" id="faupload-local" class="btn btn-primary faupload" data-input-id="c-local" data-url="{:url('ajax/upload')}"><i class="fa fa-upload"></i> {:__("Upload to local")}</button>
|
||||
{if config('upload.chunking')}
|
||||
<button type="button" id="faupload-local-chunking" class="btn btn-primary faupload" data-chunking="true" data-input-id="c-local" data-url="{:url('ajax/upload')}"><i class="fa fa-upload"></i> {:__("Upload to local by chunk")}</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="c-editor" class="control-label col-xs-12 col-sm-2">{:__('Upload from editor')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@
|
|||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar('refresh,add,edit,del')}
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover" width="100%">
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('general/attachment/edit')}"
|
||||
data-operate-del="{:$auth->check('general/attachment/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
|
|||
{field: 'id', title: __('Id')},
|
||||
{field: 'admin_id', title: __('Admin_id'), visible: false, addClass: "selectpage", extend: "data-source='auth/admin/index' data-field='nickname'"},
|
||||
{field: 'user_id', title: __('User_id'), visible: false, addClass: "selectpage", extend: "data-source='user/user/index' data-field='nickname'"},
|
||||
{field: 'url', title: __('Preview'), formatter: Controller.api.formatter.thumb, operate: false},
|
||||
{field: 'preview', title: __('Preview'), formatter: Controller.api.formatter.thumb, operate: false},
|
||||
{field: 'url', title: __('Url'), formatter: Controller.api.formatter.url, visible: false},
|
||||
{field: 'filename', title: __('Filename'), formatter: Table.api.formatter.search, operate: 'like'},
|
||||
{
|
||||
|
|
@ -145,12 +145,16 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
|
|||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
require(['upload'], function (Upload) {
|
||||
Upload.api.faupload($("#toolbar .faupload"), function () {
|
||||
Upload.api.upload($("#toolbar .faupload"), function () {
|
||||
$(".btn-refresh").trigger("click");
|
||||
});
|
||||
});
|
||||
},
|
||||
add: function () {
|
||||
//上传完成后刷新父窗口
|
||||
$(".faupload").data("upload-complete", function (files) {
|
||||
window.parent.$(".btn-refresh").trigger("click");
|
||||
});
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
|
|
@ -163,14 +167,14 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
|
|||
formatter: {
|
||||
thumb: function (value, row, index) {
|
||||
if (row.mimetype.indexOf("image") > -1) {
|
||||
var style = row.storage == 'upyun' ? '!/fwfh/120x90' : '';
|
||||
var style = row.storage === 'upyun' ? '!/fwfh/120x90' : '';
|
||||
return '<a href="' + row.fullurl + '" target="_blank"><img src="' + row.fullurl + style + '" alt="" style="max-height:90px;max-width:120px"></a>';
|
||||
} else {
|
||||
return '<a href="' + row.fullurl + '" target="_blank"><img src="https://tool.fastadmin.net/icon/' + row.imagetype + '.png" alt=""></a>';
|
||||
return '<a href="' + row.fullurl + '" target="_blank"><img src="' + Fast.api.fixurl("ajax/icon") + "?suffix=" + row.imagetype + '" alt=""></a>';
|
||||
}
|
||||
},
|
||||
url: function (value, row, index) {
|
||||
return '<a href="' + row.fullurl + '" target="_blank" class="label bg-green">' + value + '</a>';
|
||||
return '<a href="' + row.fullurl + '" target="_blank" class="label bg-green">' + row.url + '</a>';
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7474,7 +7474,7 @@ define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, un
|
|||
this.options.elementHtml = $(this.element).html();
|
||||
},
|
||||
addedfiles: function (files) {
|
||||
if (this.options.maxFiles && this.options.maxFiles > 0 && this.options.inputId) {
|
||||
if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) {
|
||||
var inputObj = $("#" + this.options.inputId);
|
||||
if (inputObj.size() > 0) {
|
||||
var value = $.trim(inputObj.val());
|
||||
|
|
@ -7655,6 +7655,12 @@ define('upload',['jquery', 'bootstrap', 'dropzone', 'template'], function ($, un
|
|||
plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
|
||||
},
|
||||
/**
|
||||
* @deprecated Use upload instead.
|
||||
*/
|
||||
faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
|
||||
},
|
||||
// AJAX异步上传
|
||||
send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
|
|||
this.options.elementHtml = $(this.element).html();
|
||||
},
|
||||
addedfiles: function (files) {
|
||||
if (this.options.maxFiles && this.options.maxFiles > 0 && this.options.inputId) {
|
||||
if (this.options.maxFiles && (!this.options.maxFiles || this.options.maxFiles > 1) && this.options.inputId) {
|
||||
var inputObj = $("#" + this.options.inputId);
|
||||
if (inputObj.size() > 0) {
|
||||
var value = $.trim(inputObj.val());
|
||||
|
|
@ -393,6 +393,12 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
|
|||
plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
|
||||
},
|
||||
/**
|
||||
* @deprecated Use upload instead.
|
||||
*/
|
||||
faupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
return Upload.api.upload(element, onUploadSuccess, onUploadError, onUploadComplete);
|
||||
},
|
||||
// AJAX异步上传
|
||||
send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
|
||||
|
|
|
|||
Loading…
Reference in New Issue