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

修改密码

上级 e9952926
......@@ -76,6 +76,7 @@ import ContextMenuDrag from './components/context-menu-drag/context-menu-drag.vu
import AppOrgSelect from './components/app-org-select/app-org-select.vue'
import AppDepartmentSelect from './components/app-department-select/app-department-select.vue'
import AppGroupSelect from './components/app-group-select/app-group-select.vue'
import UpdatePwd from './components/app-update-password/app-update-password.vue'
// 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister;
// 全局挂载功能服务注册中心
......@@ -163,5 +164,6 @@ export const AppComponents = {
v.component('app-breadcrumb',Breadcrumb);
v.component('app-transfer',AppTransfer);
v.component('context-menu-drag',ContextMenuDrag);
v.component('app-update-password',UpdatePwd);
},
};
\ No newline at end of file
.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 put: Promise<any> = this.entityService.changPassword(null,{oldPwd:this.oldPwd,newPwd:this.newPwd});
put.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
......@@ -6,6 +6,10 @@
&nbsp;&nbsp;<avatar :src="user.avatar" />
</div>
<dropdown-menu class='menu' slot='list' 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>修改密码</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>
......@@ -16,7 +20,7 @@
</template>
<script lang = 'ts'>
import { Vue, Component } from 'vue-property-decorator';
import { Subject } from 'rxjs';
@Component({
})
export default class AppUser extends Vue {
......@@ -46,6 +50,13 @@ export default class AppUser extends Vue {
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;
}
});
}
}
......
......@@ -931,4 +931,15 @@ export default class EntityService {
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().put(`v7/changepwd`,data,isloading);
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册