mirror of https://gitee.com/karson/fastadmin.git
修复上传普通文件无预览的BUG
修复API文档无法上传文件的BUG 修复列表Tab切换后普通搜索失效的BUG 修复Bootcss相关链接 修复前台会员头像在启用云储存丢失的BUGpull/80/MERGE
parent
c86f89b5d7
commit
571ef508ca
|
|
@ -7,8 +7,19 @@
|
|||
<meta name="description" content="">
|
||||
<meta name="author" content="{$config.author}">
|
||||
<title>{$config.title}</title>
|
||||
<link href="https://cdn.bootcss.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.bootcss.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Plugin CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-top: 70px; margin-bottom: 15px;
|
||||
|
|
@ -342,8 +353,12 @@
|
|||
|
||||
</div> <!-- /container -->
|
||||
|
||||
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://cdn.bootcss.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
|
||||
<!-- jQuery -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@2.1.4/dist/jquery.min.js"></script>
|
||||
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function syntaxHighlight(json) {
|
||||
if (typeof json != 'string') {
|
||||
|
|
@ -476,12 +491,14 @@
|
|||
//keep a copy of action attribute in order to modify the copy
|
||||
//instead of the initial attribute
|
||||
var url = $(form).attr('action');
|
||||
var method = $(form).prop('method').toLowerCase() || 'get';
|
||||
|
||||
var formData = new FormData();
|
||||
|
||||
$(form).find('input').each(function (i, input) {
|
||||
if ($(input).attr('type') == 'file') {
|
||||
if ($(input).attr('type').toLowerCase() == 'file') {
|
||||
formData.append($(input).attr('name'), $(input)[0].files[0]);
|
||||
method = 'post';
|
||||
} else {
|
||||
formData.append($(input).attr('name'), $(input).val())
|
||||
}
|
||||
|
|
@ -524,8 +541,8 @@
|
|||
|
||||
$.ajax({
|
||||
url: $('#apiUrl').val() + url,
|
||||
data: $(form).prop('method').toLowerCase() == 'get' ? $(form).serialize() : formData,
|
||||
type: $(form).prop('method') + '',
|
||||
data: method == 'get' ? $(form).serialize() : formData,
|
||||
type: method,
|
||||
dataType: 'json',
|
||||
contentType: false,
|
||||
processData: false,
|
||||
|
|
|
|||
|
|
@ -478,7 +478,6 @@ class Crud extends Command
|
|||
$appendAttrList = [];
|
||||
$controllerAssignList = [];
|
||||
$headingHtml = '{:build_heading()}';
|
||||
$headingJs = '';
|
||||
|
||||
//循环所有字段,开始构造视图的HTML和JS信息
|
||||
foreach ($columnList as $k => $v) {
|
||||
|
|
@ -696,7 +695,6 @@ class Crud extends Command
|
|||
}
|
||||
if ($this->headingFilterField && $this->headingFilterField == $field && $itemArr) {
|
||||
$headingHtml = $this->getReplacedStub('html/heading-html', ['field' => $field]);
|
||||
$headingJs = $this->getReplacedStub('html/heading-js', ['field' => $field]);
|
||||
}
|
||||
//排序方式,如果有指定排序字段,否则按主键排序
|
||||
$order = $field == $this->sortField ? $this->sortField : $order;
|
||||
|
|
@ -772,7 +770,6 @@ class Crud extends Command
|
|||
'relationMethodList' => '',
|
||||
'controllerIndex' => '',
|
||||
'headingHtml' => $headingHtml,
|
||||
'headingJs' => $headingJs,
|
||||
'visibleFieldList' => $fields ? "\$row->visible(['" . implode("','", array_filter(explode(',', $fields))) . "']);" : '',
|
||||
'appendAttrList' => implode(",\n", $appendAttrList),
|
||||
'getEnumList' => implode("\n\n", $getEnumArr),
|
||||
|
|
@ -1267,7 +1264,7 @@ EOD;
|
|||
$selectfilter = ' data-mimetype="image/*"';
|
||||
}
|
||||
$multiple = substr($field, -1) == 's' ? ' data-multiple="true"' : ' data-multiple="false"';
|
||||
$preview = $uploadfilter ? ' data-preview-id="p-' . $field . '"' : '';
|
||||
$preview = ' data-preview-id="p-' . $field . '"';
|
||||
$previewcontainer = $preview ? '<ul class="row list-inline plupload-preview" id="p-' . $field . '"></ul>' : '';
|
||||
return <<<EOD
|
||||
<div class="input-group">
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
// 绑定TAB事件
|
||||
$('.panel-heading a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var field = $(this).closest("ul").data("field");
|
||||
var value = $(this).data("value");
|
||||
var options = table.bootstrapTable('getOptions');
|
||||
options.pageNumber = 1;
|
||||
options.queryParams = function (params) {
|
||||
var filter = {};
|
||||
if (value !== '') {
|
||||
filter[field] = value;
|
||||
}
|
||||
params.filter = JSON.stringify(filter);
|
||||
return params;
|
||||
};
|
||||
table.bootstrapTable('refresh', {});
|
||||
return false;
|
||||
});
|
||||
|
|
@ -28,8 +28,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||
]
|
||||
});
|
||||
|
||||
{%headingJs%}
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Common extends Api
|
|||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @param File $file 文件流
|
||||
*/
|
||||
public function upload()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
<li class="dropdown">
|
||||
{if $user}
|
||||
<a href="{:url('user/index')}" class="dropdown-toggle" data-toggle="dropdown" style="padding-top: 10px;height: 50px;">
|
||||
<span class="avatar-img"><img src="{$user.avatar}" alt=""></span>
|
||||
<span class="avatar-img"><img src="{$user.avatar|cdnurl}" alt=""></span>
|
||||
</a>
|
||||
{else /}
|
||||
<a href="{:url('user/index')}" class="dropdown-toggle" data-toggle="dropdown">{:__('User center')} <b class="caret"></b></a>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<div class="row user-baseinfo">
|
||||
<div class="col-md-3 col-sm-3 col-xs-2 text-center user-center">
|
||||
<a href="{:url('user/profile')}" title="{:__('Click to edit')}">
|
||||
<span class="avatar-img"><img src="{$user.avatar}" alt=""></span>
|
||||
<span class="avatar-img"><img src="{$user.avatar|cdnurl}" alt=""></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-9 col-sm-9 col-xs-10">
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<div class="profile-avatar-container">
|
||||
<img class="profile-user-img img-responsive img-circle plupload" src="{$user.avatar}" alt="">
|
||||
<img class="profile-user-img img-responsive img-circle plupload" src="{$user.avatar|cdnurl}" alt="">
|
||||
<div class="profile-avatar-text img-circle">{:__('Click to edit')}</div>
|
||||
<button id="plupload-avatar" class="plupload" data-mimetype="png,jpg,jpeg,gif" data-input-id="c-avatar"><i class="fa fa-upload"></i> {:__('Upload')}</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,19 @@
|
|||
<meta name="description" content="">
|
||||
<meta name="author" content="FastAdmin">
|
||||
<title>FastAdmin</title>
|
||||
<link href="https://cdn.bootcss.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.bootcss.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Plugin CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-top: 70px; margin-bottom: 15px;
|
||||
|
|
@ -317,7 +328,7 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading" id="heading-1">
|
||||
<h4 class="panel-title">
|
||||
<span class="label label-success">GET</span>
|
||||
<span class="label label-primary">POST</span>
|
||||
<a data-toggle="collapse" data-parent="#accordion1" href="#collapseOne1"> 上传文件 <span class="text-muted">/api/common/upload</span></a>
|
||||
</h4>
|
||||
</div>
|
||||
|
|
@ -379,7 +390,7 @@
|
|||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><strong>参数</strong></div>
|
||||
<div class="panel-body">
|
||||
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/common/upload" method="get" name="form1" id="form1">
|
||||
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/common/upload" method="POST" name="form1" id="form1">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="file">file</label>
|
||||
<input type="File" class="form-control input-sm" id="file" required placeholder="文件流" name="file">
|
||||
|
|
@ -3716,7 +3727,7 @@
|
|||
|
||||
<div class="row mt0 footer">
|
||||
<div class="col-md-6" align="left">
|
||||
Generated on 2018-08-04 20:31:01 </div>
|
||||
Generated on 2018-10-19 17:00:36 </div>
|
||||
<div class="col-md-6" align="right">
|
||||
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
|
||||
</div>
|
||||
|
|
@ -3724,8 +3735,12 @@
|
|||
|
||||
</div> <!-- /container -->
|
||||
|
||||
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://cdn.bootcss.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
|
||||
<!-- jQuery -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@2.1.4/dist/jquery.min.js"></script>
|
||||
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function syntaxHighlight(json) {
|
||||
if (typeof json != 'string') {
|
||||
|
|
@ -3858,12 +3873,14 @@
|
|||
//keep a copy of action attribute in order to modify the copy
|
||||
//instead of the initial attribute
|
||||
var url = $(form).attr('action');
|
||||
var method = $(form).prop('method').toLowerCase() || 'get';
|
||||
|
||||
var formData = new FormData();
|
||||
|
||||
$(form).find('input').each(function (i, input) {
|
||||
if ($(input).attr('type') == 'file') {
|
||||
if ($(input).attr('type').toLowerCase() == 'file') {
|
||||
formData.append($(input).attr('name'), $(input)[0].files[0]);
|
||||
method = 'post';
|
||||
} else {
|
||||
formData.append($(input).attr('name'), $(input).val())
|
||||
}
|
||||
|
|
@ -3906,8 +3923,8 @@
|
|||
|
||||
$.ajax({
|
||||
url: $('#apiUrl').val() + url,
|
||||
data: $(form).prop('method').toLowerCase() == 'get' ? $(form).serialize() : formData,
|
||||
type: $(form).prop('method') + '',
|
||||
data: method == 'get' ? $(form).serialize() : formData,
|
||||
type: method,
|
||||
dataType: 'json',
|
||||
contentType: false,
|
||||
processData: false,
|
||||
|
|
|
|||
|
|
@ -5825,7 +5825,7 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
config: {
|
||||
container: document.body,
|
||||
classname: '.plupload:not([initialized])',
|
||||
previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
|
||||
previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" onerror="this.src=\'https://tool.fastadmin.net/icon/\'+\'<%=fullurl%>\'.split(\'.\').pop()+\'.png\';this.onerror=null;" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
|
||||
},
|
||||
events: {
|
||||
//初始化完成
|
||||
|
|
@ -6005,11 +6005,9 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
|
||||
var mimetypeArr = new Array();
|
||||
//支持后缀和Mimetype格式,以,分隔
|
||||
if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1)
|
||||
{
|
||||
if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1) {
|
||||
var tempArr = mimetype.split(',');
|
||||
for (var i = 0; i < tempArr.length; i++)
|
||||
{
|
||||
for (var i = 0; i < tempArr.length; i++) {
|
||||
mimetypeArr.push({title: __('Files'), extensions: tempArr[i]});
|
||||
}
|
||||
mimetype = mimetypeArr;
|
||||
|
|
@ -9547,6 +9545,14 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
var ids = Table.api.selectedids(table);
|
||||
$(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
|
||||
});
|
||||
// 绑定TAB事件
|
||||
$('.panel-heading ul[data-field] li a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var field = $(this).closest("ul").data("field");
|
||||
var value = $(this).data("value");
|
||||
$("select[name='" + field + "'] option[value='" + value + "']", table.closest(".bootstrap-table").find(".commonsearch-table")).prop("selected", true);
|
||||
table.bootstrapTable('refresh', {});
|
||||
return false;
|
||||
});
|
||||
// 刷新按钮事件
|
||||
$(toolbar).on('click', Table.config.refreshbtn, function () {
|
||||
table.bootstrapTable('refresh');
|
||||
|
|
@ -9813,9 +9819,8 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
|||
var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
|
||||
var no = typeof this.no !== 'undefined' ? this.no : 0;
|
||||
return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change' data-id='"
|
||||
+ row.id + "' data-params='" + this.field + "=" + (value ? no : yes) + "'><i class='fa fa-toggle-on " + (value == yes ? 'text-' + color : 'fa-flip-horizontal text-gray') + " fa-2x'></i></a>";
|
||||
}
|
||||
,
|
||||
+ row.id + "' data-params='" + this.field + "=" + (value == yes ? no : yes) + "'><i class='fa fa-toggle-on " + (value == yes ? 'text-' + color : 'fa-flip-horizontal text-gray') + " fa-2x'></i></a>";
|
||||
},
|
||||
url: function (value, row, index) {
|
||||
return '<div class="input-group input-group-sm" style="width:250px;margin:0 auto;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
|
||||
},
|
||||
|
|
|
|||
|
|
@ -158,6 +158,14 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
|||
var ids = Table.api.selectedids(table);
|
||||
$(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
|
||||
});
|
||||
// 绑定TAB事件
|
||||
$('.panel-heading ul[data-field] li a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var field = $(this).closest("ul").data("field");
|
||||
var value = $(this).data("value");
|
||||
$("select[name='" + field + "'] option[value='" + value + "']", table.closest(".bootstrap-table").find(".commonsearch-table")).prop("selected", true);
|
||||
table.bootstrapTable('refresh', {});
|
||||
return false;
|
||||
});
|
||||
// 刷新按钮事件
|
||||
$(toolbar).on('click', Table.config.refreshbtn, function () {
|
||||
table.bootstrapTable('refresh');
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ define(['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined,
|
|||
config: {
|
||||
container: document.body,
|
||||
classname: '.plupload:not([initialized])',
|
||||
previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
|
||||
previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" onerror="this.src=\'https://tool.fastadmin.net/icon/\'+\'<%=fullurl%>\'.split(\'.\').pop()+\'.png\';this.onerror=null;" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
|
||||
},
|
||||
events: {
|
||||
//初始化完成
|
||||
|
|
@ -184,11 +184,9 @@ define(['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined,
|
|||
multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
|
||||
var mimetypeArr = new Array();
|
||||
//支持后缀和Mimetype格式,以,分隔
|
||||
if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1)
|
||||
{
|
||||
if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1) {
|
||||
var tempArr = mimetype.split(',');
|
||||
for (var i = 0; i < tempArr.length; i++)
|
||||
{
|
||||
for (var i = 0; i < tempArr.length; i++) {
|
||||
mimetypeArr.push({title: __('Files'), extensions: tempArr[i]});
|
||||
}
|
||||
mimetype = mimetypeArr;
|
||||
|
|
|
|||
|
|
@ -408,7 +408,9 @@ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
</div>
|
||||
</form>
|
||||
|
||||
<script src="https://cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
|
||||
<!-- jQuery -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/jquery@2.1.4/dist/jquery.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('form :input:first').select();
|
||||
|
|
|
|||
Loading…
Reference in New Issue