Browse Source

菜单点击选中效果

update
jqh 5 years ago
parent
commit
5baa303556

+ 25 - 0
resources/assets/dcat/js/bootstrappers/Menu.js

@@ -0,0 +1,25 @@
+
+export default class Menu {
+    constructor(Dcat) {
+        this.bindClick();
+    }
+
+    // 菜单点击选中效果
+    bindClick() {
+        let $content = $('.main-menu-content'),
+            $items = $content.find('li.nav-item'),
+            $hasSubItems = $content.find('li.has-sub');
+
+        $items.find('a').click(function () {
+            let href = $(this).attr('href');
+            if (! href || href === '#') {
+                return;
+            }
+
+            $items.removeClass('active');
+            $hasSubItems.removeClass('sidebar-group-active');
+
+            $(this).parent().addClass('active')
+        });
+    }
+}

+ 2 - 0
resources/assets/dcat/js/dcat-app.js

@@ -20,6 +20,7 @@ import Grid from './extensions/Grid'
 import Form from './extensions/Form'
 import DialogForm from './extensions/DialogForm'
 
+import Menu from './bootstrappers/Menu'
 import Footer from './bootstrappers/Footer'
 import Pjax from './bootstrappers/Pjax'
 
@@ -56,6 +57,7 @@ function extend (Dcat) {
 // 初始化
 function listen(Dcat) {
     Dcat.booting(function () {
+        new Menu(Dcat);
         new Footer(Dcat);
         new Pjax(Dcat);
 

+ 36 - 36
resources/dist/css/plugins/loaders/animations/ball-grid-beat.css

@@ -27,66 +27,66 @@
 }
 
 .ball-grid-beat > div:nth-child(1) {
-  -webkit-animation-delay: -0.08s;
-          animation-delay: -0.08s;
-  -webkit-animation-duration: 0.75s;
-          animation-duration: 0.75s;
+  -webkit-animation-delay: 0.13s;
+          animation-delay: 0.13s;
+  -webkit-animation-duration: 1.11s;
+          animation-duration: 1.11s;
 }
 
 .ball-grid-beat > div:nth-child(2) {
-  -webkit-animation-delay: 0.18s;
-          animation-delay: 0.18s;
-  -webkit-animation-duration: 0.94s;
-          animation-duration: 0.94s;
+  -webkit-animation-delay: 0.53s;
+          animation-delay: 0.53s;
+  -webkit-animation-duration: 0.96s;
+          animation-duration: 0.96s;
 }
 
 .ball-grid-beat > div:nth-child(3) {
-  -webkit-animation-delay: 0.25s;
-          animation-delay: 0.25s;
-  -webkit-animation-duration: 0.73s;
-          animation-duration: 0.73s;
+  -webkit-animation-delay: 0.03s;
+          animation-delay: 0.03s;
+  -webkit-animation-duration: 0.83s;
+          animation-duration: 0.83s;
 }
 
 .ball-grid-beat > div:nth-child(4) {
-  -webkit-animation-delay: 0.05s;
-          animation-delay: 0.05s;
-  -webkit-animation-duration: 1.45s;
-          animation-duration: 1.45s;
+  -webkit-animation-delay: 0.25s;
+          animation-delay: 0.25s;
+  -webkit-animation-duration: 1.04s;
+          animation-duration: 1.04s;
 }
 
 .ball-grid-beat > div:nth-child(5) {
-  -webkit-animation-delay: 0.05s;
-          animation-delay: 0.05s;
-  -webkit-animation-duration: 1.29s;
-          animation-duration: 1.29s;
+  -webkit-animation-delay: 0.19s;
+          animation-delay: 0.19s;
+  -webkit-animation-duration: 0.82s;
+          animation-duration: 0.82s;
 }
 
 .ball-grid-beat > div:nth-child(6) {
-  -webkit-animation-delay: 0.15s;
-          animation-delay: 0.15s;
-  -webkit-animation-duration: 1.12s;
-          animation-duration: 1.12s;
+  -webkit-animation-delay: 0.51s;
+          animation-delay: 0.51s;
+  -webkit-animation-duration: 1.51s;
+          animation-duration: 1.51s;
 }
 
 .ball-grid-beat > div:nth-child(7) {
-  -webkit-animation-delay: 0.63s;
-          animation-delay: 0.63s;
-  -webkit-animation-duration: 1.07s;
-          animation-duration: 1.07s;
+  -webkit-animation-delay: -0.01s;
+          animation-delay: -0.01s;
+  -webkit-animation-duration: 0.96s;
+          animation-duration: 0.96s;
 }
 
 .ball-grid-beat > div:nth-child(8) {
-  -webkit-animation-delay: 0.75s;
-          animation-delay: 0.75s;
-  -webkit-animation-duration: 0.92s;
-          animation-duration: 0.92s;
+  -webkit-animation-delay: 0.58s;
+          animation-delay: 0.58s;
+  -webkit-animation-duration: 1.57s;
+          animation-duration: 1.57s;
 }
 
 .ball-grid-beat > div:nth-child(9) {
-  -webkit-animation-delay: 0.01s;
-          animation-delay: 0.01s;
-  -webkit-animation-duration: 1.08s;
-          animation-duration: 1.08s;
+  -webkit-animation-delay: -0.04s;
+          animation-delay: -0.04s;
+  -webkit-animation-duration: 1.1s;
+          animation-duration: 1.1s;
 }
 
 .ball-grid-beat > div {

+ 36 - 36
resources/dist/css/plugins/loaders/animations/ball-grid-pulse.css

@@ -39,66 +39,66 @@
 }
 
 .ball-grid-pulse > div:nth-child(1) {
-  -webkit-animation-delay: 0.75s;
-          animation-delay: 0.75s;
-  -webkit-animation-duration: 0.93s;
-          animation-duration: 0.93s;
+  -webkit-animation-delay: 0.37s;
+          animation-delay: 0.37s;
+  -webkit-animation-duration: 0.78s;
+          animation-duration: 0.78s;
 }
 
 .ball-grid-pulse > div:nth-child(2) {
-  -webkit-animation-delay: 0.58s;
-          animation-delay: 0.58s;
-  -webkit-animation-duration: 1.35s;
-          animation-duration: 1.35s;
+  -webkit-animation-delay: -0.08s;
+          animation-delay: -0.08s;
+  -webkit-animation-duration: 0.67s;
+          animation-duration: 0.67s;
 }
 
 .ball-grid-pulse > div:nth-child(3) {
-  -webkit-animation-delay: -0.01s;
-          animation-delay: -0.01s;
-  -webkit-animation-duration: 1.13s;
-          animation-duration: 1.13s;
+  -webkit-animation-delay: -0.11s;
+          animation-delay: -0.11s;
+  -webkit-animation-duration: 0.73s;
+          animation-duration: 0.73s;
 }
 
 .ball-grid-pulse > div:nth-child(4) {
-  -webkit-animation-delay: 0.27s;
-          animation-delay: 0.27s;
-  -webkit-animation-duration: 1.49s;
-          animation-duration: 1.49s;
+  -webkit-animation-delay: 0.56s;
+          animation-delay: 0.56s;
+  -webkit-animation-duration: 1.44s;
+          animation-duration: 1.44s;
 }
 
 .ball-grid-pulse > div:nth-child(5) {
-  -webkit-animation-delay: 0.59s;
-          animation-delay: 0.59s;
-  -webkit-animation-duration: 1.57s;
-          animation-duration: 1.57s;
+  -webkit-animation-delay: 0.58s;
+          animation-delay: 0.58s;
+  -webkit-animation-duration: 1.37s;
+          animation-duration: 1.37s;
 }
 
 .ball-grid-pulse > div:nth-child(6) {
-  -webkit-animation-delay: 0.03s;
-          animation-delay: 0.03s;
-  -webkit-animation-duration: 0.82s;
-          animation-duration: 0.82s;
+  -webkit-animation-delay: -0.05s;
+          animation-delay: -0.05s;
+  -webkit-animation-duration: 1.49s;
+          animation-duration: 1.49s;
 }
 
 .ball-grid-pulse > div:nth-child(7) {
-  -webkit-animation-delay: -0.04s;
-          animation-delay: -0.04s;
-  -webkit-animation-duration: 1.26s;
-          animation-duration: 1.26s;
+  -webkit-animation-delay: 0.78s;
+          animation-delay: 0.78s;
+  -webkit-animation-duration: 1.16s;
+          animation-duration: 1.16s;
 }
 
 .ball-grid-pulse > div:nth-child(8) {
-  -webkit-animation-delay: 0.37s;
-          animation-delay: 0.37s;
-  -webkit-animation-duration: 1.52s;
-          animation-duration: 1.52s;
+  -webkit-animation-delay: 0.4s;
+          animation-delay: 0.4s;
+  -webkit-animation-duration: 1.09s;
+          animation-duration: 1.09s;
 }
 
 .ball-grid-pulse > div:nth-child(9) {
-  -webkit-animation-delay: -0.07s;
-          animation-delay: -0.07s;
-  -webkit-animation-duration: 1.41s;
-          animation-duration: 1.41s;
+  -webkit-animation-delay: 0.77s;
+          animation-delay: 0.77s;
+  -webkit-animation-duration: 1.27s;
+          animation-duration: 1.27s;
 }
 
 .ball-grid-pulse > div {

+ 16 - 16
resources/dist/css/plugins/loaders/animations/line-scale-random.css

@@ -31,31 +31,31 @@
 }
 
 .line-scale-party > div:nth-child(1) {
-  -webkit-animation-delay: -0.14s;
-          animation-delay: -0.14s;
-  -webkit-animation-duration: 1.05s;
-          animation-duration: 1.05s;
+  -webkit-animation-delay: 0.43s;
+          animation-delay: 0.43s;
+  -webkit-animation-duration: 0.96s;
+          animation-duration: 0.96s;
 }
 
 .line-scale-party > div:nth-child(2) {
-  -webkit-animation-delay: 0.14s;
-          animation-delay: 0.14s;
-  -webkit-animation-duration: 1.01s;
-          animation-duration: 1.01s;
+  -webkit-animation-delay: 0.76s;
+          animation-delay: 0.76s;
+  -webkit-animation-duration: 0.37s;
+          animation-duration: 0.37s;
 }
 
 .line-scale-party > div:nth-child(3) {
-  -webkit-animation-delay: 0.37s;
-          animation-delay: 0.37s;
-  -webkit-animation-duration: 1.29s;
-          animation-duration: 1.29s;
+  -webkit-animation-delay: 0.68s;
+          animation-delay: 0.68s;
+  -webkit-animation-duration: 0.61s;
+          animation-duration: 0.61s;
 }
 
 .line-scale-party > div:nth-child(4) {
-  -webkit-animation-delay: 0.45s;
-          animation-delay: 0.45s;
-  -webkit-animation-duration: 1.04s;
-          animation-duration: 1.04s;
+  -webkit-animation-delay: 0.01s;
+          animation-delay: 0.01s;
+  -webkit-animation-duration: 0.65s;
+          animation-duration: 0.65s;
 }
 
 .line-scale-party > div {

+ 88 - 88
resources/dist/css/plugins/loaders/loaders.css

@@ -1454,66 +1454,66 @@
 }
 
 .ball-grid-beat > div:nth-child(1) {
-  -webkit-animation-delay: -0.13s;
-          animation-delay: -0.13s;
-  -webkit-animation-duration: 1.48s;
-          animation-duration: 1.48s;
+  -webkit-animation-delay: 0.8s;
+          animation-delay: 0.8s;
+  -webkit-animation-duration: 0.79s;
+          animation-duration: 0.79s;
 }
 
 .ball-grid-beat > div:nth-child(2) {
-  -webkit-animation-delay: 0.54s;
-          animation-delay: 0.54s;
-  -webkit-animation-duration: 1.12s;
-          animation-duration: 1.12s;
+  -webkit-animation-delay: 0.23s;
+          animation-delay: 0.23s;
+  -webkit-animation-duration: 0.68s;
+          animation-duration: 0.68s;
 }
 
 .ball-grid-beat > div:nth-child(3) {
-  -webkit-animation-delay: 0.54s;
-          animation-delay: 0.54s;
-  -webkit-animation-duration: 0.98s;
-          animation-duration: 0.98s;
+  -webkit-animation-delay: -0.13s;
+          animation-delay: -0.13s;
+  -webkit-animation-duration: 1.45s;
+          animation-duration: 1.45s;
 }
 
 .ball-grid-beat > div:nth-child(4) {
-  -webkit-animation-delay: -0.08s;
-          animation-delay: -0.08s;
-  -webkit-animation-duration: 0.88s;
-          animation-duration: 0.88s;
+  -webkit-animation-delay: 0.3s;
+          animation-delay: 0.3s;
+  -webkit-animation-duration: 1.36s;
+          animation-duration: 1.36s;
 }
 
 .ball-grid-beat > div:nth-child(5) {
-  -webkit-animation-delay: 0.61s;
-          animation-delay: 0.61s;
-  -webkit-animation-duration: 0.61s;
-          animation-duration: 0.61s;
+  -webkit-animation-delay: 0.72s;
+          animation-delay: 0.72s;
+  -webkit-animation-duration: 0.97s;
+          animation-duration: 0.97s;
 }
 
 .ball-grid-beat > div:nth-child(6) {
-  -webkit-animation-delay: -0.18s;
-          animation-delay: -0.18s;
-  -webkit-animation-duration: 1.17s;
-          animation-duration: 1.17s;
+  -webkit-animation-delay: -0.03s;
+          animation-delay: -0.03s;
+  -webkit-animation-duration: 1.08s;
+          animation-duration: 1.08s;
 }
 
 .ball-grid-beat > div:nth-child(7) {
-  -webkit-animation-delay: 0.15s;
-          animation-delay: 0.15s;
-  -webkit-animation-duration: 1.08s;
-          animation-duration: 1.08s;
+  -webkit-animation-delay: 0.11s;
+          animation-delay: 0.11s;
+  -webkit-animation-duration: 0.95s;
+          animation-duration: 0.95s;
 }
 
 .ball-grid-beat > div:nth-child(8) {
-  -webkit-animation-delay: 0.63s;
-          animation-delay: 0.63s;
-  -webkit-animation-duration: 0.96s;
-          animation-duration: 0.96s;
+  -webkit-animation-delay: 0.38s;
+          animation-delay: 0.38s;
+  -webkit-animation-duration: 0.69s;
+          animation-duration: 0.69s;
 }
 
 .ball-grid-beat > div:nth-child(9) {
-  -webkit-animation-delay: 0.33s;
-          animation-delay: 0.33s;
-  -webkit-animation-duration: 1.29s;
-          animation-duration: 1.29s;
+  -webkit-animation-delay: 0.62s;
+          animation-delay: 0.62s;
+  -webkit-animation-duration: 1.41s;
+          animation-duration: 1.41s;
 }
 
 .ball-grid-beat > div {
@@ -1575,66 +1575,66 @@
 }
 
 .ball-grid-pulse > div:nth-child(1) {
-  -webkit-animation-delay: 0.6s;
-          animation-delay: 0.6s;
-  -webkit-animation-duration: 1.44s;
-          animation-duration: 1.44s;
+  -webkit-animation-delay: -0.11s;
+          animation-delay: -0.11s;
+  -webkit-animation-duration: 0.97s;
+          animation-duration: 0.97s;
 }
 
 .ball-grid-pulse > div:nth-child(2) {
-  -webkit-animation-delay: 0.46s;
-          animation-delay: 0.46s;
-  -webkit-animation-duration: 0.74s;
-          animation-duration: 0.74s;
+  -webkit-animation-delay: 0.36s;
+          animation-delay: 0.36s;
+  -webkit-animation-duration: 1.24s;
+          animation-duration: 1.24s;
 }
 
 .ball-grid-pulse > div:nth-child(3) {
-  -webkit-animation-delay: -0.17s;
-          animation-delay: -0.17s;
-  -webkit-animation-duration: 1.01s;
-          animation-duration: 1.01s;
+  -webkit-animation-delay: -0.12s;
+          animation-delay: -0.12s;
+  -webkit-animation-duration: 0.79s;
+          animation-duration: 0.79s;
 }
 
 .ball-grid-pulse > div:nth-child(4) {
-  -webkit-animation-delay: 0.43s;
-          animation-delay: 0.43s;
-  -webkit-animation-duration: 0.74s;
-          animation-duration: 0.74s;
+  -webkit-animation-delay: 0.61s;
+          animation-delay: 0.61s;
+  -webkit-animation-duration: 1.29s;
+          animation-duration: 1.29s;
 }
 
 .ball-grid-pulse > div:nth-child(5) {
-  -webkit-animation-delay: 0.51s;
-          animation-delay: 0.51s;
-  -webkit-animation-duration: 1.45s;
-          animation-duration: 1.45s;
+  -webkit-animation-delay: 0.3s;
+          animation-delay: 0.3s;
+  -webkit-animation-duration: 1.08s;
+          animation-duration: 1.08s;
 }
 
 .ball-grid-pulse > div:nth-child(6) {
-  -webkit-animation-delay: 0.31s;
-          animation-delay: 0.31s;
-  -webkit-animation-duration: 0.7s;
-          animation-duration: 0.7s;
+  -webkit-animation-delay: 0.23s;
+          animation-delay: 0.23s;
+  -webkit-animation-duration: 1.59s;
+          animation-duration: 1.59s;
 }
 
 .ball-grid-pulse > div:nth-child(7) {
-  -webkit-animation-delay: -0.13s;
-          animation-delay: -0.13s;
-  -webkit-animation-duration: 0.85s;
-          animation-duration: 0.85s;
+  -webkit-animation-delay: 0.44s;
+          animation-delay: 0.44s;
+  -webkit-animation-duration: 0.74s;
+          animation-duration: 0.74s;
 }
 
 .ball-grid-pulse > div:nth-child(8) {
-  -webkit-animation-delay: 0.6s;
-          animation-delay: 0.6s;
-  -webkit-animation-duration: 0.86s;
-          animation-duration: 0.86s;
+  -webkit-animation-delay: 0s;
+          animation-delay: 0s;
+  -webkit-animation-duration: 1.24s;
+          animation-duration: 1.24s;
 }
 
 .ball-grid-pulse > div:nth-child(9) {
-  -webkit-animation-delay: 0.44s;
-          animation-delay: 0.44s;
-  -webkit-animation-duration: 1.35s;
-          animation-duration: 1.35s;
+  -webkit-animation-delay: 0.17s;
+          animation-delay: 0.17s;
+  -webkit-animation-duration: 1.49s;
+          animation-duration: 1.49s;
 }
 
 .ball-grid-pulse > div {
@@ -2181,31 +2181,31 @@
 }
 
 .line-scale-party > div:nth-child(1) {
-  -webkit-animation-delay: 0.19s;
-          animation-delay: 0.19s;
-  -webkit-animation-duration: 0.33s;
-          animation-duration: 0.33s;
+  -webkit-animation-delay: 0.3s;
+          animation-delay: 0.3s;
+  -webkit-animation-duration: 0.83s;
+          animation-duration: 0.83s;
 }
 
 .line-scale-party > div:nth-child(2) {
-  -webkit-animation-delay: -0.04s;
-          animation-delay: -0.04s;
-  -webkit-animation-duration: 0.4s;
-          animation-duration: 0.4s;
+  -webkit-animation-delay: 0.21s;
+          animation-delay: 0.21s;
+  -webkit-animation-duration: 0.48s;
+          animation-duration: 0.48s;
 }
 
 .line-scale-party > div:nth-child(3) {
-  -webkit-animation-delay: -0.16s;
-          animation-delay: -0.16s;
-  -webkit-animation-duration: 1.04s;
-          animation-duration: 1.04s;
+  -webkit-animation-delay: 0.31s;
+          animation-delay: 0.31s;
+  -webkit-animation-duration: 0.66s;
+          animation-duration: 0.66s;
 }
 
 .line-scale-party > div:nth-child(4) {
-  -webkit-animation-delay: 0s;
-          animation-delay: 0s;
-  -webkit-animation-duration: 0.47s;
-          animation-duration: 0.47s;
+  -webkit-animation-delay: 0.68s;
+          animation-delay: 0.68s;
+  -webkit-animation-duration: 0.53s;
+          animation-duration: 0.53s;
 }
 
 .line-scale-party > div {

+ 258 - 60
resources/dist/dcat/js/app.js

@@ -173,10 +173,10 @@ var Dcat = /*#__PURE__*/function () {
       lang && (this.lang = lang);
       return this;
     }
-    /**
-     * 如果是 pjax 响应的页面,需要调用此方法
-     *
-     * @returns {Dcat}
+    /**
+     * 如果是 pjax 响应的页面,需要调用此方法
+     *
+     * @returns {Dcat}
      */
 
   }, {
@@ -251,6 +251,57 @@ var Footer = /*#__PURE__*/function () {
 
 
 
+/***/ }),
+
+/***/ "./resources/assets/dcat/js/bootstrappers/Menu.js":
+/*!********************************************************!*\
+  !*** ./resources/assets/dcat/js/bootstrappers/Menu.js ***!
+  \********************************************************/
+/*! exports provided: default */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Menu; });
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var Menu = /*#__PURE__*/function () {
+  function Menu(Dcat) {
+    _classCallCheck(this, Menu);
+
+    this.bindClick();
+  } // 菜单点击选中效果
+
+
+  _createClass(Menu, [{
+    key: "bindClick",
+    value: function bindClick() {
+      var $content = $('.main-menu-content'),
+          $items = $content.find('li.nav-item'),
+          $hasSubItems = $content.find('li.has-sub');
+      $items.find('a').click(function () {
+        var href = $(this).attr('href');
+
+        if (!href || href === '#') {
+          return;
+        }
+
+        $items.removeClass('active');
+        $hasSubItems.removeClass('sidebar-group-active');
+        $(this).parent().addClass('active');
+      });
+    }
+  }]);
+
+  return Menu;
+}();
+
+
+
 /***/ }),
 
 /***/ "./resources/assets/dcat/js/bootstrappers/Pjax.js":
