新增Ajax请求自定义加载动画

新增Fast.api.msg提示
优化Tooltip显示位置
修复后台编辑时不做修改保存时提示错误的BUG
修复后台Validate验证器不提示消息的BUG
修复后台启用editable后导出数据丢失的BUG
修复后台附件写入uploadtime错误的BUG
pull/117/MERGE
Karson 2019-04-18 17:03:55 +08:00
parent 9db281a4c6
commit 407a8eeaa5
12 changed files with 141 additions and 97 deletions

View File

@ -130,6 +130,7 @@ return [
'Network error' => '网络错误!',
'Invalid parameters' => '未知参数',
'No results were found' => '记录未找到',
'No rows were inserted' => '未插入任何行',
'No rows were deleted' => '未删除任何行',
'No rows were updated' => '未更新任何行',
'Parameter %s can not be empty' => '参数%s不能为空',

View File

@ -3,7 +3,7 @@
return [
'Id' => 'ID',
'Pid' => '父ID',
'Type' => '栏目类型',
'Type' => '类型',
'All' => '全部',
'Image' => '图片',
'Keywords' => '关键字',
@ -12,6 +12,7 @@ return [
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Weigh' => '权重',
'Category warmtips' => '温馨提示:栏目类型请前往<b>常规管理</b>-><b>系统配置</b>-><b>字典配置</b>中进行管理',
'Can not change the parent to child' => '父组别不能是它的子组别',
'Status' => '状态'
];

View File

@ -118,7 +118,7 @@ trait Backend
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validate($validate);
$this->model->validateFailException(true)->validate($validate);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
@ -132,10 +132,10 @@ trait Backend
Db::rollback();
$this->error($e->getMessage());
}
if ($result) {
if ($result !== false) {
$this->success();
} else {
$this->error();
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
@ -169,7 +169,7 @@ trait Backend
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validate($validate);
$row->validateFailException(true)->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
@ -183,10 +183,10 @@ trait Backend
Db::rollback();
$this->error($e->getMessage());
}
if ($result) {
if ($result !== false) {
$this->success();
} else {
$this->error();
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));

View File

@ -1,5 +1,9 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="alert alert-warning-light">
{:__('Category warmtips')}
</div>
<div class="form-group">
<label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -18,7 +18,7 @@ class Attachment extends Model
public function setUploadtimeAttr($value)
{
return strtotime($value);
return is_numeric($value) ? $value : strtotime($value);
}
protected static function init()

View File

@ -19,7 +19,7 @@
"bootstrap-select": "~1.11.2",
"require-css": "~0.1.8",
"less": "~2.7.1",
"tableExport.jquery.plugin": "~1.9.0",
"tableExport.jquery.plugin": "~1.10.3",
"jquery-slimscroll": "~1.3.8",
"jquery.cookie": "~1.4.1",
"Sortable": "~1.5.0",

View File

@ -241,7 +241,7 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
}
//tooltip和popover
if (!('ontouchstart' in document.documentElement)) {
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
$('body').tooltip({selector: '[data-toggle="tooltip"]', container: 'body'});
}
$('body').popover({selector: '[data-toggle="popover"]'});
}

View File

@ -68,6 +68,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
add: function () {
Controller.api.bindevent();
$("#c-type").trigger("change");
},
edit: function () {
Controller.api.bindevent();

View File

@ -61,12 +61,15 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
//发送Ajax请求
ajax: function (options, success, error) {
options = typeof options === 'string' ? {url: options} : options;
var index = Layer.load();
var index;
if (typeof options.loading === 'undefined' || options.loading) {
index = Layer.load(options.loading || 0);
}
options = $.extend({
type: "POST",
dataType: "json",
success: function (ret) {
Layer.close(index);
index && Layer.close(index);
ret = Fast.events.onAjaxResponse(ret);
if (ret.code === 1) {
Fast.events.onAjaxSuccess(ret, success);
@ -75,7 +78,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
}
},
error: function (xhr) {
Layer.close(index);
index && Layer.close(index);
var ret = {code: xhr.status, msg: xhr.statusText, data: null};
Fast.events.onAjaxError(ret, error);
}
@ -247,6 +250,16 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
offset: 0, icon: 2
}, type ? {} : options), callback);
},
msg: function (message, url) {
var callback = typeof url === 'function' ? url : function () {
if (typeof url !== 'undefined' && url) {
location.href = url;
}
};
Layer.msg(message, {
time: 2000
}, callback);
},
toastr: Toastr,
layer: Layer
},

View File

@ -51,7 +51,7 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) {
});
//tooltip和popover
if (!('ontouchstart' in document.documentElement)) {
$('body').tooltip({selector: '[data-toggle="tooltip"]'});
$('body').tooltip({selector: '[data-toggle="tooltip"]', container: 'body'});
}
$('body').popover({selector: '[data-toggle="popover"]'});
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long