Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
44ef292e
authored
Nov 15, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
菜单和用户接入
parent
bd802a79
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
91 additions
and
14 deletions
.env
app/Admin/Controllers/InquiryController.php
app/Admin/bootstrap.php
app/Http/Kernel.php
app/Http/Middleware/CheckLogin.php
app/Http/Middleware/EncryptCookies.php
app/Http/Middleware/Permission.php
config/admin.php
config/perm.php
config/website.php
resources/lang/en/menu.php
.env
View file @
44ef292e
...
...
@@ -53,3 +53,12 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
START_IFRAME_TAB=true
LOGIN_DOMAIN=user.semourdev.net
PERM_URL=http://perm.semourdev.net/api/check
PERM_ID=12
PERM_GOURL=http://perm.semourdev.net
ADMIN_GROUP=1000,20000
MENU_ID=2
MENU_URL=http://data.semourdev.net/api/config/
app/Admin/Controllers/InquiryController.php
View file @
44ef292e
...
...
@@ -26,10 +26,10 @@ class InquiryController extends AdminController
{
return
Grid
::
make
(
new
Inquiry
([
'user'
,
'sales_user'
]),
function
(
Grid
$grid
)
{
$grid
->
showFilter
();
$grid
->
disableActions
();
//
$grid->disableActions();
$grid
->
disableFilterButton
();
$grid
->
disableRefreshButton
();
$grid
->
disableCreateButton
();
//
$grid->disableCreateButton();
$grid
->
filter
(
function
(
$filter
)
{
$filter
->
expand
(
true
);
$filter
->
whereBetween
(
'create_time'
,
function
(
$q
)
{
...
...
@@ -122,16 +122,29 @@ class InquiryController extends AdminController
protected
function
form
()
{
return
Form
::
make
(
new
Inquiry
(),
function
(
Form
$form
)
{
$form
->
display
(
'inquiry_id'
);
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
text
(
'sales_id'
);
$form
->
text
(
'inquiry_sn'
);
});
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
text
(
'status'
);
$form
->
text
(
'remark'
);
$form
->
text
(
'priority'
);
$form
->
text
(
'user_types'
);
$form
->
text
(
'processing_time'
);
$form
->
text
(
'create_time'
);
$form
->
text
(
'update_time'
);
});
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
array
(
'column_name'
,
function
(
$table
)
{
$table
->
text
(
'key'
)
->
width
(
3
);
$table
->
text
(
'value'
)
->
width
(
3
);
$table
->
text
(
'desc'
)
->
width
(
3
);
$table
->
text
(
'desc'
)
->
width
(
3
);
$table
->
text
(
'desc'
)
->
width
(
3
);
$table
->
text
(
'desc'
)
->
width
(
3
);
$table
->
text
(
'desc'
)
->
width
(
3
);
$table
->
text
(
'desc'
)
->
width
(
3
);
$table
->
text
(
'desc'
)
->
width
(
3
);
});
});
});
}
...
...
app/Admin/bootstrap.php
View file @
44ef292e
...
...
@@ -5,6 +5,7 @@ use Dcat\Admin\Admin;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid\Filter
;
use
Dcat\Admin\Layout\Menu
;
use
Dcat\Admin\Layout\Navbar
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Show\Field
;
...
...
@@ -188,6 +189,35 @@ HTML
);
});
Admin
::
menu
(
function
(
Menu
$menu
)
{
//权限系统的菜单
$permMenus
=
request
()
->
menus
;
$permMenus
=
(
array
)
$permMenus
;
$addMenus
=
[];
foreach
(
$permMenus
as
$key
=>
&
$permMenu
)
{
$permMenu
=
(
array
)
$permMenu
;
//为了区分本系统手动添加的菜单
$key
=
$key
+
1000
;
$permMenu
[
'id'
]
=
$key
+
1
;
$permMenu
[
'icon'
]
=
$permMenu
[
'class'
];
$permMenu
[
'uri'
]
=
$permMenu
[
'href'
];
$permMenu
[
'parent_id'
]
=
0
;
$addMenus
[]
=
$permMenu
;
if
(
!
empty
(
$permMenu
[
'childs'
]))
{
foreach
(
$permMenu
[
'childs'
]
as
$k
=>
&
$child
)
{
$child
=
(
array
)
$child
;
//为了让字菜单的id不和父菜单的id冲突
$child
[
'id'
]
=
$k
+
(
$key
+
1
)
*
100
;
$child
[
'parent_id'
]
=
$key
+
1
;
$child
[
'icon'
]
=
$child
[
'class'
];
$child
[
'uri'
]
=
$child
[
'href'
];
$addMenus
[]
=
$child
;
}
}
}
unset
(
$permMenu
,
$child
);
$menu
->
add
(
$addMenus
);
});
Grid
::
resolving
(
function
(
Grid
$grid
)
{
$grid
->
tableCollapse
(
true
);
...
...
app/Http/Kernel.php
View file @
44ef292e
...
...
@@ -23,8 +23,8 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize
::
class
,
\App\Http\Middleware\TrimStrings
::
class
,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull
::
class
,
//
CheckLogin::class,
//
Permission::class,
CheckLogin
::
class
,
Permission
::
class
,
];
/**
...
...
app/Http/Middleware/CheckLogin.php
View file @
44ef292e
...
...
@@ -51,8 +51,7 @@ class CheckLogin
}
$user
=
$ret
->
data
;
// $user->code = DB::connection()->table('lie_intracode')->where('admin_id',
// $user->userId)->select('code_id')->first();
$user
->
header
=
$request
->
cookie
(
'oa_header'
);
$request
->
user
=
$user
;
...
...
app/Http/Middleware/EncryptCookies.php
View file @
44ef292e
...
...
@@ -13,5 +13,7 @@ class EncryptCookies extends Middleware
*/
protected
$except
=
[
//
'oa_user_id'
,
'oa_skey'
];
}
app/Http/Middleware/Permission.php
View file @
44ef292e
...
...
@@ -21,7 +21,7 @@ class Permission
//处理权限和菜单
$permData
=
config
(
'perm.perm'
);
$action
=
$request
->
route
(
'key'
);
empty
(
$action
)
&&
$action
=
'
Dashboard
'
;
empty
(
$action
)
&&
$action
=
'
Index
'
;
//获取菜单
if
(
!
$isApi
&&
empty
(
$request
->
input
(
'window'
)))
{
...
...
config/admin.php
View file @
44ef292e
...
...
@@ -128,7 +128,7 @@ return [
|
*/
'auth'
=>
[
'enable'
=>
tru
e
,
'enable'
=>
fals
e
,
'controller'
=>
App\Admin\Controllers\AuthController
::
class
,
...
...
@@ -200,7 +200,7 @@ return [
|--------------------------------------------------------------------------
*/
'helpers'
=>
[
'enable'
=>
tru
e
,
'enable'
=>
fals
e
,
],
/*
...
...
config/perm.php
0 → 100644
View file @
44ef292e
<?php
return
[
'perm'
=>
[
'id'
=>
env
(
'PERM_ID'
),
'url'
=>
env
(
'PERM_URL'
),
'go_url'
=>
env
(
'PERM_GOURL'
),
'admin_group'
=>
explode
(
','
,
env
(
'ADMIN_GROUP'
)),
//管理员权限组,有所有权限
'menu_id'
=>
env
(
'MENU_ID'
),
'menu_url'
=>
env
(
'MENU_URL'
),
'not_auth'
=>
[]
]
];
config/website.php
0 → 100644
View file @
44ef292e
<?php
return
[
'login'
=>
[
'login'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/login'
,
'logout'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/logout'
,
'check'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/api/checklogin'
,
'search'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/api/search'
,
'dashboard'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/dashboard'
,
],
];
resources/lang/en/menu.php
View file @
44ef292e
...
...
@@ -5,5 +5,7 @@ return [
'userAddress'
=>
'UserAddress'
,
'inquiry'
=>
'Inquiry'
,
'country'
=>
'Country'
,
'task'
=>
'Task'
,
'use'
=>
'Task'
,
],
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment