Browse Source

新增附件类型筛选
优化Layer样式

Karson 3 years ago
parent
commit
a502a98df0

+ 1 - 1
application/admin/command/Install/fastadmin.sql

@@ -248,7 +248,7 @@ INSERT INTO `fa_auth_rule` VALUES (60, 'file', 4, 'addon/state', 'Update state',
 INSERT INTO `fa_auth_rule` VALUES (63, 'file', 4, 'addon/config', 'Setting', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', 1491635035, 1491635035, 0, 'normal');
 INSERT INTO `fa_auth_rule` VALUES (64, 'file', 4, 'addon/refresh', 'Refresh', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', 1491635035, 1491635035, 0, 'normal');
 INSERT INTO `fa_auth_rule` VALUES (65, 'file', 4, 'addon/multi', 'Multi', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', 1491635035, 1491635035, 0, 'normal');
-INSERT INTO `fa_auth_rule` VALUES (66, 'file', 0, 'user', 'User', 'fa fa-list', '', '', '', 1, NULL, '', 'hygl', 'huiyuanguanli', 1491635035, 1491635035, 0, 'normal');
+INSERT INTO `fa_auth_rule` VALUES (66, 'file', 0, 'user', 'User', 'fa fa-user-circle', '', '', '', 1, NULL, '', 'hygl', 'huiyuanguanli', 1491635035, 1491635035, 0, 'normal');
 INSERT INTO `fa_auth_rule` VALUES (67, 'file', 66, 'user/user', 'User', 'fa fa-user', '', '', '', 1, NULL, '', 'hygl', 'huiyuanguanli', 1491635035, 1491635035, 0, 'normal');
 INSERT INTO `fa_auth_rule` VALUES (68, 'file', 67, 'user/user/index', 'View', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', 1491635035, 1491635035, 0, 'normal');
 INSERT INTO `fa_auth_rule` VALUES (69, 'file', 67, 'user/user/edit', 'Edit', 'fa fa-circle-o', '', '', '', 0, NULL, '', '', '', 1491635035, 1491635035, 0, 'normal');

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

@@ -29,6 +29,7 @@ return [
     'Unclassed'                => '未归类',
     'Category'                 => '类别',
     'Classify'                 => '归类',
+    'Filter Type'              => '类型筛选',
     'Upload to third'          => '上传到第三方',
     'Upload to local'          => '上传到本地',
     'Upload to third by chunk' => '上传到第三方(分片模式)',

+ 9 - 0
application/admin/view/general/attachment/index.html

@@ -7,6 +7,15 @@
             {foreach name="categoryList" item="vo"}
             <li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
             {/foreach}
+            <li class="pull-right dropdown filter-type">
+                <a href="javascript:" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-filter"></i> {:__('Filter Type')}</a>
+                <ul class="dropdown-menu text-left" role="menu">
+                    <li class="active"><a href="javascript:" data-value="">{:__('All')}</a></li>
+                    {foreach name="mimetypeList" id="item"}
+                    <li><a href="javascript:" data-value="{$key}">{$item}</a></li>
+                    {/foreach}
+                </ul>
+            </li>
         </ul>
     </div>
 

+ 11 - 0
application/admin/view/general/attachment/select.html

@@ -11,6 +11,17 @@
             {foreach name="categoryList" item="vo"}
             <li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
             {/foreach}
+            {if stripos(request()->get('mimetype'),'image/')===false}
+            <li class="pull-right dropdown filter-type">
+                <a href="javascript:" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-filter"></i> {:__('Filter Type')}</a>
+                <ul class="dropdown-menu text-left" role="menu">
+                    <li class="active"><a href="javascript:" data-value="">{:__('All')}</a></li>
+                    {foreach name="mimetypeList" id="item"}
+                    <li><a href="javascript:" data-value="{$key}">{$item}</a></li>
+                    {/foreach}
+                </ul>
+            </li>
+            {/if}
         </ul>
     </div>
 

+ 15 - 15
application/common/controller/Backend.php

@@ -134,21 +134,6 @@ class Backend extends Controller
         // 检测IP是否允许
         check_ip_allowed();
 
-        // 非选项卡时重定向
-        if (!$this->request->isPost() && !IS_AJAX && !IS_ADDTABS && !IS_DIALOG && input("ref") == 'addtabs') {
-            $url = preg_replace_callback("/([\?|&]+)ref=addtabs(&?)/i", function ($matches) {
-                return $matches[2] == '&' ? $matches[1] : '';
-            }, $this->request->url());
-            if (Config::get('url_domain_deploy')) {
-                if (stripos($url, $this->request->server('SCRIPT_NAME')) === 0) {
-                    $url = substr($url, strlen($this->request->server('SCRIPT_NAME')));
-                }
-                $url = url($url, '', false);
-            }
-            $this->redirect('index/index', [], 302, ['referer' => $url]);
-            exit;
-        }
-
         $this->auth = Auth::instance();
 
         // 设置当前请求的URI
@@ -176,6 +161,21 @@ class Backend extends Controller
             }
         }
 
+        // 非选项卡时重定向
+        if (!$this->request->isPost() && !IS_AJAX && !IS_ADDTABS && !IS_DIALOG && input("ref") == 'addtabs') {
+            $url = preg_replace_callback("/([\?|&]+)ref=addtabs(&?)/i", function ($matches) {
+                return $matches[2] == '&' ? $matches[1] : '';
+            }, $this->request->url());
+            if (Config::get('url_domain_deploy')) {
+                if (stripos($url, $this->request->server('SCRIPT_NAME')) === 0) {
+                    $url = substr($url, strlen($this->request->server('SCRIPT_NAME')));
+                }
+                $url = url($url, '', false);
+            }
+            $this->redirect('index/index', [], 302, ['referer' => $url]);
+            exit;
+        }
+
         // 设置面包屑导航数据
         $breadcrumb = [];
         if (!IS_DIALOG && !config('fastadmin.multiplenav') && config('fastadmin.breadcrumb')) {

File diff suppressed because it is too large
+ 1 - 1
public/assets/css/backend.min.css


+ 0 - 6
public/assets/css/frontend.css

@@ -79,12 +79,6 @@ body {
 .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;
 }
 .input-group > .msg-box.n-right {
   position: absolute;

File diff suppressed because it is too large
+ 1 - 1
public/assets/css/frontend.min.css


+ 32 - 0
public/assets/js/backend/general/attachment.js

@@ -62,6 +62,22 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
                 ],
             });
 
+            // 绑定过滤事件
+            $('.filter-type ul li a', table.closest(".panel-intro")).on('click', function (e) {
+                $(this).closest("ul").find("li").removeClass("active");
+                $(this).closest("li").addClass("active");
+                var field = 'mimetype';
+                var value = $(this).data("value") || '';
+                var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
+                if (object.prop('tagName') == "SELECT") {
+                    $("option[value='" + value + "']", object).prop("selected", true);
+                } else {
+                    object.val(value);
+                }
+                table.trigger("uncheckbox");
+                table.bootstrapTable('refresh', {pageNumber: 1});
+            });
+
             // 为表格绑定事件
             Table.api.bindevent(table);
 
@@ -159,6 +175,22 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
                 ]
             });
 
+            // 绑定过滤事件
+            $('.filter-type ul li a', table.closest(".panel-intro")).on('click', function (e) {
+                $(this).closest("ul").find("li").removeClass("active");
+                $(this).closest("li").addClass("active");
+                var field = 'mimetype';
+                var value = $(this).data("value") || '';
+                var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
+                if (object.prop('tagName') == "SELECT") {
+                    $("option[value='" + value + "']", object).prop("selected", true);
+                } else {
+                    object.val(value);
+                }
+                table.trigger("uncheckbox");
+                table.bootstrapTable('refresh', {pageNumber: 1});
+            });
+
             // 选中多个
             $(document).on("click", ".btn-choose-multi", function () {
                 Fast.api.close({url: urlArr.join(","), multiple: multiple});

File diff suppressed because it is too large
+ 2 - 5
public/assets/js/require-backend.min.js


File diff suppressed because it is too large
+ 2 - 5
public/assets/js/require-frontend.min.js


+ 0 - 7
public/assets/less/frontend.less

@@ -98,19 +98,12 @@ body {
 .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;
-    }
 }
 
 .input-group > .msg-box.n-right {
     position: absolute;
 }
 
-
 .bootstrap-select .status {
     background: #f0f0f0;
     clear: both;