Răsfoiți Sursa

feat: avoid unnecessary page reload by using dedicated modal

M1Screw 2 ani în urmă
părinte
comite
eb41cd8cf4

+ 34 - 33
composer.lock

@@ -123,16 +123,16 @@
         },
         {
             "name": "aws/aws-sdk-php",
-            "version": "3.268.16",
+            "version": "3.268.18",
             "source": {
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "b59134c9ca64dcb9de6f7dbbcb9d5a75ed665a98"
+                "reference": "086934b1009a8d9a9ae15dc89eafe1a25b1e8b45"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b59134c9ca64dcb9de6f7dbbcb9d5a75ed665a98",
-                "reference": "b59134c9ca64dcb9de6f7dbbcb9d5a75ed665a98",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/086934b1009a8d9a9ae15dc89eafe1a25b1e8b45",
+                "reference": "086934b1009a8d9a9ae15dc89eafe1a25b1e8b45",
                 "shasum": ""
             },
             "require": {
@@ -212,9 +212,9 @@
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.268.16"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.268.18"
             },
-            "time": "2023-04-21T21:37:05+00:00"
+            "time": "2023-04-25T18:20:08+00:00"
         },
         {
             "name": "bacon/bacon-qr-code",
@@ -1173,7 +1173,7 @@
         },
         {
             "name": "illuminate/collections",
-            "version": "v9.52.6",
+            "version": "v9.52.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/collections.git",
@@ -1228,7 +1228,7 @@
         },
         {
             "name": "illuminate/conditionable",
-            "version": "v9.52.6",
+            "version": "v9.52.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/conditionable.git",
@@ -1274,7 +1274,7 @@
         },
         {
             "name": "illuminate/container",
-            "version": "v9.52.6",
+            "version": "v9.52.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/container.git",
@@ -1325,7 +1325,7 @@
         },
         {
             "name": "illuminate/contracts",
-            "version": "v9.52.6",
+            "version": "v9.52.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/contracts.git",
@@ -1373,7 +1373,7 @@
         },
         {
             "name": "illuminate/database",
-            "version": "v9.52.6",
+            "version": "v9.52.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/database.git",
@@ -1443,7 +1443,7 @@
         },
         {
             "name": "illuminate/macroable",
-            "version": "v9.52.6",
+            "version": "v9.52.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/macroable.git",
@@ -1489,7 +1489,7 @@
         },
         {
             "name": "illuminate/pagination",
-            "version": "v9.52.6",
+            "version": "v9.52.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/pagination.git",
@@ -1539,7 +1539,7 @@
         },
         {
             "name": "illuminate/support",
-            "version": "v9.52.6",
+            "version": "v9.52.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/illuminate/support.git",
@@ -2796,16 +2796,16 @@
         },
         {
             "name": "php-http/discovery",
-            "version": "1.15.3",
+            "version": "1.16.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/php-http/discovery.git",
-                "reference": "3ccd28dd9fb34b52db946abea1b538568e34eae8"
+                "reference": "d35947fe3f833f8776ed06274173622d36895f49"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/php-http/discovery/zipball/3ccd28dd9fb34b52db946abea1b538568e34eae8",
-                "reference": "3ccd28dd9fb34b52db946abea1b538568e34eae8",
+                "url": "https://api.github.com/repos/php-http/discovery/zipball/d35947fe3f833f8776ed06274173622d36895f49",
+                "reference": "d35947fe3f833f8776ed06274173622d36895f49",
                 "shasum": ""
             },
             "require": {
@@ -2813,7 +2813,8 @@
                 "php": "^7.1 || ^8.0"
             },
             "conflict": {
-                "nyholm/psr7": "<1.0"
+                "nyholm/psr7": "<1.0",
+                "zendframework/zend-diactoros": "*"
             },
             "provide": {
                 "php-http/async-client-implementation": "*",
@@ -2864,9 +2865,9 @@
             ],
             "support": {
                 "issues": "https://github.com/php-http/discovery/issues",
-                "source": "https://github.com/php-http/discovery/tree/1.15.3"
+                "source": "https://github.com/php-http/discovery/tree/1.16.0"
             },
