浏览代码

新增Ajax请求自定义加载动画
新增Fast.api.msg提示
优化Tooltip显示位置
修复后台编辑时不做修改保存时提示错误的BUG
修复后台Validate验证器不提示消息的BUG
修复后台启用editable后导出数据丢失的BUG
修复后台附件写入uploadtime错误的BUG

Karson 6 年之前
父节点
当前提交
407a8eeaa5

+ 1 - 0
application/admin/lang/zh-cn.php

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

+ 2 - 1
application/admin/lang/zh-cn/category.php

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

+ 6 - 6
application/admin/library/traits/Backend.php

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

+ 4 - 0
application/admin/view/category/add.html

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

+ 1 - 1
application/common/model/Attachment.php

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

+ 1 - 1
bower.json

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

+ 1 - 1
public/assets/js/backend.js

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

+ 1 - 0
public/assets/js/backend/category.js

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

+ 16 - 3
public/assets/js/fast.js

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

+ 1 - 1
public/assets/js/frontend.js

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

文件差异内容过多而无法显示
+ 89 - 78
public/assets/js/require-backend.min.js


文件差异内容过多而无法显示
+ 18 - 5
public/assets/js/require-frontend.min.js