| | |
| | | <template> |
| | | <!-- 头部 --> |
| | | <el-header> |
| | | <el-header v-if="show"> |
| | | <!-- 左侧菜单 --> |
| | | <div class="header-left"> |
| | | <div class="menu-left__item" v-for="(item, index) in menuLeftList" :key="item.id" @click="changeActive(index)"> |
| | |
| | | ], |
| | | keyword: '', |
| | | info:null, |
| | | show:false |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getLoginInfo(); |
| | | this.setLoginInfo() |
| | | console.log(this.user) |
| | | }, |
| | | methods: { |
| | | baseInfo() { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | // 获取登录用户信息 |
| | | getLoginInfo() { |
| | | // 设置用户基本信息 |
| | | async setLoginInfo() { |
| | | const info = JSON.parse(sessionStorage.getItem('user')); |
| | | if (info) { |
| | | console.log(info) |
| | | this.user = info; |
| | | } else { |
| | | this.user = await this.getLoginInfo(); |
| | | console.log(this.user) |
| | | } |
| | | this.show = true |
| | | }, |
| | | // 获取登录用户信息 |
| | | async getLoginInfo(){ |
| | | const name = sessionStorage.getItem('name'); |
| | | this.$axios({ |
| | | let res = await this.$axios({ |
| | | method: 'get', |
| | | url: 'sccg/admin/info?name=' + name, |
| | | }) |
| | | .then(res => { |
| | | sessionStorage.setItem('user', JSON.stringify(res.data)); |
| | | this.user = res.data; |
| | | }) |
| | | } |
| | | sessionStorage.setItem('user', JSON.stringify(res.data)); |
| | | return res.data |
| | | } |
| | | } |
| | | }; |
| | |
| | | methods:{ |
| | | handleJump(url){ |
| | | const baseURL = '/home' |
| | | console.log(url) |
| | | // 路由跳转 |
| | | this.$router.push({path:baseURL+url}) |
| | | } |