feat: 系统设置页面左上角用户头像修改

This commit is contained in:
Captain.B 2020-10-09 16:13:49 +08:00
parent a98717517d
commit 04a022a4f3
1 changed files with 56 additions and 43 deletions

View File

@ -1,60 +1,73 @@
<template>
<el-row type="flex" align="middle" class="current-user">
<el-avatar shape="square" size="small" :src="squareUrl"/>
<span class="username">{{currentUser.name}}</span>
<div class="icon-title">
{{ currentUser.name.substring(0, 1) }}
</div>
<span class="username">{{ currentUser.name }}</span>
</el-row>
</template>
<script>
import {getCurrentUser} from "../../../common/js/utils";
import {getCurrentUser} from "@/common/js/utils";
export default {
name: "MsCurrentUser",
export default {
name: "MsCurrentUser",
data() {
return {
editVisible: false,
id: "123456",
squareUrl: "https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png",
form: {}
}
data() {
return {
editVisible: false,
id: "123456",
form: {}
}
},
methods: {
edit() {
this.editVisible = true;
this.form = Object.assign({}, this.currentUser);
},
methods: {
edit() {
this.editVisible = true;
this.form = Object.assign({}, this.currentUser);
},
submit() {
this.editVisible = false;
}
},
computed: {
currentUser: () => {
return getCurrentUser();
}
submit() {
this.editVisible = false;
}
},
computed: {
currentUser: () => {
return getCurrentUser();
}
}
}
</script>
<style scoped>
.current-user .username {
display: inline-block;
font-size: 16px;
font-weight: 500;
margin: 0 5px;
overflow-x: hidden;
padding-bottom: 0;
text-overflow: ellipsis;
vertical-align: middle;
white-space: nowrap;
width: 180px;
}
.current-user .username {
display: inline-block;
font-size: 16px;
font-weight: 500;
margin: 0 5px;
overflow-x: hidden;
padding-bottom: 0;
text-overflow: ellipsis;
vertical-align: middle;
white-space: nowrap;
width: 180px;
}
.current-user .edit {
opacity: 0;
}
.current-user .edit {
opacity: 0;
}
.current-user:hover .edit {
opacity: 1;
}
.icon-title {
color: #fff;
width: 30px;
background-color: #72dc91;
height: 30px;
line-height: 30px;
text-align: center;
border-radius: 30px;
font-size: 14px;
}
.current-user:hover .edit {
opacity: 1;
}
</style>