|
@@ -1,7 +1,9 @@
|
|
<template>
|
|
<template>
|
|
<el-container class="outter-container">
|
|
<el-container class="outter-container">
|
|
<el-header>
|
|
<el-header>
|
|
- <h3><img src="../../assets/logo.png" height="38"/></h3>
|
|
|
|
|
|
+ <h3>
|
|
|
|
+ <img src="../../assets/logo.png" height="38" />
|
|
|
|
+ </h3>
|
|
<div class="user-info">
|
|
<div class="user-info">
|
|
<i class="el-icon-s-custom"></i>
|
|
<i class="el-icon-s-custom"></i>
|
|
<span v-html="user.realName" style="margin-right:10px;"></span>
|
|
<span v-html="user.realName" style="margin-right:10px;"></span>
|
|
@@ -20,24 +22,30 @@
|
|
</el-menu>
|
|
</el-menu>
|
|
</el-aside>
|
|
</el-aside>
|
|
<el-main>
|
|
<el-main>
|
|
- <router-view/>
|
|
|
|
|
|
+ <router-view />
|
|
</el-main>
|
|
</el-main>
|
|
</el-container>
|
|
</el-container>
|
|
</el-container>
|
|
</el-container>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import MenuTreeItem from "@/components/MenuTreeItem"
|
|
|
|
-import menuApi from "@/api/sys/menu"
|
|
|
|
-import userApi from "@/api/sys/user"
|
|
|
|
|
|
+import MenuTreeItem from "@/components/MenuTreeItem";
|
|
|
|
+import menuApi from "@/api/sys/menu";
|
|
|
|
+import userApi from "@/api/sys/user";
|
|
|
|
+import messageApi from "@/api/base/message";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
menuList: [],
|
|
menuList: [],
|
|
loading: false,
|
|
loading: false,
|
|
- user: {}
|
|
|
|
|
|
+ user: {},
|
|
|
|
+ messageNum: 0
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ // created() {
|
|
|
|
+ // //获取未读消息数
|
|
|
|
+ // this.getUnReadMessageNum();
|
|
|
|
+ // },
|
|
methods: {
|
|
methods: {
|
|
handleOpen(key, keyPath) {
|
|
handleOpen(key, keyPath) {
|
|
console.log(key, keyPath);
|
|
console.log(key, keyPath);
|
|
@@ -53,32 +61,56 @@ export default {
|
|
this.$store.dispatch("user/logout").then(() => {
|
|
this.$store.dispatch("user/logout").then(() => {
|
|
this.$router.push({ path: "/login" });
|
|
this.$router.push({ path: "/login" });
|
|
});
|
|
});
|
|
|
|
+ }, //获取未读消息数
|
|
|
|
+ getUnReadMessageNum() {
|
|
|
|
+ messageApi.getMessageCount().then(resp => {
|
|
|
|
+ if (resp.data.result) {
|
|
|
|
+ this.messageNum = resp.data.data;
|
|
|
|
+ this.resetMenu();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //定义菜单的未读消息数
|
|
|
|
+ resetMenu() {
|
|
|
|
+ //定义菜单的未读消息数
|
|
|
|
+ var menuList = this.menuList;
|
|
|
|
+ console.log(menuList);
|
|
|
|
+ for (var key in menuList) {
|
|
|
|
+ if (menuList[key]["menuName"] == "我的消息") {
|
|
|
|
+ menuList[key]["msgNum"] = this.messageNum; //this.messageNum;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.menuList = menuList;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
- "menu-tree-item" : MenuTreeItem
|
|
|
|
|
|
+ "menu-tree-item": MenuTreeItem
|
|
},
|
|
},
|
|
|
|
+
|
|
mounted() {
|
|
mounted() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
|
|
|
- userApi.userInfo().then(resp=>{
|
|
|
|
- if(resp.data.result){
|
|
|
|
|
|
+ userApi.userInfo().then(resp => {
|
|
|
|
+ if (resp.data.result) {
|
|
this.user = resp.data.data;
|
|
this.user = resp.data.data;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- menuApi.getMenuTree().then(response=>{
|
|
|
|
- console.log(response);
|
|
|
|
|
|
+ menuApi
|
|
|
|
+ .getMenuTree()
|
|
|
|
+ .then(response => {
|
|
|
|
+ console.log(response);
|
|
|
|
|
|
- var jsonData = response.data;
|
|
|
|
|
|
+ var jsonData = response.data;
|
|
|
|
|
|
- this.menuList = jsonData.data;
|
|
|
|
-
|
|
|
|
- this.loading = false;
|
|
|
|
- }).catch(exception=>{
|
|
|
|
- this.$message.error(exception + "");
|
|
|
|
- this.loading = false;
|
|
|
|
- });
|
|
|
|
|
|
+ this.menuList = jsonData.data;
|
|
|
|
+ this.getUnReadMessageNum();
|
|
|
|
+ this.loading = false;
|
|
|
|
+ })
|
|
|
|
+ .catch(exception => {
|
|
|
|
+ this.$message.error(exception + "");
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -94,7 +126,7 @@ export default {
|
|
color: #333;
|
|
color: #333;
|
|
text-align: left;
|
|
text-align: left;
|
|
height: 70px !important;
|
|
height: 70px !important;
|
|
- line-height:70px;
|
|
|
|
|
|
+ line-height: 70px;
|
|
border-bottom: 2px solid rgb(193, 32, 26);
|
|
border-bottom: 2px solid rgb(193, 32, 26);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -112,7 +144,7 @@ export default {
|
|
|
|
|
|
.el-aside .el-menu {
|
|
.el-aside .el-menu {
|
|
flex: 1;
|
|
flex: 1;
|
|
- background-color:rgb(238, 238, 238);
|
|
|
|
|
|
+ background-color: rgb(238, 238, 238);
|
|
}
|
|
}
|
|
|
|
|
|
.el-main {
|
|
.el-main {
|
|
@@ -126,20 +158,20 @@ export default {
|
|
text-align: left;
|
|
text-align: left;
|
|
}
|
|
}
|
|
|
|
|
|
-.user-info{
|
|
|
|
|
|
+.user-info {
|
|
position: absolute;
|
|
position: absolute;
|
|
- right:20px;
|
|
|
|
- bottom:10px;
|
|
|
|
- font-size:14px;
|
|
|
|
|
|
+ right: 20px;
|
|
|
|
+ bottom: 10px;
|
|
|
|
+ font-size: 14px;
|
|
line-height: 30px;
|
|
line-height: 30px;
|
|
|
|
|
|
- a{
|
|
|
|
- color:blue;
|
|
|
|
|
|
+ a {
|
|
|
|
+ color: blue;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
text-decoration: none;
|
|
}
|
|
}
|
|
|
|
|
|
- a:hover{
|
|
|
|
|
|
+ a:hover {
|
|
text-decoration: underline;
|
|
text-decoration: underline;
|
|
}
|
|
}
|
|
}
|
|
}
|