mirror of https://gitee.com/karson/fastadmin.git
新增上传的onUploadProgress和onUploadComplete事件
新增后台Auth类getError和setError方法 修复组权限管理在特殊情况下无法加载权限的BUG 修复Upload.api.send无法上传至第三方存储的BUG 优化Layer.msg的样式显示pull/45/head
parent
e67192a2d7
commit
3ea5689a0b
|
|
@ -86,7 +86,9 @@ class Index extends Backend
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->error(__('Username or password is incorrect'), $url, ['token' => $this->request->token()]);
|
||||
$msg = $this->auth->getError();
|
||||
$msg = $msg ? $msg : __('Username or password is incorrect');
|
||||
$this->error($msg, $url, ['token' => $this->request->token()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -242,28 +242,28 @@ class Group extends Backend
|
|||
$model = model('AuthGroup');
|
||||
$id = $this->request->post("id");
|
||||
$pid = $this->request->post("pid");
|
||||
$parentgroupmodel = $model->get($pid);
|
||||
$currentgroupmodel = NULL;
|
||||
$parentGroupModel = $model->get($pid);
|
||||
$currentGroupModel = NULL;
|
||||
if ($id)
|
||||
{
|
||||
$currentgroupmodel = $model->get($id);
|
||||
$currentGroupModel = $model->get($id);
|
||||
}
|
||||
if (($pid || $parentgroupmodel) && (!$id || $currentgroupmodel))
|
||||
if (($pid || $parentGroupModel) && (!$id || $currentGroupModel))
|
||||
{
|
||||
$id = $id ? $id : NULL;
|
||||
$ruleList = collection(model('AuthRule')->order('weigh', 'desc')->select())->toArray();
|
||||
//读取父类角色所有节点列表
|
||||
$parentRuleList = [];
|
||||
if (in_array('*', explode(',', $parentgroupmodel->rules)))
|
||||
if (in_array('*', explode(',', $parentGroupModel->rules)))
|
||||
{
|
||||
$parentRuleList = $ruleList;
|
||||
}
|
||||
else
|
||||
{
|
||||
$parent_rule_ids = explode(',', $parentgroupmodel->rules);
|
||||
$parentRuleIds = explode(',', $parentGroupModel->rules);
|
||||
foreach ($ruleList as $k => $v)
|
||||
{
|
||||
if (in_array($v['id'], $parent_rule_ids))
|
||||
if (in_array($v['id'], $parentRuleIds))
|
||||
{
|
||||
$parentRuleList[] = $v;
|
||||
}
|
||||
|
|
@ -271,33 +271,38 @@ class Group extends Backend
|
|||
}
|
||||
|
||||
//当前所有正常规则列表
|
||||
Tree::instance()->init($ruleList);
|
||||
Tree::instance()->init($parentRuleList);
|
||||
|
||||
//读取当前角色下规则ID集合
|
||||
$admin_rule_ids = $this->auth->getRuleIds();
|
||||
$adminRuleIds = $this->auth->getRuleIds();
|
||||
//是否是超级管理员
|
||||
$superadmin = $this->auth->isSuperAdmin();
|
||||
//当前拥有的规则ID集合
|
||||
$current_rule_ids = $id ? explode(',', $currentgroupmodel->rules) : [];
|
||||
$currentRuleIds = $id ? explode(',', $currentGroupModel->rules) : [];
|
||||
|
||||
if (!$id || !in_array($pid, Tree::instance()->getChildrenIds($id, TRUE)))
|
||||
{
|
||||
$ruleList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
|
||||
$parentRuleList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
|
||||
$hasChildrens = [];
|
||||
foreach ($ruleList as $k => $v)
|
||||
foreach ($parentRuleList as $k => $v)
|
||||
{
|
||||
if ($v['haschild'])
|
||||
$hasChildrens[] = $v['id'];
|
||||
}
|
||||
$nodelist = [];
|
||||
$parentRuleIds = array_map(function($item) {
|
||||
return $item['id'];
|
||||
}, $parentRuleList);
|
||||
$nodeList = [];
|
||||
foreach ($parentRuleList as $k => $v)
|
||||
{
|
||||
if (!$superadmin && !in_array($v['id'], $admin_rule_ids))
|
||||
if (!$superadmin && !in_array($v['id'], $adminRuleIds))
|
||||
continue;
|
||||
$state = array('selected' => in_array($v['id'], $current_rule_ids) && !in_array($v['id'], $hasChildrens));
|
||||
$nodelist[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state);
|
||||
if ($v['pid'] && !in_array($v['pid'], $parentRuleIds))
|
||||
continue;
|
||||
$state = array('selected' => in_array($v['id'], $currentRuleIds) && !in_array($v['id'], $hasChildrens));
|
||||
$nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state);
|
||||
}
|
||||
$this->success('', null, $nodelist);
|
||||
$this->success('', null, $nodeList);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ return [
|
|||
'Recommend' => '推荐',
|
||||
'Dashboard' => '控制台',
|
||||
'Upload' => '上传',
|
||||
'Uploading' => '上传中',
|
||||
'Code' => '编号',
|
||||
'Message' => '内容',
|
||||
'Line' => '行号',
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
|
||||
return [
|
||||
'Group' => '所属组别',
|
||||
'Loginfailure' => '登录失败次数',
|
||||
'Login time' => '最后登录',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ return [
|
|||
'Username or password is incorrect' => '用户名或密码不正确',
|
||||
'Username is incorrect' => '用户名不正确',
|
||||
'Password is incorrect' => '密码不正确',
|
||||
'Please try again after 1 day' => '请于1天后再尝试登录',
|
||||
'Login successful' => '登录成功!',
|
||||
'Logout successful' => '退出成功!',
|
||||
'Verification code is incorrect' => '验证码不正确',
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use think\Session;
|
|||
class Auth extends \fast\Auth
|
||||
{
|
||||
|
||||
protected $_error = '';
|
||||
protected $requestUri = '';
|
||||
protected $breadcrumb = [];
|
||||
protected $logined = false; //登录状态
|
||||
|
|
@ -40,16 +41,19 @@ class Auth extends \fast\Auth
|
|||
$admin = Admin::get(['username' => $username]);
|
||||
if (!$admin)
|
||||
{
|
||||
$this->setError('Username is incorrect');
|
||||
return false;
|
||||
}
|
||||
if ($admin->loginfailure >= 3 && time() - $admin->updatetime < 86400)
|
||||
{
|
||||
$this->setError('Please try again after 1 day');
|
||||
return false;
|
||||
}
|
||||
if ($admin->password != md5(md5($password) . $admin->salt))
|
||||
{
|
||||
$admin->loginfailure++;
|
||||
$admin->save();
|
||||
$this->setError('Password is incorrect');
|
||||
return false;
|
||||
}
|
||||
$admin->loginfailure = 0;
|
||||
|
|
@ -424,4 +428,24 @@ class Auth extends \fast\Auth
|
|||
return $menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置错误信息
|
||||
*
|
||||
* @param $error 错误信息
|
||||
*/
|
||||
public function setError($error)
|
||||
{
|
||||
$this->_error = $error;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取错误信息
|
||||
* @return string
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->_error ? __($this->_error) : '';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@
|
|||
<input type="password" class="form-control" id="password" name="row[password]" autocomplete="new-password" value="" data-rule="password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="loginfailure" class="control-label col-xs-12 col-sm-2">{:__('Loginfailure')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input type="number" class="form-control" id="loginfailure" name="row[loginfailure]" value="{$row.loginfailure}" data-rule="required" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="content" class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>标题</th>
|
||||
<th>内容</th>
|
||||
<th>{:__('Title')}</th>
|
||||
<th>{:__('Content')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="row" id="vo" }
|
||||
<tr>
|
||||
<td>{$key}</td>
|
||||
<td>{:__($key)}</td>
|
||||
<td>{$vo}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
|
|
|
|||
|
|
@ -715,6 +715,19 @@ form.form-horizontal .control-label {
|
|||
.layui-layer-fast .layui-layer-setwin .layui-layer-close2:hover:after {
|
||||
display: none;
|
||||
}
|
||||
.layui-layer-content {
|
||||
clear: both;
|
||||
}
|
||||
.layui-layer-fast-msg {
|
||||
min-width: 100px;
|
||||
border-radius: 2px;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
color: #fff;
|
||||
}
|
||||
.layui-layer-fast-msg .layui-layer-content {
|
||||
padding: 12px 25px;
|
||||
text-align: center;
|
||||
}
|
||||
.n-bootstrap .input-group > .n-right {
|
||||
position: absolute;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -10200,11 +10200,18 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
up.start();
|
||||
}, 1);
|
||||
},
|
||||
//上传进行中的回调
|
||||
onUploadProgress: function (up, file) {
|
||||
|
||||
},
|
||||
//上传之前的回调
|
||||
onBeforeUpload: function (up, file) {
|
||||
console.log("before", up.settings);
|
||||
|
||||
},
|
||||
//上传成功的回调
|
||||
onUploadSuccess: function (ret, onUploadSuccess, button) {
|
||||
onUploadSuccess: function (up, ret) {
|
||||
var button = up.settings.button;
|
||||
var onUploadSuccess = up.settings.onUploadSuccess;
|
||||
var data = typeof ret.data !== 'undefined' ? ret.data : null;
|
||||
//上传成功后回调
|
||||
if (button) {
|
||||
|
|
@ -10240,7 +10247,9 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
}
|
||||
},
|
||||
//上传错误的回调
|
||||
onUploadError: function (ret, onUploadError, button) {
|
||||
onUploadError: function (up, ret) {
|
||||
var button = up.settings.button;
|
||||
var onUploadError = up.settings.onUploadError;
|
||||
var data = typeof ret.data !== 'undefined' ? ret.data : null;
|
||||
if (button) {
|
||||
var onDomUploadError = $(button).data("upload-error");
|
||||
|
|
@ -10275,11 +10284,36 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
var ret = {code: -1, msg: e.message, data: null};
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
//上传全部结束后
|
||||
onUploadComplete: function (up, files) {
|
||||
var button = up.settings.button;
|
||||
var onUploadComplete = up.settings.onUploadComplete;
|
||||
if (button) {
|
||||
var onDomUploadComplete = $(button).data("upload-complete");
|
||||
if (onDomUploadComplete) {
|
||||
if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
|
||||
onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
|
||||
}
|
||||
if (typeof onDomUploadComplete === 'function') {
|
||||
var result = onDomUploadComplete.call(button, files);
|
||||
if (result === false)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof onUploadComplete === 'function') {
|
||||
var result = onUploadComplete.call(button, files);
|
||||
if (result === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
api: {
|
||||
//Plupload上传
|
||||
plupload: function (element, onUploadSuccess, onUploadError) {
|
||||
plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
element = typeof element === 'undefined' ? Upload.config.classname : element;
|
||||
$(element, Upload.config.container).each(function () {
|
||||
if ($(this).attr("initialized")) {
|
||||
|
|
@ -10341,30 +10375,32 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
BeforeUpload: Upload.events.onBeforeUpload,
|
||||
UploadProgress: function (up, file) {
|
||||
var button = up.settings.button;
|
||||
//这里可以改成其它的表现形式
|
||||
//document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
|
||||
$(button).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + file.percent + "%");
|
||||
Upload.events.onUploadProgress(up, file);
|
||||
},
|
||||
FileUploaded: function (up, file, info) {
|
||||
var button = up.settings.button;
|
||||
//还原按钮文字及状态
|
||||
$(button).prop("disabled", false).html($(button).data("bakup-html"));
|
||||
var ret = Upload.events.onUploadResponse(info.response, info, up, file);
|
||||
file.ret = ret;
|
||||
if (ret.code === 1) {
|
||||
Upload.events.onUploadSuccess(ret, onUploadSuccess, button, up, file);
|
||||
Upload.events.onUploadSuccess(up, ret, file);
|
||||
} else {
|
||||
Upload.events.onUploadError(ret, onUploadError, button, up, file);
|
||||
Upload.events.onUploadError(up, ret, file);
|
||||
}
|
||||
},
|
||||
UploadComplete: Upload.events.onUploadComplete,
|
||||
Error: function (up, err) {
|
||||
var button = up.settings.button;
|
||||
$(button).prop("disabled", false).html($(button).data("bakup-html"));
|
||||
var ret = {code: err.code, msg: err.message, data: null};
|
||||
Upload.events.onUploadError(ret, onUploadError, button, up, null);
|
||||
Upload.events.onUploadError(up, ret);
|
||||
}
|
||||
},
|
||||
onUploadSuccess: onUploadSuccess,
|
||||
onUploadError: onUploadError,
|
||||
onUploadComplete: onUploadComplete,
|
||||
button: that
|
||||
});
|
||||
|
||||
|
|
@ -10418,31 +10454,21 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
|||
});
|
||||
},
|
||||
// AJAX异步上传
|
||||
send: function (file, onUploadSuccess, onUploadError) {
|
||||
var data = new FormData();
|
||||
data.append("file", file);
|
||||
$.each(Config.upload.multipart, function (k, v) {
|
||||
data.append(k, v);
|
||||
});
|
||||
$.ajax({
|
||||
url: Config.upload.uploadurl,
|
||||
data: data,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
type: 'POST',
|
||||
success: function (ret) {
|
||||
ret = Upload.events.onUploadResponse(ret);
|
||||
if (ret.code === 1) {
|
||||
Upload.events.onUploadSuccess(ret, onUploadSuccess);
|
||||
} else {
|
||||
Upload.events.onUploadError(ret, onUploadError);
|
||||
}
|
||||
}, error: function (e) {
|
||||
var ret = {code: 500, msg: e.message, data: null};
|
||||
Upload.events.onUploadError(ret, onUploadError);
|
||||
}
|
||||
send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
|
||||
var id = Plupload.guid();
|
||||
var _onPostInit = Upload.events.onPostInit;
|
||||
Upload.events.onPostInit = function () {
|
||||
// 当加载完成后添加文件并上传
|
||||
Upload.list[id].addFile(file);
|
||||
//Upload.list[id].start();
|
||||
};
|
||||
$('<button type="button" id="' + id + '" class="btn btn-danger hidden plupload" />').appendTo("body");
|
||||
$("#" + id).data("upload-complete", function (files) {
|
||||
Upload.events.onPostInit = _onPostInit;
|
||||
Layer.close(index);
|
||||
});
|
||||
Upload.api.plupload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
|
||||
},
|
||||
custom: {
|
||||
//自定义上传完成回调
|
||||
|
|
|
|||
|
|
@ -38,11 +38,18 @@ define(['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined,
|
|||
up.start();
|
||||
}, 1);
|
||||
},
|
||||
//上传进行中的回调
|
||||
onUploadProgress: function (up, file) {
|
||||
|
||||
},
|
||||
//上传之前的回调
|
||||
onBeforeUpload: function (up, file) {
|
||||
console.log("before", up.settings);
|
||||
|
||||
},
|
||||
//上传成功的回调
|
||||
onUploadSuccess: function (ret, onUploadSuccess, button) {
|
||||
onUploadSuccess: function (up, ret) {
|
||||
var button = up.settings.button;
|
||||
var onUploadSuccess = up.settings.onUploadSuccess;
|
||||
var data = typeof ret.data !== 'undefined' ? ret.data : null;
|
||||
//上传成功后回调
|
||||
if (button) {
|
||||
|
|
@ -78,7 +85,9 @@ define(['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined,
|
|||
}
|
||||
},
|
||||
//上传错误的回调
|
||||
onUploadError: function (ret, onUploadError, button) {
|
||||
onUploadError: function (up, ret) {
|
||||
var button = up.settings.button;
|
||||
var onUploadError = up.settings.onUploadError;
|
||||
var data = typeof ret.data !== 'undefined' ? ret.data : null;
|
||||
if (button) {
|
||||
var onDomUploadError = $(button).data("upload-error");
|
||||
|
|
@ -113,11 +122,36 @@ define(['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined,
|
|||
var ret = {code: -1, msg: e.message, data: null};
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
//上传全部结束后
|
||||
onUploadComplete: function (up, files) {
|
||||
var button = up.settings.button;
|
||||
var onUploadComplete = up.settings.onUploadComplete;
|
||||
if (button) {
|
||||
var onDomUploadComplete = $(button).data("upload-complete");
|
||||
if (onDomUploadComplete) {
|
||||
if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
|
||||
onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
|
||||
}
|
||||
if (typeof onDomUploadComplete === 'function') {
|
||||
var result = onDomUploadComplete.call(button, files);
|
||||
if (result === false)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof onUploadComplete === 'function') {
|
||||
var result = onUploadComplete.call(button, files);
|
||||
if (result === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
api: {
|
||||
//Plupload上传
|
||||
plupload: function (element, onUploadSuccess, onUploadError) {
|
||||
plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
element = typeof element === 'undefined' ? Upload.config.classname : element;
|
||||
$(element, Upload.config.container).each(function () {
|
||||
if ($(this).attr("initialized")) {
|
||||
|
|
@ -179,30 +213,32 @@ define(['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined,
|
|||
BeforeUpload: Upload.events.onBeforeUpload,
|
||||
UploadProgress: function (up, file) {
|
||||
var button = up.settings.button;
|
||||
//这里可以改成其它的表现形式
|
||||
//document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
|
||||
$(button).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + file.percent + "%");
|
||||
Upload.events.onUploadProgress(up, file);
|
||||
},
|
||||
FileUploaded: function (up, file, info) {
|
||||
var button = up.settings.button;
|
||||
//还原按钮文字及状态
|
||||
$(button).prop("disabled", false).html($(button).data("bakup-html"));
|
||||
var ret = Upload.events.onUploadResponse(info.response, info, up, file);
|
||||
file.ret = ret;
|
||||
if (ret.code === 1) {
|
||||
Upload.events.onUploadSuccess(ret, onUploadSuccess, button, up, file);
|
||||
Upload.events.onUploadSuccess(up, ret, file);
|
||||
} else {
|
||||
Upload.events.onUploadError(ret, onUploadError, button, up, file);
|
||||
Upload.events.onUploadError(up, ret, file);
|
||||
}
|
||||
},
|
||||
UploadComplete: Upload.events.onUploadComplete,
|
||||
Error: function (up, err) {
|
||||
var button = up.settings.button;
|
||||
$(button).prop("disabled", false).html($(button).data("bakup-html"));
|
||||
var ret = {code: err.code, msg: err.message, data: null};
|
||||
Upload.events.onUploadError(ret, onUploadError, button, up, null);
|
||||
Upload.events.onUploadError(up, ret);
|
||||
}
|
||||
},
|
||||
onUploadSuccess: onUploadSuccess,
|
||||
onUploadError: onUploadError,
|
||||
onUploadComplete: onUploadComplete,
|
||||
button: that
|
||||
});
|
||||
|
||||
|
|
@ -256,31 +292,21 @@ define(['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined,
|
|||
});
|
||||
},
|
||||
// AJAX异步上传
|
||||
send: function (file, onUploadSuccess, onUploadError) {
|
||||
var data = new FormData();
|
||||
data.append("file", file);
|
||||
$.each(Config.upload.multipart, function (k, v) {
|
||||
data.append(k, v);
|
||||
});
|
||||
$.ajax({
|
||||
url: Config.upload.uploadurl,
|
||||
data: data,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
type: 'POST',
|
||||
success: function (ret) {
|
||||
ret = Upload.events.onUploadResponse(ret);
|
||||
if (ret.code === 1) {
|
||||
Upload.events.onUploadSuccess(ret, onUploadSuccess);
|
||||
} else {
|
||||
Upload.events.onUploadError(ret, onUploadError);
|
||||
}
|
||||
}, error: function (e) {
|
||||
var ret = {code: 500, msg: e.message, data: null};
|
||||
Upload.events.onUploadError(ret, onUploadError);
|
||||
}
|
||||
send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
|
||||
var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
|
||||
var id = Plupload.guid();
|
||||
var _onPostInit = Upload.events.onPostInit;
|
||||
Upload.events.onPostInit = function () {
|
||||
// 当加载完成后添加文件并上传
|
||||
Upload.list[id].addFile(file);
|
||||
//Upload.list[id].start();
|
||||
};
|
||||
$('<button type="button" id="' + id + '" class="btn btn-danger hidden plupload" />').appendTo("body");
|
||||
$("#" + id).data("upload-complete", function (files) {
|
||||
Upload.events.onPostInit = _onPostInit;
|
||||
Layer.close(index);
|
||||
});
|
||||
Upload.api.plupload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
|
||||
},
|
||||
custom: {
|
||||
//自定义上传完成回调
|
||||
|
|
|
|||
|
|
@ -744,6 +744,19 @@ form.form-horizontal .control-label {
|
|||
}
|
||||
}
|
||||
}
|
||||
.layui-layer-content {
|
||||
clear: both;
|
||||
}
|
||||
.layui-layer-fast-msg {
|
||||
min-width: 100px;
|
||||
border-radius: 2px;
|
||||
background-color: rgba(0,0,0,.6);
|
||||
color: #fff;
|
||||
.layui-layer-content {
|
||||
padding: 12px 25px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.n-bootstrap {
|
||||
.input-group > .n-right {
|
||||
|
|
|
|||
Loading…
Reference in New Issue