@@ -282,6 +333,8 @@ var Pjax = /*#__PURE__*/function () {
     key: "boot",
     value: function boot(Dcat) {
       var container = Dcat.config.pjax_container_selector;
+      $.pjax.defaults.timeout = 5000;
+      $.pjax.defaults.maxCacheLength = 0;
       $('a:not(a[target="_blank"])').click(function (event) {
         $.pjax.click(event, container, {
           fragment: 'body'
@@ -354,15 +407,16 @@ __webpack_require__.r(__webpack_exports__);
 /* harmony import */ var _extensions_Grid__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./extensions/Grid */ "./resources/assets/dcat/js/extensions/Grid.js");
 /* harmony import */ var _extensions_Form__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./extensions/Form */ "./resources/assets/dcat/js/extensions/Form.js");
 /* harmony import */ var _extensions_DialogForm__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./extensions/DialogForm */ "./resources/assets/dcat/js/extensions/DialogForm.js");
-/* harmony import */ var _bootstrappers_Footer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./bootstrappers/Footer */ "./resources/assets/dcat/js/bootstrappers/Footer.js");
-/* harmony import */ var _bootstrappers_Pjax__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./bootstrappers/Pjax */ "./resources/assets/dcat/js/bootstrappers/Pjax.js");
-/*=========================================================================================
-  File Name: app.js
-  Description: Dcat Admin JS脚本.
-  ----------------------------------------------------------------------------------------
-  Item Name: Dcat Admin
-  Author: Jqh
-  Author URL: https://github.com/jqhph
+/* harmony import */ var _bootstrappers_Menu__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./bootstrappers/Menu */ "./resources/assets/dcat/js/bootstrappers/Menu.js");
+/* harmony import */ var _bootstrappers_Footer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./bootstrappers/Footer */ "./resources/assets/dcat/js/bootstrappers/Footer.js");
+/* harmony import */ var _bootstrappers_Pjax__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./bootstrappers/Pjax */ "./resources/assets/dcat/js/bootstrappers/Pjax.js");
+/*=========================================================================================
+  File Name: app.js
+  Description: Dcat Admin JS脚本.
+  ----------------------------------------------------------------------------------------
+  Item Name: Dcat Admin
+  Author: Jqh
+  Author URL: https://github.com/jqhph
 ==========================================================================================*/
 
 
