<!DOCTYPE html>
<html lang="zh">
<head>
    <title>{$ htmlEncode .teaTitle}</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
    {$if eq .teaFaviconFileId 0}
    <link rel="shortcut icon" href="/images/favicon.png"/>
    {$else}
    <link rel="shortcut icon" href="/ui/image/{$.teaFaviconFileId}"/>
    {$end}
    <link rel="stylesheet" type="text/css" href="/_/@default/@layout.css" media="all"/>
    {$TEA.SEMANTIC}
	<link rel="stylesheet" type="text/css" href="/_/@default/@layout_override.css" media="all"/>

    {$TEA.VUE}
    {$echo "header"}
    <script type="text/javascript" src="/_/@default/@layout.js"></script>
	<script type="text/javascript" src="/js/components.js?v=v{$.teaVersion}"></script>
	<script type="text/javascript" src="/js/utils.min.js"></script>
	<script type="text/javascript" src="/js/sweetalert2/dist/sweetalert2.all.min.js"></script>
	<script type="text/javascript" src="/js/date.tea.js"></script>

    {$if not (eq .teaThemeBackgroundColor "")}
    <style>
    .top-nav, .main-menu, .main-menu .menu {
        background: #{$.teaThemeBackgroundColor} !important;
    }
    </style>
    {$end}
</head>
<body>

<div>
    <!-- 顶部导航 -->
    <div class="ui menu top-nav blue inverted small borderless" v-cloak="">
        <a href="/dashboard" class="item">
            <i class="ui icon leaf" v-if="teaLogoFileId == 0"></i><img v-if="teaLogoFileId > 0" :src="'/ui/image/' + teaLogoFileId" style="width: auto;height: 1.6em"/> &nbsp; {{teaTitle}}&nbsp;<sup v-if="teaShowVersion">v{{teaVersion}}</sup> &nbsp;
		</a>

        <div class="right menu">
			<a href="/messages" class="item" :class="{active:teaMenu == 'message'}"><span :class="{'blink':globalMessageBadge > 0}"><i class="icon bell"></i>消息({{globalMessageBadge}}) </span></a>
			<a href="/settings/profile" class="item">
				<i class="icon user" v-if="teaUserAvatar.length == 0"></i>
				<img class="avatar" alt="" :src="teaUserAvatar" v-if="teaUserAvatar.length > 0"/>
                {{teaUsername}}
			</a>
            <a href="/settings/profile" class="item">
                <i class="icon setting"></i>设置
            </a>
            <a href="/" class="item" v-show="teaShowIndexPage">
                <i class="icon home"></i>首页
            </a>
            <a href="/docs" class="item" :class="{active: teaMenu == 'docs'}"><i class="icon file"></i>文档</a>
            <a :href="Tea.url('logout')" class="item" title="安全退出登录"><i class="icon sign out"></i>退出</a>
        </div>
    </div>

    <!-- 左侧主菜单 -->
    <div class="main-menu" v-cloak="">
        <div class="ui labeled menu vertical blue inverted tiny borderless">
			<div class="item"></div>
            <!--<a :href="Tea.url('dashboard')" class="item" :class="{active:teaMenu == 'dashboard'}">
                <i class="ui dashboard icon"></i>
                <span>仪表板</span>
            </a>-->

            <!-- 模块 -->
			<div v-for="module in teaModules">
				<a class="item" :href="Tea.url(module.code)" :class="{active:teaMenu == module.code && teaSubMenu.length == 0, separator:module.code.length == 0}">
					<span v-if="module.code.length > 0">
						<i class="window restore outline icon" v-if="module.icon == null"></i>
						<i class="ui icon" v-if="module.icon != null" :class="module.icon"></i>
						<span>{{module.name}}</span>
					</span>
				</a>
				<div v-if="teaMenu == module.code" class="sub-items">
					<a class="item" v-for="subItem in module.subItems" :href="subItem.url" :class="{active:subItem.code == teaSubMenu}" v-if="subItem.isOn == null || subItem.isOn === true">{{subItem.name}}<i class="icon angle right" v-if="subItem.name != '-' && subItem.code == teaSubMenu"></i></a>
				</div>
			</div>
        </div>
    </div>

    <!-- 右侧主操作栏 -->
    <div class="main" :class="{'without-menu':teaSubMenus.menus == null || teaSubMenus.menus.length == 0 || (teaSubMenus.menus.length == 1 && teaSubMenus.menus[0].alwaysActive), 'without-secondary-menu':teaSubMenus.alwaysMenu == null || teaSubMenus.alwaysMenu.items.length <= 1, 'without-footer':!teaShowPageFooter}" v-cloak="">
        <!-- 操作菜单 -->
        <div class="ui top menu tabular tab-menu small" v-if="teaTabbar.length > 0">
            <a class="item" v-for="item in teaTabbar" :class="{'active':item.active,right:item.right}"  :href="item.url">
                <var>{{item.name}}<span v-if="item.subName.length > 0">({{item.subName}})</span><i class="icon small" :class="item.icon" v-if="item.icon != null && item.icon.length > 0"></i> </var>
            </a>
        </div>

        <!-- 功能区 -->
        {$TEA.VIEW}
    </div>

	<!-- 底部 -->
	<div id="footer" class="ui menu inverted light-blue borderless small" v-if="teaShowPageFooter && teaPageFooterHTML.length == 0">
		<a class="item" title="点击进入检查版本更新页面">{{teaName}} v{{teaVersion}}</a>
	</div>
    <div id="footer" class="ui menu inverted light-blue borderless small" v-if="teaShowPageFooter && teaPageFooterHTML.length > 0" v-html="teaPageFooterHTML"> </div>
</div>

{$echo "footer"}

</body>
</html>