index.vue
5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<template>
<div class="personal-panel">
<div class="personal-desc" >
<div class="avatar-container">
<avatar :username="user.name"></avatar>
<!-- <img class="avatar" :src="require('@/assets/user.png')" /> -->
</div>
<div class="name-role">
<span class="sender">{{ user.name }} - {{ user.role||'超级管理员' }}</span>
</div>
<div class="registe-info">
<span class="registe-info">
<li class="fa fa-clock-o"></li>
注册时间:{{ user.registeInfo|| '2019-08-08' }}
</span>
</div>
</div>
<!-- <div class="personal-relation">
<span class="relation-item">followers</span>
<span class="relation-item">watches</span>
<span class="relation-item">friends</span>
</div> -->
<div class="main-operation">
<span class="main-operation-item">
<el-button size="small" icon="fa fa-male" @click="openUserMsgDialog()"> 个人中心</el-button>
</span>
<span class="main-operation-item">
<el-button size="small" icon="fa fa-key"> 修改密码</el-button>
</span>
</div>
<div class="other-operation">
<div class="other-operation-item">
<li class="fa fa-eraser"></li>
清除缓存
</div>
<!-- <div class="other-operation-item">
<li class="fa fa-user"></li>
在线人数
</div>
<div class="other-operation-item">
<li class="fa fa-bell"></li>
访问次数
</div>
<div class="other-operation-item" @click="showBackupDialog">
<li class="fa fa-undo"></li>
{{$t("common.backupRestore")}}
</div> -->
</div>
<div class="personal-footer" @click="logout">
<li class="fa fa-sign-out"></li>
注销
</div>
<!--备份还原界面-->
<!-- <backup ref="backupDialog" @afterRestore="afterRestore"></backup> -->
</div>
</template>
<script>
import Cookies from "js-cookie"
// import Backup from "@/views/Backup/Backup"
import Avatar from 'vue-avatar'
export default {
name: 'PersonalPanel',
components:{
// Backup
Avatar
},
props: {
user: {
type: Object,
default: {
name: "admin",
avatar: "@/assets/user.png",
role: "超级管理员",
registeInfo: "注册时间:2018-12-25 "
}
}
},
data() {
return {
}
},
methods: {
// 退出登录
logout: function() {
this.$confirm("确认退出吗?", "提示", {
type: "warning"
})
.then(() => {
sessionStorage.removeItem("user")
this.deleteCookie("token")
this.$router.push("/login")
this.$api.login.logout().then((res) => {
}).catch(function(res) {
})
})
.catch(() => {})
},
// 删除cookie
deleteCookie: function(name) {
Cookies.remove(name)
},
// 打开备份还原界面
showBackupDialog: function() {
this.$refs.backupDialog.setBackupVisible(true)
},
// 成功还原之后,重新登录
afterRestore: function() {
this.$refs.backupDialog.setBackupVisible(false)
sessionStorage.removeItem("user")
this.deleteCookie("token")
this.$router.push("/login")
this.$api.login.logout().then((res) => {
}).catch(function(res) {
})
},
//打开个人信息弹出框
openUserMsgDialog: function(){
console.log('aaaa')
}
},
mounted() {
}
}
</script>
<style scoped>
.personal-panel {
font-size: 14px;
width: 220px;
text-align: center;
border-color: rgba(180, 190, 190, 0.2);
border-width: 1px;
border-style: solid;
background: rgba(182, 172, 172, 0.1);
margin: -14px;
}
.personal-desc {
/* padding: 15px;
color: #fff; */
padding: 24px 0;
}
.avatar {
width: 80px;
height: 80px;
border-radius: 90px;
}
.avatar-container{
display:inline-block;
align:center;
}
.name-role {
font-size: 14px;
padding: 5px;
}
.personal-relation {
font-size: 16px;
padding: 12px;
margin-right: 1px;
background: rgba(200, 209, 204, 0.3);
}
.relation-item {
padding: 12px;
}
.relation-item:hover {
cursor: pointer;
color: rgb(19, 138, 156);
}
.main-operation {
padding: 8px;
margin-right: 1px;
/* background: rgba(175, 182, 179, 0.3); */
border-color: rgba(201, 206, 206, 0.2);
border-top-width: 1px;
border-top-style: solid;
}
.main-operation-item {
margin: 4px;
}
.other-operation {
padding: 15px;
margin-right: 1px;
text-align: left;
border-color: rgba(180, 190, 190, 0.2);
border-top-width: 1px;
border-top-style: solid;
}
.other-operation-item {
padding:0 12px;
}
.other-operation-item:hover {
cursor: pointer;
background: #9e94941e;
color: rgb(19, 138, 156);
}
.personal-footer {
margin-right: 1px;
font-size: 14px;
text-align: center;
padding-top: 10px;
padding-bottom: 10px;
border-color: rgba(180, 190, 190, 0.2);
border-top-width: 1px;
border-top-style: solid;
}
.personal-footer:hover {
cursor: pointer;
color: rgb(19, 138, 156);
background: #b1a6a61e;
}
</style>