Commit 1947b1a7 authored by “yiyousong”'s avatar “yiyousong”

perf:修改修改密码

parent 3829dbb5
......@@ -62,7 +62,7 @@ Vue.prototype.$bus = new Vue();
import "swiper/css/swiper.min.css";
Vue.config.productionTip = false;
// 图片预
// 图片预
import Viewer from "v-viewer";
import "viewerjs/dist/viewer.css";
Vue.use(Viewer);
......
......@@ -5,26 +5,74 @@
:destroyOnClose="true"
:visible="visibleEditPwd"
@cancel="handleClose"
width="480px"
width="600px"
>
<a-form-model
:model="form"
:rules="rules"
ref="formData"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 19 }"
:label-col="{ span: 4 }"
:wrapper-col="{ span: 20 }"
>
<a-form-model-item label="原密码" prop="oldPwd">
<a-input-password v-model="form.oldPwd" placeholder="请输入原密码" />
<a-input
:type="oldPwd"
v-model="form.oldPwd"
placeholder="请输入原密码"
>
<template slot="suffix">
<i
v-if="oldPwd == 'password'"
class="iconfont icon-hidden cursor-pointer"
@click="oldPwd = 'text'"
></i>
<i
v-else
class="iconfont icon-show cursor-pointer"
@click="oldPwd = 'password'"
></i>
</template>
</a-input>
</a-form-model-item>
<a-form-model-item label="新密码" prop="newPwd">
<a-input-password v-model="form.newPwd" placeholder="请输入新密码" />
<a-input
:type="newPwd"
v-model="form.newPwd"
placeholder="请输入新密码"
>
<template slot="suffix">
<i
v-if="newPwd == 'password'"
class="iconfont icon-hidden cursor-pointer"
@click="newPwd = 'text'"
></i>
<i
v-else
class="iconfont icon-show cursor-pointer"
@click="newPwd = 'password'"
></i>
</template>
</a-input>
</a-form-model-item>
<a-form-model-item label="确认新密码" prop="newPwdAgain">
<a-input-password
<a-input
:type="newPwdAgain"
v-model="form.newPwdAgain"
placeholder="请再次输入新密码"
/>
>
<template slot="suffix">
<i
v-if="newPwdAgain == 'password'"
class="iconfont icon-hidden cursor-pointer"
@click="newPwdAgain = 'text'"
></i>
<i
v-else
class="iconfont icon-show cursor-pointer"
@click="newPwdAgain = 'password'"
></i>
</template>
</a-input>
</a-form-model-item>
</a-form-model>
......@@ -41,7 +89,7 @@
import { changePassWord } from "@/utils/js/validate";
import { changePassword, LogoutInterface } from "@/api/user";
import { mapMutations } from "vuex";
// import { encrypt } from "@/utils";
import { encrypt } from "@/utils";
import storage from "@/utils/js/Storage";
export default {
props: {
......@@ -61,6 +109,9 @@ export default {
}
};
return {
oldPwd: "password",
newPwd: "password",
newPwdAgain: "password",
form: {
loginName: "",
oldPwd: "",
......@@ -99,16 +150,16 @@ export default {
let _this = this;
this.$refs.formData.validate(async (valid) => {
if (valid) {
// let obj = {
// loginName: encrypt(this.form.loginName),
// oldPwd: encrypt(this.form.oldPwd),
// newPwd: encrypt(this.form.newPwd),
// };
let obj = {
loginName: this.form.loginName,
oldPwd: this.form.oldPwd,
newPwd: this.form.newPwd,
loginName: encrypt(this.form.loginName),
oldPwd: encrypt(this.form.oldPwd),
newPwd: encrypt(this.form.newPwd),
};
// let obj = {
// loginName: this.form.loginName,
// oldPwd: this.form.oldPwd,
// newPwd: this.form.newPwd,
// };
let res = await changePassword(obj);
let { code } = res;
if (code === 1) {
......@@ -128,6 +179,9 @@ export default {
});
},
handleClose() {
this.oldPwd = "password";
this.newPwd = "password";
this.newPwdAgain = "password";
this.$refs.formData.resetFields();
this.Visible = false;
},
......
......@@ -47,7 +47,7 @@
<script>
import { changeAccount, changePassWord } from "@/utils/js/validate";
import { editPassword } from "@/api/user";
// import { encrypt } from "@/utils";
import { encrypt } from "@/utils";
export default {
props: {
visibleEditPwd: {
......@@ -101,14 +101,14 @@ export default {
handleOk() {
this.$refs.formData.validate(async (valid) => {
if (valid) {
// let obj = {
// loginName: encrypt(this.form.loginName),
// newPwd: encrypt(this.form.newPwd),
// };
let obj = {
loginName: this.form.loginName,
newPwd: this.form.newPwd,
loginName: encrypt(this.form.loginName),
newPwd: encrypt(this.form.newPwd),
};
// let obj = {
// loginName: this.form.loginName,
// newPwd: this.form.newPwd,
// };
let res = await editPassword(obj);
if (res.code === 1) {
this.$message.success("密码修改成功");
......
......@@ -69,7 +69,7 @@ import { getListByParentId } from "@/api/area.js";
import { userSave } from "@/api/userManagement.js";
import { TreeSelect } from "ant-design-vue";
const SHOW_PARENT = TreeSelect.SHOW_PARENT; //SHOW_ALL, SHOW_PARENT, SHOW_CHILD
// import { encrypt } from "@/utils";
import { encrypt } from "@/utils";
export default {
data() {
return {
......@@ -181,7 +181,7 @@ export default {
...this.form,
areaNames: JSON.stringify(this.form.areaNames),
areaCodes: this.form.areaNames.map((v) => v.areaCode).join(","),
// loginName: encrypt(this.form.loginName),
loginName: encrypt(this.form.loginName),
});
let { code, msg } = res;
if (code === 1) {
......
......@@ -93,7 +93,7 @@ import { changeAccount, changePassWord } from "@/utils/js/validate";
import { getListByParentId } from "@/api/area.js";
import { userSave } from "@/api/userManagement.js";
import { TreeSelect } from "ant-design-vue";
// import { encrypt } from "@/utils";
import { encrypt } from "@/utils";
const SHOW_PARENT = TreeSelect.SHOW_PARENT; //SHOW_ALL, SHOW_PARENT, SHOW_CHILD
export default {
data() {
......@@ -192,8 +192,8 @@ export default {
...this.form,
areaCodes: this.form.areaCodes.join(","),
areaNames: JSON.stringify(this.changeSelect),
// loginName: encrypt(this.form.loginName),
// loginPwd: encrypt(this.form.loginPwd),
loginName: encrypt(this.form.loginName),
loginPwd: encrypt(this.form.loginPwd),
});
let { code, msg } = res;
if (code === 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment