From 13e9ddabf4ba3a89aa2a93fe8d3b35c8604c6813 Mon Sep 17 00:00:00 2001
From: luobisheng <727299681@qq.com>
Date: 星期三, 16 十一月 2022 17:51:29 +0800
Subject: [PATCH] 获取文件名字修改
---
src/views/layout/components/Header/index.vue | 38 +++++++++++++++++++++-----------------
1 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/views/layout/components/Header/index.vue b/src/views/layout/components/Header/index.vue
index 8525a7c..cc861e6 100644
--- a/src/views/layout/components/Header/index.vue
+++ b/src/views/layout/components/Header/index.vue
@@ -1,6 +1,6 @@
<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)">
@@ -157,10 +157,11 @@
],
keyword: '',
info:null,
+ show:false
};
},
created() {
- this.getLoginInfo();
+ this.setLoginInfo()
},
methods: {
baseInfo() {
@@ -198,7 +199,6 @@
sessionStorage.clear();
this.$router.push({ path: "/login" })
}).catch(err => {
- console.log(err);
})
},
// 鏀瑰彉閫変腑鐘舵��
@@ -211,22 +211,25 @@
}
})
},
- // 鑾峰彇鐧诲綍鐢ㄦ埛淇℃伅
- getLoginInfo() {
+ // 璁剧疆鐢ㄦ埛鍩烘湰淇℃伅
+ async setLoginInfo() {
const info = JSON.parse(sessionStorage.getItem('user'));
if (info) {
this.user = info;
} else {
+ this.user = await this.getLoginInfo();
+ }
+ 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
}
}
};
@@ -253,7 +256,7 @@
.header-left {
display: flex;
-
+ flex: 1;
.menu-left__item {
width: 120px;
@@ -278,9 +281,10 @@
.header-right {
display: flex;
-
+ padding-left: 10vw;
+ flex: 1;
.item {
- width: 60px;
+ width: 100%;
position: relative;
:deep(.is-fixed) {
@@ -295,12 +299,12 @@
}
.search {
- width: 200px;
+ flex: 3;
}
.user {
margin-left: 20px;
- width: 120px;
+ flex: 2;
display: flex;
align-items: center;
justify-content: center;
@@ -335,7 +339,7 @@
}
.btn {
- width: 60px;
+ flex: 1;
font-size: 20px;
position: relative;
--
Gitblit v1.8.0