ZW_MultiSelect/wms-vue/src/components/Header.vue

68 lines
1.5 KiB
Vue
Raw Normal View History

2024-03-15 10:59:17 +08:00
<template>
<div style="display: flex;line-height: 60px;">
<div style="margin-top: 8px;">
<i :class="icon" style="font-size: 20px;cursor: pointer" @click="collapse"></i>
</div>
<div style="flex:1px;text-align: center;font-size: 34px;">
<span>友仓WMS管理平台</span>
</div>
<el-dropdown>
<span>{{ user.userName }}</span>
<i class="el-icon-arrow-down" style="margin-left: 5px;"></i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="toUser">个人中心</el-dropdown-item>
<el-dropdown-item @click.native="logOut">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</template>
<script>
export default {
name: "Header",
data() {
return {
user: JSON.parse(sessionStorage.getItem('user'))
}
},
props: {
icon: String
},
methods: {
toUser() {
this.$router.push('/home')
},
logOut() {
this.$confirm('您确认是否退出登录?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$router.replace('/login')
sessionStorage.clear();
this.$message({
type: 'success',
message: '已退出!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
});
});
},
collapse() {
this.$emit('doCollapse')
}
},
created() {
this.$router.push('/home')
}
}
</script>
<style scoped>
</style>