| | |
| | | <template> |
| | | <div> |
| | | <!-- 头部 --> |
| | | <el-header> |
| | | <!-- 左侧菜单 --> |
| | | <div class="menuLeft"> |
| | | <div class="icon"> |
| | | <img style="width:30px;height:30px" |
| | | src="https://axure-file.lanhuapp.com/90466432-c999-4bf0-80b8-ee3f96a2099e__155eeb2ceaac89ec717869a050964a36.svg" |
| | | alt=""> |
| | | </div> |
| | | <div class="systemName">遂昌智慧执法平台</div> |
| | | <ul class="headerNav"> |
| | | <li v-for="(item,index) in nav" :key="item.name" :class="item.checked?'activeIndex':''" @click="handleChange(index)">{{item.name}}</li> |
| | | </ul> |
| | | <!-- 头部 --> |
| | | <el-header> |
| | | <!-- 左侧菜单 --> |
| | | <div class="header-left"> |
| | | <div class="menu-left__item" v-for="(item,index) in menuLeftList" :key="item.id" @click="changeActive(index)"> |
| | | <span :class="item.checked ? 'my-active':''">{{item.label}}</span> |
| | | </div> |
| | | <!-- 右侧菜单 --> |
| | | <div class="menuRight"> |
| | | <div class="search"> |
| | | <el-input placeholder="请输入搜索内容" suffix-icon="el-icon-search" v-model="search"> |
| | | </el-input> |
| | | </div> |
| | | <div class="userinfo userItem"> |
| | | <div class="userIcon"></div> |
| | | <span class="username">admin<i class="el-icon-arrow-down" style="margin-left:3px"></i></span> |
| | | </div> |
| | | <div class="userMessage userBtn"><i class="el-icon-message-solid"></i></div> |
| | | <div class="userSetting userBtn"><i class="el-icon-s-tools"></i></div> |
| | | <div class="userLoginout userBtn" @click="loginout"><i class="el-icon-switch-button"></i></div> |
| | | </div> |
| | | <!-- 右侧菜单 --> |
| | | <div class="header-right"> |
| | | <!-- 搜索框 --> |
| | | <div class="menu-right__item search"> |
| | | <el-input suffix-icon="el-icon-search" v-model="keyword" placeholder="请输入搜索内容"></el-input> |
| | | </div> |
| | | </el-header> |
| | | </div> |
| | | <!-- 登录用户 --> |
| | | <div class="menu-right__item user" @mousemove="flag.user=true" @mouseleave="flag.user=false"> |
| | | <el-avatar :size="20" :src="user.icon" v-if="user.icon"></el-avatar> |
| | | <el-avatar :size="20" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" v-else> |
| | | </el-avatar> |
| | | <span style="padding: 0 5px;">{{user.username? user.username:'Admin'}}</span> |
| | | <i class="el-icon-arrow-down"></i> |
| | | <!-- 用户操作 --> |
| | | <div class="user-card" v-if="flag.user" @mouseleave="flag.user = false"> |
| | | <el-card class="box-card"> |
| | | <div class="user-card__item">修改密码</div> |
| | | <div style="margin-top: 10px;" class="user-card__item">基本信息</div> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | <!-- 消息 --> |
| | | <div class="menu-right__item btn" @mousemove="flag.message = true" @mouseleave=" flag.message = false "> |
| | | <el-tooltip effect="dark" content="消息中心" placement="bottom-end" :hide-after="600"> |
| | | <el-badge :value="50" :max="99" class="item"> |
| | | <i class="el-icon-message-solid"></i> |
| | | </el-badge> |
| | | </el-tooltip> |
| | | <!-- 消息操作 --> |
| | | <div class="message-card" v-if="flag.message" @mouseleave=" flag.message = false "> |
| | | <el-card class="box-card"> |
| | | <div class="card-header"> |
| | | <span>消息中心</span> |
| | | <el-button type="text">接收设置</el-button> |
| | | </div> |
| | | <div v-for="item in menuMessageList" :key="item.id" class="message-card__item"> |
| | | <span class="label">{{item.label}}</span> |
| | | <span>({{item.num}})</span> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | <!-- 设置 --> |
| | | <div class="menu-right__item btn"> |
| | | <el-tooltip effect="dark" content="账户设置" placement="bottom-end" :hide-after="1000"> |
| | | <i class="el-icon-s-tools"></i> |
| | | </el-tooltip> |
| | | </div> |
| | | <!-- 退出登录 --> |
| | | <div class="menu-right__item btn" @click="loginout"> |
| | | <el-tooltip effect="dark" content="退出登录" placement="bottom-end" :hide-after="1000"> |
| | | <i class="el-icon-switch-button"></i> |
| | | </el-tooltip> |
| | | </div> |
| | | </div> |
| | | </el-header> |
| | | </template> |
| | | |
| | | <script> |
| | | import hamburger from "@/components/hamburger"; |
| | | export default { |
| | | data() { |
| | | return { |
| | | opened: false, |
| | | search:'', |
| | | nav:[ |
| | | menuLeftList: [ |
| | | { |
| | | name:'驾驶舱', |
| | | checked:true, |
| | | label: '驾驶舱', |
| | | checked: true, |
| | | url: '', |
| | | id: '1f' |
| | | }, |
| | | { |
| | | name:'视频查询', |
| | | checked:false, |
| | | label: '视频巡查', |
| | | checked: false, |
| | | url: '', |
| | | id: '2f' |
| | | }, |
| | | { |
| | | name:'执法管理', |
| | | checked:false, |
| | | } |
| | | ] |
| | | label: '执法管理', |
| | | checked: false, |
| | | url: '', |
| | | if: '3f', |
| | | }, |
| | | ], |
| | | flag: { |
| | | user: false, |
| | | message: false |
| | | }, |
| | | user: '', |
| | | menuMessageList: [ |
| | | { |
| | | label: '全部消息', |
| | | num: 10, |
| | | id: '1m' |
| | | }, |
| | | { |
| | | label: '产品消息', |
| | | num: 10, |
| | | id: '2m' |
| | | }, |
| | | { |
| | | label: '安全消息', |
| | | num: 10, |
| | | id: '3m' |
| | | }, |
| | | { |
| | | label: '服务消息', |
| | | num: 10, |
| | | id: '4m' |
| | | }, |
| | | ], |
| | | keyword: '', |
| | | }; |
| | | }, |
| | | components: { |
| | | hamburger, |
| | | created() { |
| | | this.getLoginInfo(); |
| | | }, |
| | | methods: { |
| | | // 退出功能 |
| | | loginout() { |
| | | this.$router.push({ path: "/login" }) |
| | | }, |
| | | handleChange(idx){ |
| | | // 设置nav激活 |
| | | this.nav.forEach((item,index)=>{ |
| | | index==idx?item.checked = true:item.checked = false; |
| | | this.$confirm('退出系统确认', '确认提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | sessionStorage.clear(); |
| | | this.$router.push({ path: "/login" }) |
| | | }).catch(err => { |
| | | console.log(err); |
| | | }) |
| | | localStorage.setItem('navIdx',idx); |
| | | }, |
| | | // 改变选中状态 |
| | | changeActive(idx) { |
| | | this.menuLeftList.forEach((item, index) => { |
| | | if (index === idx) { |
| | | item.checked = true; |
| | | } else { |
| | | item.checked = false; |
| | | } |
| | | }) |
| | | }, |
| | | // 获取登录用户信息 |
| | | getLoginInfo() { |
| | | const info = JSON.parse(sessionStorage.getItem('user')); |
| | | if (info) { |
| | | this.user = info; |
| | | } else { |
| | | const name = sessionStorage.getItem('name'); |
| | | this.$axios({ |
| | | method: 'get', |
| | | url: 'sccg/admin/info?name=' + name, |
| | | }) |
| | | .then(res => { |
| | | sessionStorage.setItem('user', JSON.stringify(res.data)); |
| | | this.user = res.data; |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | const idx = localStorage.getItem("navIdx"); |
| | | if(idx){ |
| | | this.handleChange(idx); |
| | | } |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | * { |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | |
| | | .el-header { |
| | | background-color: rgb(0, 121, 254); |
| | | background-color: #071a38; |
| | | color: #333; |
| | | text-align: center; |
| | | line-height: 60px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 0; |
| | | position: fixed; |
| | | width: 100%; |
| | | top: 0px; |
| | | z-index: 9999; |
| | | .menuLeft { |
| | | color: #fff; |
| | | padding: 0 20px; |
| | | // width: 100%; |
| | | color: #4b9bb7; |
| | | |
| | | .icon { |
| | | margin: 0 20px; |
| | | } |
| | | .header-left { |
| | | display: flex; |
| | | |
| | | .systemName { |
| | | width: 185px; |
| | | font-weight: 650; |
| | | font-size: 18px; |
| | | } |
| | | .menu-left__item { |
| | | width: 120px; |
| | | |
| | | ul, |
| | | .icon { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | span { |
| | | display: block; |
| | | line-height: 40px; |
| | | width: 100%; |
| | | |
| | | li { |
| | | list-style: none; |
| | | width: 100px; |
| | | &:hover{ |
| | | cursor: pointer; |
| | | &:hover { |
| | | cursor: pointer; |
| | | color: #fff; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .activeIndex { |
| | | height: 30px; |
| | | line-height: 30px; |
| | | .my-active { |
| | | border-radius: 20px; |
| | | background-color: #53a5ff; |
| | | color: #fff; |
| | | background-color: #092c4a; |
| | | } |
| | | |
| | | display: flex; |
| | | } |
| | | |
| | | .menuRight { |
| | | .header-right { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-evenly; |
| | | .search{ |
| | | .el-input{ |
| | | width: 200px; |
| | | margin: 0 10px; |
| | | } |
| | | .el-input__inner{ |
| | | height: 30px; |
| | | } |
| | | } |
| | | .userItem{ |
| | | width: 120px; |
| | | } |
| | | .userBtn{ |
| | | |
| | | .item { |
| | | width: 60px; |
| | | color: #fff; |
| | | font-size: 20px; |
| | | position: relative; |
| | | |
| | | :deep(.is-fixed) { |
| | | width: 20px; |
| | | height: 20px; |
| | | padding: 0; |
| | | top: 20px; |
| | | right: 30px; |
| | | border-radius: 50%; |
| | | position: absolute; |
| | | } |
| | | } |
| | | .userinfo { |
| | | |
| | | .search { |
| | | width: 200px; |
| | | } |
| | | |
| | | .user { |
| | | margin-left: 20px; |
| | | width: 120px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | .userIcon { |
| | | width: 20px; |
| | | height: 20px; |
| | | border-radius: 50%; |
| | | background-image: url("@/assets/imgs/user/default-avatar.jpg"); |
| | | background-size: cover; |
| | | } |
| | | position: relative; |
| | | |
| | | .username { |
| | | margin: 0 5px; |
| | | color: #22d3eb; |
| | | font-size: 14px; |
| | | .user-card { |
| | | position: absolute; |
| | | top: 60px; |
| | | width: 120px; |
| | | z-index: 3000; |
| | | .user-card__item { |
| | | padding: 5px 0; |
| | | |
| | | &:hover { |
| | | color: #fff; |
| | | background-color: #071a38; |
| | | } |
| | | } |
| | | |
| | | :deep(.el-card) { |
| | | background-color: #092c4a; |
| | | border: 1px solid #17324c; |
| | | color: #4b9bb7; |
| | | } |
| | | |
| | | :deep(.el-card__body) { |
| | | line-height: 20px; |
| | | padding: 10px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .loginout { |
| | | color: #22d3eb; |
| | | font-size: 14px; |
| | | .btn { |
| | | width: 60px; |
| | | font-size: 20px; |
| | | position: relative; |
| | | |
| | | .message-card { |
| | | position: absolute; |
| | | top: 60px; |
| | | width: 180px; |
| | | left: -50px; |
| | | z-index: 3000; |
| | | :deep(.el-card__body) { |
| | | padding: 0; |
| | | } |
| | | |
| | | :deep(.el-card) { |
| | | background-color: #092c4a; |
| | | border: 1px solid #17324c; |
| | | color: #4b9bb7; |
| | | } |
| | | |
| | | .card-header { |
| | | padding: 0 20px; |
| | | line-height: 40px; |
| | | font-size: 14px; |
| | | display: flex; |
| | | border-bottom: 1px solid #17324c; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .message-card__item { |
| | | line-height: 30px; |
| | | font-size: 14px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | padding: 0 20px; |
| | | |
| | | .label:hover { |
| | | cursor: pointer; |
| | | color: #fff; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .user:hover, |
| | | .btn:hover { |
| | | background-color: #092c4a; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |