diff --git a/src/api/auth/authAdmin.js b/src/api/auth/authAdmin.js
index 1523a56e..c25af705 100644
--- a/src/api/auth/authAdmin.js
+++ b/src/api/auth/authAdmin.js
@@ -67,4 +67,10 @@ export function selectUser(query) {
});
}
-
+export function modifyPasswd(data) {
+ return axios({
+ url: "/salewarehouse/r",
+ method: "post",
+ data: data
+ });
+}
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 4df395bc..0d4da56b 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -40,6 +40,9 @@
切换仓库
+
+ 修改密码
+
退出登录
@@ -102,6 +105,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 修改密码
+ 取消
+
+
+
+
@@ -118,17 +193,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 {
inv: store.getters.locInvName,
deptName: store.getters.locDeptName,
selInvVisible: false,
+ isVisible: false,
userInfo: {},
+ inputQuery: {
+ password: "",
+ confirmPassword: "",
+ userName: "",
+ locInvCode:"",
+
+ },
deptList: [],
invList: [],
formRules: {
@@ -140,6 +232,14 @@ export default {
],
},
+ rules: {
+ password: [{required: true, message: "请输入密码", trigger: "blur"}],
+ confirmPassword: [
+ {required: true, message: "请确认密码", trigger: "blur"},
+ {validator: validatePass2, trigger: "blur"},
+ ],
+
+ },
};
},
components: {
@@ -176,6 +276,33 @@ 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')
},
@@ -186,7 +313,7 @@ export default {
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
- location.href = process.env.VUE_APP_CONTEXT_PATH ;
+ location.href = process.env.VUE_APP_CONTEXT_PATH;
})
}).catch(() => {
});
@@ -195,6 +322,9 @@ export default {
changeInv() {
this.selInvVisible = true;
},
+ modifyPassword() {
+ this.isVisible = true;
+ },
getDeptList() {
this.deptList = [];
@@ -209,7 +339,7 @@ export default {
deptChange() {
this.getInvList();
- this.userInfo.locInvCode="";
+ this.userInfo.locInvCode = "";
},
getInvList() {
@@ -225,7 +355,7 @@ export default {
}
})
.catch(() => {
- this.selInvVisible=true;
+ this.selInvVisible = true;
});
},
@@ -261,6 +391,8 @@ export default {
closeDialog() {
this.selInvVisible = false;
+ this.isVisible = false;
+
this.getDeptList()
this.resetForm();
},
@@ -278,11 +410,16 @@ export default {
},
created() {
this.userName = this.$store.getters.name;
- this.userInfo = {
- id: store.getters.adminId,
- locInvCode: store.getters.locInvCode,
- locDeptCode: store.getters.locDeptCode,
- };
+ this.userInfo = {
+ id: store.getters.adminId,
+ locInvCode: store.getters.locInvCode,
+ locDeptCode: store.getters.locDeptCode,
+ };
+ this.inputQuery={
+ userName:this.$store.getters.name,
+
+ locInvCode: store.getters.locInvCode,
+ };
this.getDeptList();
//this.getInvList()