密码修改

master
1178634255 2 years ago
parent 562879cfd9
commit 0031baca87

@ -57,4 +57,10 @@ export function updateInv(data) {
data: data
});
}
export function modifyPasswd(data) {
return axios({
url: "/admin/auth/admin/updateUser",
method: "post",
data: data
});
}

@ -35,7 +35,9 @@
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="modifyPassword">
<span>修改密码</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
@ -97,7 +99,76 @@
</div>
</el-form>
</el-dialog>
<el-dialog
title="修改密码"
:visible.sync="isVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="35%"
v-if="isVisible"
>
<el-form :model="inputQuery" label-width="100px" :rules="rules" ref="inputQuery">
<el-row :gutter="20">
<el-col :span="20">
<el-form-item prop="userName" label="用户账号:">
<el-input
size="small"
placeholder="请输入登录用户账号"
v-model="inputQuery.userName"
@input="change()"
:disabled="true"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="20">
<el-form-item prop="locInvCode" label="当前密码:">
<el-input
size="small"
placeholder="请输入当前密码"
type="password"
v-model="inputQuery.passWord"
@input="change()"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="20">
<el-form-item prop="locInvCode" label="新密码:">
<el-input
size="small"
placeholder="请输入新密码"
type="password"
v-model="inputQuery.newPassword"
@input="change()"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="20">
<el-form-item prop="locInvCode" label="确认密码:">
<el-input
size="small"
placeholder="请输入确认密码"
type="password"
v-model="inputQuery.confirmPassword"
@input="change()"
></el-input>
</el-form-item>
</el-col>
</el-row>
<div style='text-align: center; margin-bottom: 10px;margin-top: 18px ;'>
<el-button type="primary" @click="onSubmit('inputQuery')"></el-button>
<el-button type="primary" @click="closeDialog"></el-button>
</div>
</el-form>
</el-dialog>
</div>
</template>
@ -114,16 +185,34 @@ import RuoYiDoc from '@/components/RuoYi/Doc'
import store from "@/store";
import {filterAllByUser} from "@/api/system/invWarehouse";
import {filterSubByInv, findByDeptUser} from "@/api/system/invSubWarehouse";
import {updateInv} from "@/api/auth/authAdmin";
import {updateInv,modifyPasswd} from "@/api/auth/authAdmin";
import {isRelogin} from "@/utils/request";
import router from "@/router";
export default {
data() {
let validatePass2 = (rule, value, callback) => {
if (value === "") {
callback(new Error("请再次输入密码"));
} else if (value !== this.inputQuery.passWord) {
callback(new Error("两次输入密码不一致!"));
} else {
callback();
}
};
return {
inputQuery: {
passWord: "",
newPassword: "",
confirmPassword: "",
userName: "",
locInvCode: "",
},
inv: store.getters.locInvName,
deptName: store.getters.locDeptName,
selInvVisible: false,
isVisible: false,
userInfo: {},
deptList: [],
invList: [],
@ -136,6 +225,14 @@ export default {
],
},
rules: {
password: [{required: true, message: "请输入密码", trigger: "blur"}],
confirmPassword: [
{required: true, message: "请确认密码", trigger: "blur"},
{validator: validatePass2, trigger: "blur"},
],
},
};
},
components: {
@ -172,9 +269,38 @@ export default {
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.loading = true;
modifyPasswd(this.inputQuery).then((response) => {
if (response.code === 20000) {
this.loading = false;
this.$confirm('密码重置成功,请点击确定重新登录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = process.env.VUE_APP_CONTEXT_PATH;
})
}).catch(() => {
});
} else {
this.$message.error(response.message);
}
});
} else {
return false;
}
});
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
modifyPassword() {
this.isVisible = true;
},
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
@ -257,6 +383,7 @@ export default {
closeDialog() {
this.selInvVisible = false;
this.isVisible = false;
this.getDeptList()
this.resetForm();
},
@ -279,7 +406,9 @@ export default {
locInvCode: store.getters.locInvCode,
locDeptCode: store.getters.locDeptCode,
};
this.inputQuery = {
userName: this.$store.getters.name,
};
this.getDeptList();
//this.getInvList()

Loading…
Cancel
Save