From 59dba244d17e5ed829f791d277f387e23da5310d Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 27 Jun 2022 11:05:07 +0800 Subject: [PATCH] Update admin.js --- public/static/admin.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/public/static/admin.js b/public/static/admin.js index 81d9df254..28f9147d9 100644 --- a/public/static/admin.js +++ b/public/static/admin.js @@ -838,10 +838,20 @@ $(function () { this.id = this.dataset.id = this.id || (function (date) { return (date + Math.random()).replace('0.', ''); })(layui.util.toDateString(Date.now(), 'yyyyMMddHHmmss-')); - // 上传图片,支持单图或多图选择,分别是 images|images + // 上传图片,支持单图或多图选择,分别是 image|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) { + return $.form.modal(tapiRoot + '/api.upload/image', this.dataset, '图片选择器') + } + // 上传视频,支持单视频或多视频选择,分别是 video|videos + if (typeof this.dataset.file === 'string' && /^videos?$/.test(this.dataset.file)) { + return $.form.modal(tapiRoot + '/api.upload/video', this.dataset, '视频选择器') + } + // 上传文档,支持单视频或多视频选择,分别是 document|documents + if (typeof this.dataset.file === 'string' && /^videos?$/.test(this.dataset.file)) { + return $.form.modal(tapiRoot + '/api.upload/document', this.dataset, '文档选择器') + } + // 其他文件上传 + if ($(this).data('inited') !== true) (function (that) { that.uploadFile(undefined, function () { that.trigger('upload.start'); });