ADD file via upload

main
pjhmizn49 1 year ago
parent 8121655adb
commit fb4fa6349e

@ -0,0 +1,75 @@
<template>
<div class="header">
<div class="left">
<el-button @click="handleMenu" icon="el-icon-menu" size="mini"></el-button>
</div>
<div class="right">
<el-dropdown>
<span class="el-dropdown-link">
<el-avatar :src="require('/Users/zhangjiadi/IdeaProjects/毕业设计/picFiles'+staff_pic)"></el-avatar>
</span>
<el-dropdown-menu>
<div v-show="staff_role===1" style="margin:0 20px"> {{ staff_name }}</div>
<div v-show="staff_role===0" style="margin:0 20px"> {{ staff_name }}</div>
<el-dropdown-item @click.native="logout" icon="el-icon-switch-button" divided>退出</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</template>
<script>
import Cookie from "js-cookie";
export default {
data(){
return {
staff_id:1,
staff_name:'',
staff_role:1,
staff_pic:''
}
},
created() {
const _this=this;
axios({
method: 'post',
url: 'http://localhost:8181/staff/getByToken',
headers: {
Authorization: Cookie.get('token'),
'Content-Type': 'application/json'
}
}).then(function (response){
if (response.data.code===200) {
_this.staff_id=response.data.data.staff_id;
_this.staff_name=response.data.data.staff_name;
_this.staff_role=response.data.data.staff_role;
_this.staff_pic=response.data.data.staff_pic;
}
});
},
methods:{
handleMenu(){
this.$store.commit('collapseMenu')
},
logout(){
//Cookietoken
Cookie.remove('token')
//Cookiemenu
Cookie.remove('menu')
this.$router.push('/login')
}
}
}
</script>
<style>
.header{
background-color: #333;
height: 60px;
padding: 0 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.right{
margin-right: 20px;
}
</style>
Loading…
Cancel
Save