mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
优化文件上传组件;
This commit is contained in:
@@ -279,7 +279,7 @@ class BuildCurdService
|
||||
}
|
||||
|
||||
// 获取表名注释
|
||||
$tableSchema = Db::query("SELECT table_name,table_comment FROM information_schema.TABLES WHERE table_schema = 'easyadmin' AND table_name = '{$this->tablePrefix}{$this->table}'");
|
||||
$tableSchema = Db::query("SELECT table_name,table_comment FROM information_schema.TABLES WHERE table_schema = 'ulthon_admin' AND table_name = '{$this->tablePrefix}{$this->table}'");
|
||||
$this->tableComment = (isset($tableSchema[0]['table_comment']) && !empty($tableSchema[0]['table_comment'])) ? $tableSchema[0]['table_comment'] : $this->table;
|
||||
} catch (\Exception $e) {
|
||||
throw new TableException($e->getMessage());
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="{{field}}" class="layui-input layui-col-xs6" {{required}} placeholder="请上传{{comment}}" value="{{value}}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="{{field}}" data-upload-number="one" data-upload-exts="*" data-upload-icon="file"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn" data-upload="{{field}}" data-upload-number="one" data-upload-exts="zip" data-upload-icon="file" data-disable-preview="1"><i class="fa fa-upload"></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_{{field}}" data-upload-select="{{field}}" data-upload-number="one" data-upload-mimetype="*"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="layui-input-block layuimini-upload">
|
||||
<input name="{{field}}" class="layui-input layui-col-xs6" {{required}} placeholder="请上传{{comment}}" value="{{value}}">
|
||||
<div class="layuimini-upload-btn">
|
||||
<span><a class="layui-btn" data-upload="{{field}}" data-upload-number="more" data-upload-exts="*" data-upload-icon="file"><i class="fa fa-upload" data-upload-sign="{{define}}"></i> 上传</a></span>
|
||||
<span><a class="layui-btn" data-upload="{{field}}" data-upload-number="more" data-upload-exts="zip" data-upload-icon="file" data-disable-preview="1"><i class="fa fa-upload" data-upload-sign="{{define}}" ></i> 上传</a></span>
|
||||
<span><a class="layui-btn layui-btn-normal" id="select_{{field}}" data-upload-select="{{field}}" data-upload-number="more" data-upload-mimetype="*" data-upload-sign="{{define}}"><i class="fa fa-list"></i> 选择</a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -983,9 +983,9 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
|
||||
if (col.templet == admin.table.image) {
|
||||
imageFields.push(col.field)
|
||||
}
|
||||
|
||||
|
||||
if (col.selectList instanceof Object) {
|
||||
if(Object.keys(col.selectList).length > 0){
|
||||
if (Object.keys(col.selectList).length > 0) {
|
||||
selectFields[col.field] = col.selectList;
|
||||
}
|
||||
|
||||
@@ -1495,6 +1495,7 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
|
||||
uploadSign = $(this).attr('data-upload-sign') || '|',
|
||||
uploadAccept = $(this).attr('data-upload-accept') || 'file',
|
||||
uploadAcceptMime = $(this).attr('data-upload-mimetype') || '',
|
||||
disablePreview = $(this).attr('data-disable-preview') || '',
|
||||
elem = "input[name='" + uploadName + "']",
|
||||
uploadElem = this;
|
||||
|
||||
@@ -1530,28 +1531,31 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
|
||||
}
|
||||
});
|
||||
|
||||
// 监听上传input值变化
|
||||
$(elem).bind("input propertychange", function (event) {
|
||||
var urlString = $(this).val(),
|
||||
urlArray = urlString.split(uploadSign),
|
||||
uploadIcon = $(uploadElem).attr('data-upload-icon') || "file";
|
||||
if (disablePreview == 0) {
|
||||
// 监听上传input值变化
|
||||
$(elem).bind("input propertychange", function (event) {
|
||||
var urlString = $(this).val(),
|
||||
urlArray = urlString.split(uploadSign),
|
||||
uploadIcon = $(uploadElem).attr('data-upload-icon') || "file";
|
||||
|
||||
$('#bing-' + uploadName).remove();
|
||||
if (urlString.length > 0) {
|
||||
var parant = $(this).parent('div');
|
||||
var liHtml = '';
|
||||
$.each(urlArray, function (i, v) {
|
||||
liHtml += '<li><a><img src="' + v + '" data-image onerror="this.src=\'' + BASE_URL + 'admin/images/upload-icons/' + uploadIcon + '.png\';this.onerror=null"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '">×</small></li>\n';
|
||||
});
|
||||
parant.after('<ul id="bing-' + uploadName + '" class="layui-input-block layuimini-upload-show">\n' + liHtml + '</ul>');
|
||||
$('#bing-' + uploadName).remove();
|
||||
if (urlString.length > 0) {
|
||||
var parant = $(this).parent('div');
|
||||
var liHtml = '';
|
||||
$.each(urlArray, function (i, v) {
|
||||
liHtml += '<li><a><img src="' + v + '" data-image onerror="this.src=\'' + BASE_URL + 'admin/images/upload-icons/' + uploadIcon + '.png\';this.onerror=null"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '">×</small></li>\n';
|
||||
});
|
||||
parant.after('<ul id="bing-' + uploadName + '" class="layui-input-block layuimini-upload-show">\n' + liHtml + '</ul>');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 非空初始化图片显示
|
||||
if ($(elem).val() !== '') {
|
||||
$(elem).trigger("input");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 非空初始化图片显示
|
||||
if ($(elem).val() !== '') {
|
||||
$(elem).trigger("input");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 监听上传文件的删除事件
|
||||
|
||||
Reference in New Issue
Block a user