提交 0d46950c 编写于 作者: KK's avatar KK

修改密码

上级 88b1eb83
.update-password{
.password-item{
margin-top:10px;
padding:0 10px 0 10px;
.ivu-btn{
margin-top:15px;
}
}
}
\ No newline at end of file
<template>
<div class="update-password">
<div class="password-item">
<label for>
原密码:
<Input type="password" v-model="oldPwd" @on-blur="oldPwdVaild"/>
</label>
</div>
<div class="password-item">
<label for>
新密码:
<Input type="password" v-model="newPwd" @on-blur="newPwdVaild"/>
</label>
</div>
<div class="password-item">
<label for>
确认密码:
<Input type="password" v-model="confirmPwd" :disabled="!this.newPwd" @on-blur="confirmVaild" />
</label>
</div>
<div class="password-item">
<Button type="primary" long :disabled="!oldPwd || !newPwd || !confirmPwd || disUpdate" @click="updatePwd">确认修改</Button>
</div>
</div>
</template>
<script lang = 'ts'>
import { Component, Vue, Prop, Model, Watch } from "vue-property-decorator";
import { Subject } from "rxjs";
import { AppModal } from "@/utils";
import EntityService from '@/service/entity-service';
@Component({})
export default class AppUpdatePassword extends Vue {
/**
* 原密码
*
* @public
* @memberof AppUpdatePassword
*/
public oldPwd: string = "";
/**
* 新密码
*
* @public
* @memberof AppUpdatePassword
*/
public newPwd: string = "";
/**
* 确认密码
*
* @public
* @memberof AppUpdatePassword
*/
public confirmPwd: string = "";
/**
* 是否能禁用确认修改
*
* @public
* @memberof AppUpdatePassword
*/
public disUpdate:boolean = true;
/**
* 校验输入的原密码是否为空
*
* @public
* @memberof AppUpdatePassword
*/
public oldPwdVaild(){
if(!this.oldPwd){
this.$Notice.error({
title:'原密码不能为空!',
duration: 3
});
}
}
/**
* 校验输入的新密码是否为空
*
* @public
* @memberof AppUpdatePassword
*/
public newPwdVaild(){
if(!this.newPwd){
this.$Notice.error({
title:'新密码不能为空!',
duration: 3
});
}
}
/**
* 校验确认密码与新密码是否一致
*
* @public
* @memberof AppUpdatePassword
*/
public confirmVaild() {
if (this.newPwd && this.confirmPwd) {
if (this.confirmPwd !== this.newPwd) {
this.$Notice.error({
title:'两次输入密码不一致!',
duration: 3
});
}else{
this.disUpdate=false;
}
}
}
/**
* 实体服务对象
*
* @protected
* @type {EntityService}
* @memberof AppUpdatePassword
*/
protected entityService: EntityService = new EntityService();
/**
* 修改密码
*
* @public
* @memberof AppUpdatePassword
*/
public updatePwd(){
const post: Promise<any> = this.entityService.changPassword(null,{oldPwd:this.oldPwd,newPwd:this.newPwd});
post.then((response:any) =>{
if (response && response.status === 200) {
this.$emit("close");
}
}).catch((error: any) =>{
this.$Notice.error({
title:'系统异常',
duration: 3
});
console.error(error);
})
}
}
</script>
<style lang="less">
@import './app-update-password.less';
</style>
\ No newline at end of file
<template> <template>
<div class='app-header-user'> <div class='app-header-user'>
<dropdown @on-click="userSelect" :transfer="true"> <dropdown transfer-class-name="user-dropdownMenu" @on-click="userSelect" :transfer="true">
<div class='user'> <div class='user'>
<span>{{user.name ? user.name : $t('components.appUser.name')}}</span> <span>{{user.name ? user.name : $t('components.appUser.name')}}</span>
&nbsp;&nbsp;<avatar :src="user.avatar" /> &nbsp;&nbsp;<avatar :src="user.avatar" />
</div> </div>
<dropdown-menu class='menu' slot='list' style='font-size: 15px !important;'> <dropdown-menu class='menu' slot='list' style='font-size: 15px !important;'>
<dropdown-item name='logout' style='font-size: 15px !important;'> <dropdown-item name='updatepwd' style='font-size: 15px !important;'>
<span><i aria-hidden='true' class='fa fa-cogs' style='margin-right: 8px;'></i></span> <span><i aria-hidden='true' class='fa fa-cogs' style='margin-right: 8px;'></i></span>
<span>修改密码</span>
</dropdown-item>
<dropdown-item name='logout' style='font-size: 15px !important;'>
<span><i aria-hidden='true' class='ivu-icon ivu-icon-md-power' style='margin-right: 8px;'></i></span>
<span>{{$t('components.appUser.logout')}}</span> <span>{{$t('components.appUser.logout')}}</span>
</dropdown-item> </dropdown-item>
</dropdown-menu> </dropdown-menu>
...@@ -16,7 +20,7 @@ ...@@ -16,7 +20,7 @@
</template> </template>
<script lang = 'ts'> <script lang = 'ts'>
import { Vue, Component } from 'vue-property-decorator'; import { Vue, Component } from 'vue-property-decorator';
import { Subject } from 'rxjs';
@Component({ @Component({
}) })
export default class AppUser extends Vue { export default class AppUser extends Vue {
...@@ -46,6 +50,13 @@ export default class AppUser extends Vue { ...@@ -46,6 +50,13 @@ export default class AppUser extends Vue {
this.logout(); this.logout();
} }
}); });
}else if (Object.is(data, 'updatepwd')) {
let container: Subject<any> = this.$appmodal.openModal({ viewname: 'app-update-password', title: "修改密码", width: 500, height: 500, }, {}, {});
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
});
} }
} }
......
...@@ -930,5 +930,15 @@ export default class EntityService { ...@@ -930,5 +930,15 @@ export default class EntityService {
public async updateChooseApp(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async updateChooseApp(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().put(`uaa/access-center/app-switcher/default`,data,isloading); return Http.getInstance().put(`uaa/access-center/app-switcher/default`,data,isloading);
} }
/**
* 修改密码
*
* @param context
* @param data
* @param isloading
*/
public async changPassword(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().post(`v7/changepwd`,data,isloading);
}
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册