Compare commits

...

3 Commits

Author SHA1 Message Date
Anyon
35b5999f60 Update upload.js 2022-10-21 17:55:57 +08:00
Anyon
45ec382ddc 修改图片限制 2022-10-21 17:54:19 +08:00
Anyon
21b9e107c5 修改文件大小限制 2022-10-21 17:51:01 +08:00
2 changed files with 10 additions and 6 deletions

View File

@ -72,12 +72,14 @@ define(['md5', 'notify'], function (SparkMD5, Notify, allowMime) {
var that = this.init();
layui.each(files, function (index, file) {
that.count.total++, file.index = index, that.files[index] = file;
if (that.option.size && file.size > that.option.size) {
that.event('upload.error', {file: file}, file, '大小超限');
} else if (!that.option.hide) {
if (!that.option.hide && !file.notify) {
file.notify = new NotifyExtend(file);
}
}), layui.each(files, function (index, file) {
if (that.option.size && file.size > that.option.size) {
that.event('upload.error', {file: file}, file, '大小超出限制!');
}
});
layui.each(files, function (index, file) {
// 禁传异常状态文件
if (typeof file.xstate === 'number' && file.xstate === -1) return;
// 图片限宽限高压缩

View File

@ -130,12 +130,14 @@
<label class="layui-hide" id="ImageDialogUploadLayout">
<!-- 图片上传组件 开始 -->
{if isset($get.file) && $get.file eq 'image'}
<button data-file="one" data-type="gif,png,jpg,jpeg" data-path="{$get.path|default=''}"
<button data-file="one" data-type="gif,png,jpg,jpeg"
data-path="{$get.path|default=''}" data-size="{$get.size|default=0}"
data-cut-width="{$get.cutWidth|default=0}" data-cut-height="{$get.cutHeight|default=0}"
data-max-width="{$get.maxWidth|default=0}" data-max-height="{$get.maxHeight|default=0}"
></button>
{else}
<button data-file="mul" data-type="gif,png,jpg,jpeg" data-path="{$get.path|default=''}"
<button data-file="mul" data-type="gif,png,jpg,jpeg"
data-path="{$get.path|default=''}" data-size="{$get.size|default=0}"
data-cut-width="{$get.cutWidth|default=0}" data-cut-height="{$get.cutHeight|default=0}"
data-max-width="{$get.maxWidth|default=0}" data-max-height="{$get.maxHeight|default=0}"
></button>