@@ -376,6 +430,7 @@ __webpack_require__.r(__webpack_exports__);
 
 
 
+
 var win = window,
     $ = jQuery; // 扩展Dcat对象
 
@@ -401,18 +456,30 @@ function extend(Dcat) {
   Dcat.DialogForm = function (options) {
     return new _extensions_DialogForm__WEBPACK_IMPORTED_MODULE_9__["default"](Dcat, options);
   };
-} // 初始化事件监听
+} // 初始化
 
 
 function listen(Dcat) {
   Dcat.booting(function () {
-    new _bootstrappers_Footer__WEBPACK_IMPORTED_MODULE_10__["default"](Dcat);
-    new _bootstrappers_Pjax__WEBPACK_IMPORTED_MODULE_11__["default"](Dcat);
+    new _bootstrappers_Menu__WEBPACK_IMPORTED_MODULE_10__["default"](Dcat);
+    new _bootstrappers_Footer__WEBPACK_IMPORTED_MODULE_11__["default"](Dcat);
+    new _bootstrappers_Pjax__WEBPACK_IMPORTED_MODULE_12__["default"](Dcat); // layer弹窗设置
+
+    layer.config({
+      maxmin: true,
+      moveOut: true,
+      shade: false
+    }); // ajax全局设置
+
+    $.ajaxSetup({
+      cache: true,
+      error: Dcat.handleAjaxError
+    });
     Dcat.NP.configure({
       parent: '.app-content'
     });
   });
-} // 初始化
+} // 开始初始化
 
 
 function boot(Dcat) {
@@ -944,9 +1011,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
 
 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
 
- // import _f from '../jquery-form/form';
 
-console.log(123, _jquery_form_jquery_form_min__WEBPACK_IMPORTED_MODULE_0___default.a);
 var $eColumns = {},
     formCallbacks = {
   before: [],
@@ -1310,16 +1375,34 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
 
 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
 
+var defaultName = '_def_';
+
 var Grid = /*#__PURE__*/function () {
   function Grid(Dcat) {
     _classCallCheck(this, Grid);
 
     Dcat.grid = this;
-  }
+    this.selectors = {};
+  } // 添加行选择器对象
+
 
   _createClass(Grid, [{
     key: "addSelector",
-    value: function addSelector(selector, name) {}
+    value: function addSelector(selector, name) {
+      this.selectors[name || defaultName] = selector;
+    } // 获取行选择器选中的ID字符串
+
+  }, {
+    key: "selected",
+    value: function selected(name) {
+      return this.selectors[name || defaultName].getSelectedKeys();
+    } // 获取行选择器选中的行
+
+  }, {
+    key: "selectedRows",
+    value: function selectedRows(name) {
+      return this.selectors[name || defaultName].getSelectedRows();
+    }
   }]);
 
   return Grid;
@@ -1358,11 +1441,11 @@ var Helpers = /*#__PURE__*/function () {
 
     this.debounce = _Debounce__WEBPACK_IMPORTED_MODULE_0__["default"];
   }
-  /**
-   * 获取json对象或数组的长度
-   *
-   * @param obj
-   * @returns {number}
+  /**
+   * 获取json对象或数组的长度
+   *
+   * @param obj
+   * @returns {number}
    */
 
 
@@ -1382,12 +1465,12 @@ var Helpers = /*#__PURE__*/function () {
 
       return len;
     }
-    /**
-     * 判断变量或key是否存在
-     *
-     * @param _var
-     * @param key
-     * @returns {boolean}
+    /**
+     * 判断变量或key是否存在
+     *
+     * @param _var
+     * @param key
+     * @returns {boolean}
      */
 
   }, {
@@ -1409,13 +1492,13 @@ var Helpers = /*#__PURE__*/function () {
   }, {
     key: "get",
 
-    /**
-     * 根据key获取对象的值,支持获取多维数据
-     *
-     * @param arr
-     * @param key
-     * @param def
-     * @returns {null|*}
+    /**
+     * 根据key获取对象的值,支持获取多维数据
+     *
+     * @param arr
+     * @param key
+     * @param def
+     * @returns {null|*}
      */
     value: function get(arr, key, def) {
       def = null;
@@ -1436,12 +1519,12 @@ var Helpers = /*#__PURE__*/function () {
 
       return arr;
     }
-    /**
-     * 判断key是否存在
-     *
-     * @param arr
-     * @param key
-     * @returns {def|boolean}
+    /**
+     * 判断key是否存在
+     *
+     * @param arr
+     * @param key
+     * @returns {def|boolean}
      */
 
   }, {
@@ -1460,13 +1543,13 @@ var Helpers = /*#__PURE__*/function () {
 
       return true;
     }
-    /**
-     * 判断元素是否在对象中存在
-     *
-     * @param arr
-     * @param val
-     * @param strict
-     * @returns {boolean}
+    /**
+     * 判断元素是否在对象中存在
+     *
+     * @param arr
+     * @param val
+     * @param strict
+     * @returns {boolean}
      */
 
   }, {
@@ -1557,9 +1640,124 @@ __webpack_require__.r(__webpack_exports__);
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return RowSelector; });
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
-var RowSelector = function RowSelector() {
-  _classCallCheck(this, RowSelector);
-};
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var RowSelector = /*#__PURE__*/function () {
+  function RowSelector(options) {
+    _classCallCheck(this, RowSelector);
+
+    var _this = this;
+
+    _this.options = $.extend({
+      // checkbox css选择器
+      checkboxSelector: '',
+      // 全选checkbox css选择器
+      selectAllSelector: '',
+      // 选中效果颜色
+      background: 'rgba(255, 255,213,0.4)',
+      // 点击行事件
+      clickRow: false
+    }, options);
+
+    _this._bind();
+  }
+
+  _createClass(RowSelector, [{
+    key: "_bind",
+    value: function _bind() {
+      var options = this.options,
+          checkboxSelector = options.checkboxSelector,
+          selectAllSelector = options.selectAllSelector,
+          $ckb = $(checkboxSelector);
+      $(selectAllSelector).on('change', function () {
+        var cbx = $(checkboxSelector);
+
+        for (var i = 0; i < cbx.length; i++) {
+          if (this.checked && !cbx[i].checked) {
+            cbx[i].click();
+          } else if (!this.checked && cbx[i].checked) {
+            cbx[i].click();
+          }
+        }
+      });
+
+      if (options.clickRow) {
+        $ckb.click(function (e) {
+          if (typeof e.cancelBubble != "undefined") {
+            e.cancelBubble = true;
+          }
+
+          if (typeof e.stopPropagation != "undefined") {
+            e.stopPropagation();
+          }
+        }).parents('tr').click(function (e) {
+          $(this).find(checkboxSelector).click();
+        });
+      }
+
+      $ckb.on('change', function () {
+        var tr = $(this).closest('tr');
+
+        if (this.checked) {
+          tr.css('background-color', options.background);
+        } else {
+          tr.css('background-color', '');
+        }
+      });
+    }
+    /**
+     * 获取选中的主键数组
+     *
+     * @returns {Array}
+     */
+
+  }, {
+    key: "getSelectedKeys",
+    value: function getSelectedKeys() {
+      var selected = [];
+      $(this.options.checkboxSelector + ':checked').each(function () {
+        var id = $(this).data('id');
+
+        if (selected.indexOf(id) === -1) {
+          selected.push(id);
+        }
+      });
+      return selected;
+    }
+    /**
+     * 获取选中的行数组
+     *
+     * @returns {Array}
+     */
+
+  }, {
+    key: "getSelectedRows",
+    value: function getSelectedRows() {
+      var selected = [];
+      $(this.options.checkboxSelector + ':checked').each(function () {
+        var id = $(this).data('id'),
+            i,
+            exist;
+
+        for (i in selected) {
+          if (selected[i].id === id) {
+            exist = true;
+          }
+        }
+
+        exist || selected.push({
+          'id': id,
+          'label': $(this).data('label')
+        });
+      });
+      return selected;
+    }
+  }]);
+
+  return RowSelector;
+}();
 
 
 
@@ -1726,10 +1924,10 @@ var Toastr = /*#__PURE__*/function () {
 /*! no static exports found */
 /***/ (function(module, exports) {
 
-/*!
- * jQuery Form Plugin
- * version: 4.2.2
- * Project repository: https://github.com/jquery-form/form
+/*!
+ * jQuery Form Plugin
+ * version: 4.2.2
+ * Project repository: https://github.com/jquery-form/form
  */
 var module = {};
 eval(function (p, a, c, k, _e, r) {
@@ -1850,7 +2048,7 @@ eval(function (p, a, c, k, _e, r) {
 /*! no static exports found */
 /***/ (function(module, exports, __webpack_require__) {
 
-module.exports = __webpack_require__(/*! D:\php-project\laravel\laraveladmin\github-test\pck-dcat-admin\dcat-admin\resources\assets\dcat\js\dcat-app.js */"./resources/assets/dcat/js/dcat-app.js");
+module.exports = __webpack_require__(/*! F:\p\dcat-admin-github\dcat-admin\resources\assets\dcat\js\dcat-app.js */"./resources/assets/dcat/js/dcat-app.js");
 
 
 /***/ })

+ 34 - 37
resources/views/partials/menu.blade.php

@@ -1,38 +1,35 @@
-@if($builder->isVisible($item))
-    @if(isset($item['is_header']))
-        <li class="navigation-header">
-            <span>{{ $item['title'] }}</span>
-        </li>
-    @elseif(! isset($item['children']))
-        <li class="nav-item {!! $builder->isActive($item) ? 'active' : '' !!}">
-            <a href="{{ $builder->getUrl($item['uri']) }}">
-
-                <i class="{{$item['icon']}}"></i>
-                @if (Lang::has($titleTranslation = 'admin.menu_titles.' . trim(str_replace(' ', '_', strtolower($item['title'])))))
-                    <span class="menu-title">{{ __($titleTranslation) }}</span>
-                @else
-                    <span class="menu-title">{{ $item['title'] }}</span>
-                @endif
-            </a>
-        </li>
-    @else
-        @php
-            $active = $builder->isActive($item);
-        @endphp
-        <li class="nav-item has-sub {!! $active ? 'active open' : '' !!}">
-            <a href="#">
-                <i class="fa {{ $item['icon'] }}"></i>
-                @if (Lang::has($titleTranslation = 'admin.menu_titles.' . trim(str_replace(' ', '_', strtolower($item['title'])))))
-                    <span class="menu-title">{{ __($titleTranslation) }}</span>
-                @else
-                    <span class="menu-title">{{ $item['title'] }}</span>
-                @endif
-            </a>
-            <ul class="menu-content">
-                @foreach($item['children'] as $item)
-                    @include('admin::partials.menu', $item)
-                @endforeach
-            </ul>
-        </li>
-    @endif
+@if($builder->isVisible($item))
+    @if(isset($item['is_header']))
+        <li class="navigation-header">
+            <span>{{ $item['title'] }}</span>
+        </li>
+    @elseif(! isset($item['children']))
+        <li class="nav-item {!! $builder->isActive($item) ? 'active' : '' !!}">
+            <a href="{{ $builder->getUrl($item['uri']) }}">
+
+                <i class="{{$item['icon']}}"></i>
+                @if (Lang::has($titleTranslation = 'admin.menu_titles.' . trim(str_replace(' ', '_', strtolower($item['title'])))))
+                    <span class="menu-title">{{ __($titleTranslation) }}</span>
+                @else
+                    <span class="menu-title">{{ $item['title'] }}</span>
+                @endif
+            </a>
+        </li>
+    @else
+        <li class="nav-item has-sub">
+            <a href="#">
+                <i class="fa {{ $item['icon'] }}"></i>
+                @if (Lang::has($titleTranslation = 'admin.menu_titles.' . trim(str_replace(' ', '_', strtolower($item['title'])))))
+                    <span class="menu-title">{{ __($titleTranslation) }}</span>
+                @else
+                    <span class="menu-title">{{ $item['title'] }}</span>
+                @endif
+            </a>
+            <ul class="menu-content">
+                @foreach($item['children'] as $item)
+                    @include('admin::partials.menu', $item)
+                @endforeach
+            </ul>
+        </li>
+    @endif
 @endif