Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
3b685ad8
Commit
3b685ad8
authored
May 10, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复一级菜单没有子菜单不能显示的问题
parent
2d5fa421
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
22 deletions
+41
-22
src/main/java/com/stylefeng/guns/common/node/MenuNode.java
+5
-6
src/main/java/com/stylefeng/guns/modular/system/controller/NoticeController.java
+11
-1
src/main/webapp/WEB-INF/view/common/_tab.html
+25
-15
No files found.
src/main/java/com/stylefeng/guns/common/node/MenuNode.java
View file @
3b685ad8
package
com
.
stylefeng
.
guns
.
common
.
node
;
package
com
.
stylefeng
.
guns
.
common
.
node
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.Iterator
;
...
@@ -250,14 +248,15 @@ public class MenuNode implements Comparable {
...
@@ -250,14 +248,15 @@ public class MenuNode implements Comparable {
}
}
/**
/**
* 清除
不包含子节点的节点
* 清除
所有二级菜单
*
*
* @date 2017年2月19日 下午11:18:19
* @date 2017年2月19日 下午11:18:19
*/
*/
public
static
List
<
MenuNode
>
clear
NoChild
(
List
<
MenuNode
>
nodes
)
{
public
static
List
<
MenuNode
>
clear
LevelTwo
(
List
<
MenuNode
>
nodes
)
{
ArrayList
<
MenuNode
>
results
=
new
ArrayList
<
MenuNode
>();
ArrayList
<
MenuNode
>
results
=
new
ArrayList
<
MenuNode
>();
for
(
MenuNode
node
:
nodes
)
{
for
(
MenuNode
node
:
nodes
)
{
if
(
ToolUtil
.
isNotEmpty
(
node
.
getChildren
()))
{
Integer
levels
=
node
.
getLevels
();
if
(
levels
.
equals
(
1
))
{
results
.
add
(
node
);
results
.
add
(
node
);
}
}
}
}
...
@@ -272,7 +271,7 @@ public class MenuNode implements Comparable {
...
@@ -272,7 +271,7 @@ public class MenuNode implements Comparable {
public
static
List
<
MenuNode
>
buildTitle
(
List
<
MenuNode
>
nodes
)
{
public
static
List
<
MenuNode
>
buildTitle
(
List
<
MenuNode
>
nodes
)
{
List
<
MenuNode
>
clearBtn
=
clearBtn
(
nodes
);
List
<
MenuNode
>
clearBtn
=
clearBtn
(
nodes
);
new
MenuNode
().
buildNodeTree
(
clearBtn
);
new
MenuNode
().
buildNodeTree
(
clearBtn
);
List
<
MenuNode
>
menuNodes
=
clear
NoChild
(
clearBtn
);
List
<
MenuNode
>
menuNodes
=
clear
LevelTwo
(
clearBtn
);
//对菜单排序
//对菜单排序
Collections
.
sort
(
menuNodes
);
Collections
.
sort
(
menuNodes
);
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/NoticeController.java
View file @
3b685ad8
...
@@ -40,7 +40,7 @@ public class NoticeController extends BaseController {
...
@@ -40,7 +40,7 @@ public class NoticeController extends BaseController {
private
NoticeDao
noticeDao
;
private
NoticeDao
noticeDao
;
/**
/**
* 跳转到通知首页
* 跳转到通知
列表
首页
*/
*/
@RequestMapping
(
""
)
@RequestMapping
(
""
)
public
String
index
()
{
public
String
index
()
{
...
@@ -66,6 +66,16 @@ public class NoticeController extends BaseController {
...
@@ -66,6 +66,16 @@ public class NoticeController extends BaseController {
}
}
/**
/**
* 跳转到首页通知
*/
@RequestMapping
(
"/hello"
)
public
String
hello
()
{
List
<
Map
<
String
,
Object
>>
notices
=
noticeDao
.
list
(
null
);
super
.
setAttr
(
"noticeList"
,
notices
);
return
"blackboard.html"
;
}
/**
* 获取通知列表
* 获取通知列表
*/
*/
@RequestMapping
(
value
=
"/list"
)
@RequestMapping
(
value
=
"/list"
)
...
...
src/main/webapp/WEB-INF/view/common/_tab.html
View file @
3b685ad8
...
@@ -25,22 +25,31 @@
...
@@ -25,22 +25,31 @@
</li>
</li>
@for(title in titles){
@for(title in titles){
<li>
@if(tool.isEmpty(title.children)){
<a
href=
"#"
>
<li>
<i
class=
"fa ${title.icon}"
></i>
<a
class=
"J_menuItem"
href=
"${ctxPath}${title.url}"
>
<span
class=
"nav-label"
>
${title.name}
</span>
<i
class=
"fa ${title.icon}"
></i>
<span
class=
"fa arrow"
></span>
<span
class=
"nav-label"
>
${title.name}
</span>
</a>
</a>
<ul
class=
"nav nav-second-level"
>
</li>
@for(subTitle in title.children){
@}else{
<li>
<li>
<a
class=
"J_menuItem"
href=
"${ctxPath}${subTitle.url}"
>
${subTitle.name}
</a>
<a
href=
"#"
>
</li>
<i
class=
"fa ${title.icon}"
></i>
@}
<span
class=
"nav-label"
>
${title.name}
</span>
</ul>
<span
class=
"fa arrow"
></span>
</li>
</a>
<ul
class=
"nav nav-second-level"
>
@for(subTitle in title.children){
<li>
<a
class=
"J_menuItem"
href=
"${ctxPath}${subTitle.url}"
>
${subTitle.name}
</a>
</li>
@}
</ul>
</li>
@}
@}
@}
</ul>
</ul>
</div>
</div>
</nav>
</nav>
\ No newline at end of file
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