diff --git a/app/admin/controller/api/Upload.php b/app/admin/controller/api/Upload.php
index 367139daa..2ae9e1183 100644
--- a/app/admin/controller/api/Upload.php
+++ b/app/admin/controller/api/Upload.php
@@ -147,14 +147,14 @@ class Upload extends Controller
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
- public function modal()
+ public function image()
{
SystemFile::mQuery()->layTable(function () {
$this->title = '文件选择器';
}, function (QueryHelper $query) {
$query->where(['status' => 2])->order('id desc');
$query->like('name,hash')->dateBetween('create_at');
- });
+ }, realpath(__DIR__ . '/../../view/api/image.html'));
}
/**
diff --git a/app/admin/view/api/image.html b/app/admin/view/api/image.html
new file mode 100644
index 000000000..ec1214076
--- /dev/null
+++ b/app/admin/view/api/image.html
@@ -0,0 +1,36 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/public/static/admin.js b/public/static/admin.js
index 8a95f3255..0b9e64020 100644
--- a/public/static/admin.js
+++ b/public/static/admin.js
@@ -550,7 +550,7 @@ $(function () {
$.fn.uploadOneImage = function () {
return this.each(function () {
if ($(this).data('inited')) return true; else $(this).data('inited', true);
- var $in = $(this), $bt = $('ဆ').data('input', this);
+ var $in = $(this), $bt = $('ဆ').data('input', this);
$bt.attr('data-size', $in.data('size') || 0).attr('data-type', $in.data('type') || 'png,jpg,gif,jpeg').find('span').on('click', function (event) {
event.stopPropagation();
if ($(this).index() === 0) $bt.attr('style', ''), $in.val(''); else $in.val() && $.previewImage(encodeURI($in.val()));
@@ -835,7 +835,10 @@ $(function () {
/*! 注册 data-file 事件行为 */
onEvent('click', '[data-file]', function () {
- if ($(this).data('inited') !== true) (function (that) {
+ // 上传图片,支持单图或多图选择,分别是 images|images
+ if (typeof this.dataset.file === 'string' && /^images?$/.test(this.dataset.file)) {
+ $.form.modal(tapiRoot + '/api.upload/image', this.dataset, '图片管理器')
+ } else if ($(this).data('inited') !== true) (function (that) {
that.uploadFile(undefined, function () {
that.trigger('upload.start');
});