<template>
	<div class="modifyPassword">
		<el-input class="modifyPassword" placeholder="请输入旧密码" v-model="oldPassword" auto-complete="off"></el-input>
		<el-input class="modifyPassword" placeholder="请输入新密码" v-model="newPassword" auto-complete="off" type="password"></el-input>
		<el-input class="modifyPassword" placeholder="请验证新密码" v-model="confirmNewPassword" auto-complete="off" type="password"></el-input>
		<div class="modifyPassword-btn">
			<el-button style="width: 100%" type="primary" @click="editPawSubmit">保存</el-button>
		</div>
	</div>
</template>
<script>
	import axios from '@/axios';
	export default {
		data() {
			return {
				oldPassword: '',
				newPassword: '',
				confirmNewPassword: '',
			}
		},
		methods: {
			editPawSubmit(row) {
				var url = 'SysUser/updatePassword.do'
				var param = {
					oldPassword: this.oldPassword,
					newPassword: this.newPassword,
				}
				axios.post(url, param).then(response => {
					if (response.data.code === 0) {
						this.$message({
							type: 'success',
							message: '修改成功!',
						});
					} else {
						this.$message({
							type: 'error',
							message: '修改失败' + response.data.msg
						});
					}
				});
			}
		},

	}
</script>
<style>
	.modifyPassword {
		width: 300px;
	}

	.modifyPassword-btn {
		margin: 10px;

	}
</style>
