From 0031baca87a3ca01d19c32e016892fb7e3fee096 Mon Sep 17 00:00:00 2001
From: 1178634255 <1178634255@qq.com>
Date: Fri, 7 Jul 2023 16:41:10 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/auth/authAdmin.js | 8 +-
src/layout/components/Navbar.vue | 135 ++++++++++++++++++++++++++++++-
2 files changed, 139 insertions(+), 4 deletions(-)
diff --git a/src/api/auth/authAdmin.js b/src/api/auth/authAdmin.js
index 3ee6018..fd655c8 100644
--- a/src/api/auth/authAdmin.js
+++ b/src/api/auth/authAdmin.js
@@ -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
+ });
+}
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 3c0dc14..2706ffd 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -35,7 +35,9 @@
布局设置
-
+
+ 修改密码
+
退出登录
@@ -97,7 +99,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 修改密码
+ 取消
+
+
+
@@ -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()