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

perf:修改修改密码

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