<template>
<div class="layout">
<el-container>
<keep-alive>
<el-header>
<el-row :gutter="20">
<el-col :span="3">
<div class="grid-content bg-purple">
<h1 style='font-weight: 900;font-size: 18px; padding-left: 30px;width: 200px'>萬(wàn)維星辰</h1>
</div>
</el-col>
<el-col :span="10" :offset='1'>
<ul class="grid-content bg-purple">
<el-menu :default-active="activeIndex" mode="horizontal" router @select="handleSelect">
<el-menu-item index='/management'>日志管理</el-menu-item>
<el-menu-item index='/analysis'>日志分析</el-menu-item>
<el-menu-item index='/audit'>日志審計(jì)</el-menu-item>
</el-menu>
</ul>
</el-col>
<el-col :span="6" class='fr'>
<div class="grid-content bg-purple">
<el-menu :default-active="activeIndex" class="el-menu-demo fr" mode="horizontal" @select="handleSelect">
<el-submenu index="4">
<template slot="title">賬戶設(shè)置</template>
<el-menu-item index="4-1">基本資料</el-menu-item>
<el-menu-item index="4-2">修改密碼</el-menu-item>
<el-menu-item index="4-3" style='border-top:1px solid #eee'>退出</el-menu-item>
</el-submenu>
<el-menu-item index="5" class='fr' @click.native='logout'>退出登錄</el-menu-item>
</el-menu>
</div>
</el-col>
</el-row>
</el-header>
</keep-alive>
<el-container>
<!-- 側(cè)邊欄區(qū)域 -->
<el-aside :width="isCollapse?'50px':'180px'">
<el-menu
active-text-color='#409EFF'
background-color='#2F4156'
:default-active='defaultActive'
router
:collapse='isCollapse'
>
<template v-for='(item,index) in sidebarInfor' v-if='item.roles.length==0||item.roles.includes(roles)'>
<!-- 分組導(dǎo)航 -->
<el-submenu :index='basePath+item.path' :key='index' v-if='item.data.length>1'>
<template slot="title">
<i :class="item.icon"></i>
<span>{{item.title}}</span>
</template>
<el-menu-item-group v-for='(subitem,subindex) in item.data' :key='subindex'>
<el-menu-item
:index='basePath+subitem.path'
v-if="subitem.meta.roles.includes(roles)"
>{{subitem.meta.subtitle}}</el-menu-item>
</el-menu-item-group>
</el-submenu>
<!-- 單項(xiàng)導(dǎo)航 -->
<el-menu-item :index='basePath+item.path' :key='index' v-else>
<i :class="item.icon"></i>
<span solt="title">{{item.title}}</span>
</el-menu-item>
</template>
</el-menu>
<i class='collapse-icon' :class='isCollapse?"el-icon-d-arrow-right":"el-icon-d-arrow-left"' @click='handleCollapse'></i>
</el-aside>
<el-main id='main-content' :key='this.$route.path' :class="{ 'content-expand': isCollapse }">
<slot></slot>
</el-main>
</el-container>
</el-container>
</div>
</template>
<script>
import {mapGetters,mapActions} from 'vuex';
import {grouping} from '@/utils/grouping'
export default {
data() {
return {
activeIndex: '/management',
defaultActive: '/management/logsources',
isCollapse : false,
sidebarInfor:[],
};
},
computed:{
...mapGetters(['roles']),
basePath(){
return this.$route.path.match(/^\/[a-zA-Z]*/g)[0]+'/';
},
curRouter(){
return this.$router.options.routes.filter(route=>{
if(route.path !=='/'){
return this.$route.path.startsWith(route.path)
}
})[0];
}
},
created(){
this.defaultActive = this.$route.path;
this.activeIndex = this.$route.path.match(/^\/[a-zA-Z]*/g)[0];
this.sidebarInfor = grouping(this.curRouter.children);
if(!this.roles){this.getUserInfor()}
},
methods: {
...mapActions(['getUserInfor']),
handleSelect(key, keyPath) {
this.activeIndex = key;
},
logout(){
localStorage.removeItem('XD_TOKEN');
this.$router.push('/login')
},
handleCollapse(){
this.isCollapse = !this.isCollapse
}
}
}
</script>
<style lang="less" scoped>
.el-header {
position: fixed;
z-index: 3;
background-color: #fff;
width: 100%;
height: 50px;
line-height: 50px;
box-shadow: 0 1px 1px #909399;
.el-col {
height: 50px;
line-height: 50px;
.el-menu-item:hover {
background: #64D8D6;
}
}
}
.el-aside {
background-color: #2F4156;
position: fixed;
top: 51px;
left: 0;
height: 100%;
transition: width .5s;
.collapse-icon {
color:#fff;
cursor:pointer;
text-align:center;
width:100%;
position:absolute;
bottom: 100px;
margin-left: 0px !important }
i {margin-top: -3px !important; margin-right: 2px;margin-left: -10px !important;}
.el-menu-item,.el-submenu span{
color:#BFCBD9;
}
.el-menu {
border-right: solid 1px #2F4156;
}
}
.el-aside-collapse {
width: 50px;
}
.el-main {
transition: margin-left .5s;
margin: 15px;
margin-left: 192px;
margin-top: 65px;
border: 1px solid #DCDFE6;
border-radius: 5px;
min-height: calc(~ '100vh - 85px');
box-shadow: 1px 2px 1px #DCDFE6;
background-color: #fff
}
.content-expand{
transition: margin-left .5s;
margin-left: 64px;
}
</style>
日志系統(tǒng)代碼
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
- 文/潘曉璐 我一進(jìn)店門孔飒,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)灌闺,“玉大人艰争,你說(shuō)我怎么就攤上這事」鸲裕” “怎么了甩卓?”我有些...
- 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)蕉斜。 經(jīng)常有香客問(wèn)我逾柿,道長(zhǎng),這世上最難降的妖魔是什么宅此? 我笑而不...
- 正文 為了忘掉前任机错,我火速辦了婚禮,結(jié)果婚禮上父腕,老公的妹妹穿的比我還像新娘弱匪。我一直安慰自己,他們只是感情好璧亮,可當(dāng)我...
- 文/花漫 我一把揭開白布萧诫。 她就那樣靜靜地躺著,像睡著了一般枝嘶。 火紅的嫁衣襯著肌膚如雪财搁。 梳的紋絲不亂的頭發(fā)上,一...
- 那天躬络,我揣著相機(jī)與錄音,去河邊找鬼搭儒。 笑死穷当,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的淹禾。 我是一名探鬼主播馁菜,決...
- 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼铃岔!你這毒婦竟也來(lái)了汪疮?” 一聲冷哼從身側(cè)響起,我...
- 序言:老撾萬(wàn)榮一對(duì)情侶失蹤毁习,失蹤者是張志新(化名)和其女友劉穎智嚷,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體纺且,經(jīng)...
- 正文 獨(dú)居荒郊野嶺守林人離奇死亡盏道,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
- 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了载碌。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片猜嘱。...
- 正文 年R本政府宣布论皆,位于F島的核電站益楼,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏纯丸。R本人自食惡果不足惜偏形,卻給世界環(huán)境...
- 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望觉鼻。 院中可真熱鬧俊扭,春花似錦、人聲如沸坠陈。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)仇矾。三九已至庸蔼,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間贮匕,已是汗流浹背姐仅。 一陣腳步聲響...
- 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像敦锌,于是被迫代替她去往敵國(guó)和親馒疹。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
推薦閱讀更多精彩內(nèi)容
- 1.上次同事發(fā)現(xiàn)高端交易系統(tǒng)日志, 出現(xiàn)大量異常日志, 如下圖: 2.經(jīng)過(guò)排查, 是由于運(yùn)維的系能監(jiān)控系統(tǒng), 定時(shí)...
- 參考1.247365 web 系統(tǒng)建設(shè)<一>——nginx+iis實(shí)現(xiàn)負(fù)載均衡2.Exceptionless搭配l...
- 文|胡青牛 對(duì)抗無(wú)法打敗的對(duì)手,承受難以承受的傷痛听想,去勇士都不敢去的地方腥刹,不管多么絕望,不管多么遙遠(yuǎn)汉买,毫不猶豫肛走,為...