Files
Xinyue-Search/app/qfadmin/view/admin/motifypassword.html
T
2024-09-14 17:00:49 +08:00

94 lines
3.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>{$node.node_title}</title>
{include file="common/header"/}
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span>修改我的密码</span>
</div>
<div class="text item">
<el-form :model="form" status-icon :rules="rules" ref="form" label-width="80px">
<el-form-item label="原密码" prop="oldPassword">
<el-input show-password v-model="form.oldPassword" placeholder="请输入原密码"></el-input>
</el-form-item>
<el-form-item label="新密码" prop="newPassword">
<el-input show-password password="password" v-model="form.newPassword" placeholder="请输入新密码">
</el-input>
</el-form-item>
<el-form-item label="新密码" prop="checkPassword">
<el-input show-password v-model="form.checkPassword" placeholder="请确认新密码"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">修改密码</el-button>
</el-form-item>
</el-form>
</div>
</el-card>
{include file="common/footer"/}
<script>
var app = new Vue({
el: '#app',
data() {
return {
form: {
oldPassword: "",
newPassword: "",
checkPassword: "",
},
rules: {
oldPassword: [
{ required: true, message: '原密码必须输入', trigger: 'blur' },
],
newPassword: [
{ required: true, message: '必须输入', trigger: 'blur' },
],
checkPassword: [
{ required: true, message: '必须输入', trigger: 'blur' },
],
}
}
},
methods: {
onSubmit() {
var that = this;
that.$refs['form'].validate((valid) => {
if (!valid) {
that.$message.error('仔细检查检查,是不是有个地方写得不对?');
return;
}
if (that.form.newPassword != that.form.checkPassword) {
that.$message.error('两次密码输入不一致,请确认');
return;
}
axios.post('/admin/admin/motifypassword', Object.assign({}, PostBase, {
oldPassword: that.form.oldPassword,
newPassword: that.form.newPassword,
}))
.then(function (response) {
if (response.data.code == CODE_SUCCESS) {
that.$message({
message: response.data.message,
type: 'success'
});
setTimeout(function () {
location.href = "/qfadmin/admin/login";
}, 2000);
} else {
that.$message.error(response.data.message);
}
})
.catch(function (error) {
that.$message.error('服务器内部错误');
console.log(error);
});
});
},
}
});
</script>
</html>