<!DOCTYPE html>
<html lang="zh">
<head>
    <title>{$.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}

    {$TEA.VUE}
    {$echo "header"}
    <script type="text/javascript" src="/_/@default/@layout.js"></script>
	<script type="text/javascript" src="/ui/components.js?v=v{$.teaVersion}"></script>
	<script type="text/javascript" src="/js/utils.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>

    <link rel="stylesheet" type="text/css" href="/_/@default/@layout_override.css" media="all"/>
</head>
<body>

<div>
    <!-- 顶部导航 -->
    <div class="ui menu top-nav blue inverted small borderless" :class="(teaTheme == null || teaTheme.length == 0) ? 'theme2': teaTheme" v-cloak="">
        <a href="/" 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="" class="item" v-if="teaCheckNodeTasks && doingNodeTasks.isUpdated" @click.prevent="showNodeTasks()">
                <span v-if="!doingNodeTasks.isDoing && !doingNodeTasks.hasError" class="hover-span"><i class="icon cloud disabled"></i><span class="disabled">已同步节点</span></span>
                <span v-if="doingNodeTasks.isDoing && !doingNodeTasks.hasError" class="hover-span rotate"><i class="icon cloud"></i><span>正在同步节点...</span></span>
                <span v-if="doingNodeTasks.hasError" class="red"><i class="icon cloud"></i>节点同步失败</span>
            </a>

            <!-- DNS同步 -->
            <a href="" class="item" v-if="teaCheckDNSTasks && doingDNSTasks.isUpdated" @click.prevent="showDNSTasks()">
                <span v-if="!doingDNSTasks.isDoing && !doingDNSTasks.hasError" class="hover-span"><i class="icon globe disabled"></i><span class="disabled">已同步DNS</span></span>
                <span v-if="doingDNSTasks.isDoing && !doingDNSTasks.hasError" class="hover-span rotate"><i class="icon globe"></i><span>正在同步DNS...</span></span>
                <span v-if="doingDNSTasks.hasError" class="red"><i class="icon globe"></i>DNS同步失败</span>
            </a>

            <!-- 消息 -->
			<a href="" class="item" :class="{active:teaMenu == 'message'}" @click.prevent="showMessages()">
                <span v-if="globalMessageBadge > 0" class="blink hover-span"><i class="icon bell"></i><span>消息({{globalMessageBadge}}) </span></span>
                <span v-if="globalMessageBadge == 0" class="hover-span"><i class="icon bell disabled"></i><span class="disabled">消息(0)</span></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"/>
                <span class="hover-span"><span class="disabled">{{teaUsername}}</span></span>
			</a>

            <!-- 背景颜色 -->
            <a href="" class="item" title="点击切换界面风格" @click.prevent="changeTheme()"><i class="icon adjust"></i></a>

            <!-- 企业版 -->
           <!-- <a :href="'/settings/authority'" class="item" title="商业版" :v-if="teaIsPlus"><i class="icon gem outline yellow"></i></a>-->

            <!-- 退出登录 -->
            <a :href="Tea.url('logout')" class="item" title="安全退出登录"><i class="icon sign out"></i>
                <span class="hover-span"><span class="disabled">退出登录</span></span>
            </a>
        </div>
    </div>

    <!-- 左侧主菜单 -->
    <div class="main-menu" :class="(teaTheme == null || teaTheme.length == 0) ? 'theme2': teaTheme" 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, expend: teaMenu == module.code}" v-if="module.isOn !== false">
					<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 class="module-name">{{module.name}}</span>
					</span>
                    <div class="subtitle" v-if="module.subtitle != null && module.subtitle.length > 0">{{module.subtitle}}</div>
				</a>
				<div v-if="teaMenu == module.code" class="sub-items">
					<a class="item" v-for="subItem in module.subItems" v-if="subItem.isOn !== false" :href="subItem.url"><i class="icon angle right" v-if="subItem.code == teaSubMenu"></i> {{subItem.name}}
                        <span class="ui label tiny red" v-if="subItem.badge != null && subItem.badge > 0">{{subItem.badge}}</span>
                    </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':!teaShowOpenSourceInfo}" 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>

        <!-- 功能区 -->
        <div class="main-box">
            {$TEA.VIEW}
            <div class="clear"></div>
        </div>
    </div>

	<!-- 底部 -->
	<div id="footer" class="ui menu inverted light-blue borderless small" v-if="teaShowOpenSourceInfo">
		<a  href="/settings/upgrade" class="item" title="点击进入检查版本更新页面">{{teaName}} <span v-if="teaIsPlus">&nbsp;Plus&nbsp;</span> v{{teaVersion}}</a>
        <a href="https://goedge.cn" target="_blank" class="item">官网</a>
        <a href="https://goedge.cn/docs" target="_blank" class="item">文档</a>
		<a href="https://github.com/TeaOSLab/EdgeAdmin" target="_blank" class="item">GitHub</a>
		<!--<a href="http://teaos.cn" target="_blank" class="item">官网</a>
		<a href="http://teaos.cn/doc" target="_blank" class="item">文档</a>-->
		<a href="https://github.com/TeaOSLab/EdgeAdmin/issues" target="_blank" class="item">提Bug</a>
		<a class="item" @click.prevent="showQQGroupQrcode()">QQ讨论群：659832182 &nbsp;<i class="icon qrcode"></i> </a>
		<a class="item right" href="https://goedge.cn/commercial" target="_blank" v-if="!teaIsPlus">企业版</a>
        <a class="item right" href="https://goedge.cn/docs/Appendix/Donation.md" target="_blank" v-if="teaIsPlus">捐助作者</a>
	</div>
</div>

{$echo "footer"}

</body>
</html>