-            "time": "2023-03-31T14:40:37+00:00"
+            "time": "2023-04-26T07:54:11+00:00"
         },
         {
             "name": "php-http/guzzle7-adapter",
@@ -7674,16 +7675,16 @@
         },
         {
             "name": "phpstan/phpdoc-parser",
-            "version": "1.20.1",
+            "version": "1.20.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpstan/phpdoc-parser.git",
-                "reference": "57f6787f0bb6431905a18aa7caea25dcd2bd59e0"
+                "reference": "6c04009f6cae6eda2f040745b6b846080ef069c2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/57f6787f0bb6431905a18aa7caea25dcd2bd59e0",
-                "reference": "57f6787f0bb6431905a18aa7caea25dcd2bd59e0",
+                "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6c04009f6cae6eda2f040745b6b846080ef069c2",
+                "reference": "6c04009f6cae6eda2f040745b6b846080ef069c2",
                 "shasum": ""
             },
             "require": {
@@ -7713,9 +7714,9 @@
             "description": "PHPDoc parser with support for nullable, intersection and generic types",
             "support": {
                 "issues": "https://github.com/phpstan/phpdoc-parser/issues",
-                "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.1"
+                "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.3"
             },
-            "time": "2023-04-22T09:05:52+00:00"
+            "time": "2023-04-25T09:01:03+00:00"
         },
         {
             "name": "phpunit/php-file-iterator",
@@ -8004,16 +8005,16 @@
         },
         {
             "name": "slevomat/coding-standard",
-            "version": "8.11.0",
+            "version": "8.11.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/slevomat/coding-standard.git",
-                "reference": "91428d5bcf7db93a842bcf97f465edf62527f3ea"
+                "reference": "af87461316b257e46e15bb041dca6fca3796d822"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/91428d5bcf7db93a842bcf97f465edf62527f3ea",
-                "reference": "91428d5bcf7db93a842bcf97f465edf62527f3ea",
+                "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/af87461316b257e46e15bb041dca6fca3796d822",
+                "reference": "af87461316b257e46e15bb041dca6fca3796d822",
                 "shasum": ""
             },
             "require": {
@@ -8053,7 +8054,7 @@
             ],
             "support": {
                 "issues": "https://github.com/slevomat/coding-standard/issues",
-                "source": "https://github.com/slevomat/coding-standard/tree/8.11.0"
+                "source": "https://github.com/slevomat/coding-standard/tree/8.11.1"
             },
             "funding": [
                 {
@@ -8065,7 +8066,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2023-04-21T15:51:44+00:00"
+            "time": "2023-04-24T08:19:01+00:00"
         },
         {
             "name": "squizlabs/php_codesniffer",

+ 2 - 2
resources/views/tabler/admin/announcement/index.tpl

@@ -109,8 +109,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 2 - 2
resources/views/tabler/admin/coupon.tpl

@@ -203,8 +203,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 2 - 2
resources/views/tabler/admin/detect.tpl

@@ -176,8 +176,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 2 - 2
resources/views/tabler/admin/giftcard.tpl

@@ -183,8 +183,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 2 - 2
resources/views/tabler/admin/node/edit.tpl

@@ -179,8 +179,8 @@
 <script>
     var clipboard = new ClipboardJS('.copy');
     clipboard.on('success', function(e) {
-        $('#copy-message').text('已复制到剪切板');
-        $('#copy-dialog').modal('show');
+        $('#success-noreload-message').text('已复制到剪切板');
+        $('#success-noreload-dialog').modal('show');
     });
 
     const container = document.getElementById('custom_config');

+ 4 - 4
resources/views/tabler/admin/node/index.tpl

@@ -111,8 +111,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);
@@ -133,8 +133,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 2 - 2
resources/views/tabler/admin/order/index.tpl

@@ -101,8 +101,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 4 - 4
resources/views/tabler/admin/product/index.tpl

@@ -109,8 +109,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);
@@ -131,8 +131,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 5 - 3
resources/views/tabler/admin/tabler_footer.tpl

@@ -22,20 +22,20 @@
     </div>
 </div>
 
-<div class="modal modal-blur fade" id="copy-dialog" tabindex="-1" role="dialog" aria-hidden="true">
+<div class="modal modal-blur fade" id="success-noreload-dialog" tabindex="-1" role="dialog" aria-hidden="true">
     <div class="modal-dialog modal-sm modal-dialog-centered" role="document">
         <div class="modal-content">
             <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
             <div class="modal-status bg-success"></div>
             <div class="modal-body text-center py-4">
                 <i class="ti ti-circle-check icon mb-2 text-green icon-lg" style="font-size:3.5rem;"></i>
