macro.vm 3.79 KB

## 面包屑
## $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