提交 d44e1508 编写于 作者: WodahsOrez's avatar WodahsOrez

lxm--注销

上级 4d4fda4f
.crm-app-user-info { .crm-app-user-info {
width: 100%;
height: 100%;
.ivu-dropdown{
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; .ivu-dropdown-rel{
align-items: center; width: 100%;
cursor: pointer; height: 100%;
display: flex;
>.user-head-sculpture { align-items: center;
width: 32px; cursor: pointer;
height: 32px; >.user-head-sculpture {
border-radius: 50%; width: 32px;
border: 1px solid #8893a7; height: 32px;
font-size: 18px; border-radius: 50%;
font-weight: 900; border: 1px solid #8893a7;
text-align: center; font-size: 18px;
} font-weight: 900;
text-align: center;
>span { }
display: inline-block;
margin-left: 3px; >span {
margin-top: 3px; display: inline-block;
margin-left: 3px;
margin-top: 3px;
}
} }
}
} }
\ No newline at end of file
...@@ -32,6 +32,42 @@ export class AppUserInfo extends Vue { ...@@ -32,6 +32,42 @@ export class AppUserInfo extends Vue {
} }
} }
/**
* 下拉选选中回调
*
* @param {*} data
* @memberof AppUserInfo
*/
public userSelect(data: any) {
if (Object.is(data, 'logout')) {
const title: any = this.$t('components.appUser.surelogout');
this.$Modal.confirm({
title: title,
onOk: () => {
this.logout();
}
});
}
}
/**
* 退出登录
*
* @memberof AppUserInfo
*/
public logout() {
const get: Promise<any> = this.$http.get('v7/logout');
get.then((response:any) =>{
if (response && response.status === 200) {
localStorage.removeItem('user');
localStorage.removeItem('token');
this.$router.push({ name: 'login' });
}
}).catch((error: any) =>{
console.error(error);
})
}
/** /**
* 绘制用户信息内容 * 绘制用户信息内容
* *
...@@ -40,12 +76,20 @@ export class AppUserInfo extends Vue { ...@@ -40,12 +76,20 @@ export class AppUserInfo extends Vue {
*/ */
public render(): any { public render(): any {
return <div class="crm-app-user-info"> return <div class="crm-app-user-info">
<dropdown on-on-click={this.userSelect} transfer={true}>
<div class="user-head-sculpture"> <div class="user-head-sculpture">
{this.username} {this.username}
</div> </div>
<span> <span>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAUCAYAAACqJ5zlAAAAN0lEQVQoU2PsmLzCk5Hh/0wGBgaG/wyM6Yydk5c/+s/AIAsSYGRgeIwpgKEFpBQZMJIhMIzcAQAhOjo7JEcKTQAAAABJRU5ErkJggg=="></img> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAUCAYAAACqJ5zlAAAAN0lEQVQoU2PsmLzCk5Hh/0wGBgaG/wyM6Yydk5c/+s/AIAsSYGRgeIwpgKEFpBQZMJIhMIzcAQAhOjo7JEcKTQAAAABJRU5ErkJggg=="></img>
</span> </span>
<dropdown-menu class='menu' slot='list' style='font-size: 15px !important;'>
<dropdown-item name='logout' style='font-size: 15px !important;'>
<span><i aria-hidden='true' class='fa fa-cogs' style='margin-right: 8px;'></i></span>
<span>{this.$t('components.appUser.logout')}</span>
</dropdown-item>
</dropdown-menu>
</dropdown>
</div>; </div>;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册