macro.vm
3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
## 面包屑
## $c 为列表变量值
## "首页:/home,列表页:/list,详情页"
#macro(crumbs $c)
#set($list=$!{webUtils.getCrumbsByString($c)})
#set($index=0)
#foreach($elem in $list)
<li>
#if($index == 0)
<i class="icon-home home-icon"></i>
#end
#set($title = "")
#set($url = "")
#set($j=0)
#foreach($val in $elem)
#if($j==0)
#set($title=$val)
#else
#set($url=$val)
#end
#set($j=$j+1)
#end
<a href="$!{url}">$!{title}</a>
</li>
#set($index=$index+1)
#end
#end
## 统一分页
## $total 总页数
## $curr 当前页数
#macro(page $total $curr)
<ul class="pagination">
#set($isFirst=$curr+1 == 1)
#set($isLast=$curr+1 == $total)
<li class="prev #if($isFirst)disabled#end">
#set ( $tmpCurr = $curr - 1 )
<a href="#if($isFirst)javascript:void(0)#else javascript:turnPage(${tmpCurr})#end">
<i class="fa fa-angle-double-left"></i>
</a>
</li>
#foreach($index in $!{webUtils.pageSplit($curr,$total,6)})
#set( $i = $index - 1 )
<li #if($index == $curr+1)class="active" #end><a href="javascript:turnPage(${i})">$index</a></li>
#end
<li class="next #if($isLast)disabled#end">
#set ( $tmpCurr = $curr + 1 )
<a href="#if($isLast)javascript:void(0)#else javascript:turnPage(${tmpCurr})#end">
<i class="fa fa-angle-double-right"></i>
</a>
</li>
</ul>
#end
## 显示数量的下拉选择
## $currCount : 当前显示的数量
#macro(selectCount $currCount)
<select name="pageSize">
#foreach($count in [1,5,10,20,50,100])
<option value="$count" #if($count == $currCount)selected#end>$count</option>
#end
</select>
#end
#macro(productdetail $pk)
##http://www.dili7/product/$!{pk}.html
$!{webUtils.getWebsiteDomain("")}/product/$!{pk}.html
#end
##生成菜单
#macro(makeMenu $menus)
<ul class="nav nav-list" id="page-navigation">
#foreach($menu in $menus)
<li class="level1 sysLi" id="sysLi${menu.id}">
<a href="#" class="dropdown-toggle">
## <i class="menu-icon fa
## #navBarCssSwitch($menu)
## "></i>
<span class="menu-text">${menu.label}</span>
<b class="arrow fa fa-angle-down"></b>
</a>
<b class="arrow"></b>
#makeSubMenu($menu)
</li>
#end
</ul>
#end
##生成子菜单
#macro(makeSubMenu $menu)
#if(${menu.children})
<ul class="submenu" id="menuUl${menu.id}">
#foreach($sub in $menu.children)
#if(!${sub.menuUrl} || ${sub.menuUrl} == "")
<li id="menuLi${sub.id}">
<a href="javascript:;" class="dropdown-toggle">
#else
<li class="menuLi" id="menuLi${sub.id}">
<a href="$!{sub.menuUrl}" target="frame3d" class="menuLia">
#end
<i class="menu-icon fa fa-caret-right"></i>
$!{sub.label}
</a>
<b class="arrow"></b>
#makeSubMenu($sub)
</li>
#end
</ul>
#end
#end
##根据菜单名选择菜单对应图标
#macro(navBarCssSwitch $menu)
## 主菜单Class
##商品中心
#set($shop = "fa-inbox")
##订单中心
#set($orders = "fa-shopping-cart")
##结算中心
#set($withdraw = "fa-cny")
##供应商
#set($supplier = "fa-users")
##会员中心
#set($member = "fa-user")
##会员中心
#set($im = "fa-smile-o")
##CMS
#set($cms = "fa-briefcase")
##系统设置
#set($system = "fa-gears")
##权限管理
#set($auth = "fa-unlock-alt")
#if($menu.id == 90)
$shop
#elseif($menu.id == 91)
$orders
#elseif($menu.id == 92)
$withdraw
#elseif($menu.id == 93)
$supplier
#elseif($menu.id == 94)
$member
#elseif($menu.id == 95)
$im
#elseif($menu.id == 96)
$cms
#elseif($menu.id == 97)
$system
#elseif($menu.id == 98)
$auth
#end
#end