-                <p id="copy-message" class="text-muted">成功</p>
+                <p id="success-noreload-message" class="text-muted">成功</p>
             </div>
             <div class="modal-footer">
                 <div class="w-100">
                     <div class="row">
                         <div class="col">
-                            <a id="copy-confirm" href="" class="btn w-100" data-bs-dismiss="modal">
+                            <a id="success-noreload-confirm" href="" class="btn w-100" data-bs-dismiss="modal">
                             </a>
                         </div>
@@ -135,6 +135,8 @@
     });
 </script>
 <script src="//cdn.jsdelivr.net/npm/@tabler/core@latest/dist/js/tabler.min.js"></script>
+<script>console.table([['数据库查询', '执行时间'], ['{count($queryLog)} 次', '{$optTime} ms']])</script>
+
 </body>
 
 </html>

+ 2 - 2
resources/views/tabler/admin/ticket/index.tpl

@@ -123,8 +123,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 2 - 2
resources/views/tabler/admin/user/index.tpl

@@ -182,8 +182,8 @@
                     dataType: "json",
                     success: function(data) {
                         if (data.ret === 1) {
-                            $('#success-message').text(data.msg);
-                            $('#success-dialog').modal('show');
+                            $('#success-noreload-message').text(data.msg);
+                            $('#success-noreload-dialog').modal('show');
                             reloadTableAjax();
                         } else {
                             $('#fail-message').text(data.msg);

+ 2 - 2
resources/views/tabler/user/edit.tpl

@@ -518,8 +518,8 @@
 
         var clipboard = new ClipboardJS('.copy');
         clipboard.on('success', function(e) {
-            $('#copy-message').text('已复制到剪切板');
-            $('#copy-dialog').modal('show');
+            $('#success-noreload-message').text('已复制到剪切板');
+            $('#success-noreload-dialog').modal('show');
         });
 
         $("#modify-email").click(function() {

+ 2 - 2
resources/views/tabler/user/index.tpl

@@ -490,8 +490,8 @@
     <script>
         var clipboard = new ClipboardJS('.copy');
         clipboard.on('success', function(e) {
-            $('#copy-message').text('已复制到剪切板');
-            $('#copy-dialog').modal('show');
+            $('#success-noreload-message').text('已复制到剪切板');
+            $('#success-noreload-dialog').modal('show');
         });
 
         $("#check-in").click(function() {

+ 2 - 2
resources/views/tabler/user/invite.tpl

@@ -101,8 +101,8 @@
     <script>
         var clipboard = new ClipboardJS('.copy');
         clipboard.on('success', function(e) {
-            $('#copy-message').text('已复制到剪切板');
-            $('#copy-dialog').modal('show');
+            $('#success-noreload-message').text('已复制到剪切板');
+            $('#success-noreload-dialog').modal('show');
         });
 
         $("#reset-url").click(function() {

+ 3 - 3
resources/views/tabler/user/tabler_footer.tpl

@@ -22,20 +22,20 @@
     </div>
 </div>
 
-<div class="modal modal-blur fade" id="copy-dialog" tabindex="-1" role="dialog" aria-hidden="true">
+<div class="modal modal-blur fade" id="success-noreload-dialog" tabindex="-1" role="dialog" aria-hidden="true">
     <div class="modal-dialog modal-sm modal-dialog-centered" role="document">
         <div class="modal-content">
             <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
             <div class="modal-status bg-success"></div>
             <div class="modal-body text-center py-4">
                 <i class="ti ti-circle-check icon mb-2 text-green icon-lg" style="font-size:3.5rem;"></i>
-                <p id="copy-message" class="text-muted">成功</p>
+                <p id="success-noreload-message" class="text-muted">成功</p>
             </div>
             <div class="modal-footer">
                 <div class="w-100">
                     <div class="row">
                         <div class="col">
-                            <a id="copy-confirm" href="" class="btn w-100" data-bs-dismiss="modal">
+                            <a id="success-noreload-confirm" href="" class="btn w-100" data-bs-dismiss="modal">
                             </a>
                         </div>