| | |
| | | <template> |
| | | <div class="leftMenu"> |
| | | <div class="leftTopWrapper"> |
| | | <div class="logo"> |
| | | <img src="../assets/img/www.terra-it.cn.png" alt="" /> |
| | | </div> |
| | | <div class="menu"> |
| | | <el-menu |
| | | active-text-color="#ffd04b" |
| | | class="el-menu-vertical-demo" |
| | | :default-active="activeIndex" |
| | | background-color="#586884" |
| | | text-color="#fff" |
| | | @select="handleselect" |
| | | > |
| | | <customElMenu :menuData="menuList"></customElMenu> |
| | | </el-menu> |
| | | </div> |
| | | <div class="topMenu"> |
| | | <div class="logo"> |
| | | <img src="../assets/img/www.terra-it.cn.png" alt="" /> |
| | | </div> |
| | | <div class="leftBotWrapper"> |
| | | <div class="rightWrapper"> |
| | | <div class="menu"> |
| | | <ul> |
| | | <li v-for="item in menuList" :key="item.id"> |
| | | {{ item.cnName }} |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | <div class="userInfo"> |
| | | <img src="../assets/img/user.png" alt="" /> |
| | | <span>admin</span> |
| | | <span @click="logOut">注销</span> |
| | | |
| | | <span @click="switchLang"> 切换语言</span> |
| | | </div> |
| | | <div class="btnBox"> |
| | | <div><img src="../assets/img/leftBtn.png" alt="" /></div> |
| | | <div><img src="../assets/img/rightBtn.png" alt="" /></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.getMenuTree(); |
| | | this.getUserPerms(); |
| | | this.getMenuTree(); |
| | | }, |
| | | computed: { |
| | | // 我们使用计算属性来获取到当前点击的菜单的路由路径,然后设置default-active中的值 |
| | |
| | | if (res.code == 200) { |
| | | if (res.result.length != 0) { |
| | | let menuLists = res.result.filter((value) => { |
| | | return value.type == 1; |
| | | return value.pid == 1; |
| | | }); |
| | | this.menuList = this.treeData(menuLists); |
| | | // console.log(menuLists); |
| | | this.menuList = menuLists; |
| | | } else { |
| | | alert("暂无菜单栏数据"); |
| | | } |
| | |
| | | }) |
| | | .then(async () => { |
| | | const data = await logout({ token: getToken() }); |
| | | console.log(data); |
| | | // console.log(data); |
| | | if (data.code != 200) { |
| | | return this.$message.error("退出登录失败"); |
| | | } |
| | |
| | | </script> |
| | | <style lang="less" scoped> |
| | | //@import url(); 引入公共css类 |
| | | .leftMenu { |
| | | // width: 300px; |
| | | height: 99%; |
| | | // background-color: #bfa; |
| | | } |
| | | .leftTopWrapper { |
| | | .topMenu { |
| | | width: 100%; |
| | | height: 100%; |
| | | .logo { |
| | | // background-color: rgb(139, 0, 0); |
| | | width: 249px; |
| | | height: 52px; |
| | | img { |
| | | width: 100%; |
| | | } |
| | | } |
| | | .menu { |
| | | height: 90%; |
| | | margin-top: 22px; |
| | | overflow: auto; |
| | | // background-color: rgb(120, 121, 120); |
| | | .el-menu { |
| | | height: 100%; |
| | | width: 280px; |
| | | border-right: none; |
| | | /deep/ .el-submenu { |
| | | margin-bottom: 10px; |
| | | .el-submenu__title { |
| | | background-color: transparent !important; |
| | | } |
| | | } |
| | | .faSub { |
| | | background-color: #586884; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .leftBotWrapper { |
| | | width: 258px; |
| | | position: absolute; |
| | | left: 19px; |
| | | bottom: 17px; |
| | | background-image: linear-gradient(rgb(34, 33, 33), rgb(27, 31, 78)); |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | .userInfo { |
| | | // width: 138px; |
| | | font-size: 16px; |
| | | font-family: Microsoft YaHei; |
| | | font-weight: 400; |
| | | color: #fcfcfc; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | cursor: pointer; |
| | | |
| | | .logo { |
| | | width: 500px; |
| | | height: 100%; |
| | | position: relative; |
| | | img { |
| | | width: 70%; |
| | | position: absolute; |
| | | top: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | margin: auto; |
| | | } |
| | | } |
| | | .btnBox { |
| | | width: 65px; |
| | | .rightWrapper { |
| | | width: 70%; |
| | | height: 100%; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | .menu { |
| | | height: 100%; |
| | | width: 80%; |
| | | background-color: rgb(120, 121, 120); |
| | | ul { |
| | | display: flex; |
| | | justify-content: space-around; |
| | | li { |
| | | width: 120px; |
| | | height: 120px; |
| | | background: #bfa; |
| | | } |
| | | } |
| | | } |
| | | .userInfo { |
| | | background-color: pink; |
| | | |
| | | // width: 138px; |
| | | font-size: 16px; |
| | | font-family: Microsoft YaHei; |
| | | font-weight: 400; |
| | | color: #fcfcfc; |
| | | // display: flex; |
| | | // justify-content: space-between; |
| | | // align-items: center; |
| | | // cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | </style> |