[更新]设置系统菜单允许带参数

This commit is contained in:
Anyon 2018-05-05 18:51:16 +08:00
parent 44efd72720
commit 84ef9699b5
3 changed files with 12 additions and 2 deletions

View File

@ -65,7 +65,7 @@ class Index extends BasicAdmin
continue;
} elseif ($menu['url'] !== '#') {
$node = join('/', array_slice(explode('/', preg_replace('/[\W]/', '/', $menu['url'])), 0, 3));
$menu['url'] = url($menu['url']);
$menu['url'] = url($menu['url']) . (empty($menu['params']) ? '' : "?{$menu['params']}");
if (isset($nodes[$node]) && $nodes[$node]['is_login'] && empty($isLogin)) {
unset($menus[$key]);
} elseif (isset($nodes[$node]) && $nodes[$node]['is_auth'] && $isLogin && !auth($node)) {

View File

@ -58,7 +58,9 @@ class Menu extends BasicAdmin
protected function _index_data_filter(&$data)
{
foreach ($data as &$vo) {
($vo['url'] !== '#') && ($vo['url'] = url($vo['url']));
if ($vo['url'] !== '#') {
$vo['url'] = url($vo['url']) . (empty($vo['params']) ? '' : "?{$vo['params']}");
}
$vo['ids'] = join(',', ToolsService::getArrSubIds($data, $vo['id']));
}
$data = ToolsService::arr2table($data);

View File

@ -29,6 +29,14 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接参数</label>
<div class="layui-input-block">
<input type="text" name="params" autocomplete="off" title="请输入链接参数" placeholder="请输入链接参数" value="{$vo.params|default=''}" class="layui-input typeahead">
<p class="help-block">可选设置菜单链接参数name=1&age=3</p>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单图标</label>
<div class="layui-input-inline" style='width:300px'>