fix(): 修改密码
parent
49efdd8113
commit
c959ea4964
|
|
@ -9,7 +9,7 @@ import {divIcon} from "leaflet";
|
|||
import { httppost2 } from '../../utils/request';
|
||||
import apiurl from '../../service/apiurl';
|
||||
import CryptoJS from 'crypto-js';
|
||||
|
||||
import { createCrudService } from '../../components/crud/_';
|
||||
const { SubMenu } = Menu;
|
||||
|
||||
const HeaderUser: React.FC<{
|
||||
|
|
@ -39,25 +39,35 @@ const HeaderUser: React.FC<{
|
|||
|
||||
|
||||
const onFinish = async (val: any) => {
|
||||
if(val.newSecretKey!==val.secondSecretKey){
|
||||
message.error('确认密码错误')
|
||||
return
|
||||
}
|
||||
const params = {
|
||||
oldSecretKey:encryptData(val.oldSecretKey),
|
||||
newSecretKey:encryptData(val.newSecretKey),
|
||||
secondSecretKey:encryptData(val.secondSecretKey),
|
||||
userId: localStorage.getItem('userId')
|
||||
}
|
||||
const res = await httppost2(apiurl.setPassword,params)
|
||||
if(res.code===200){
|
||||
message.success('修改成功')
|
||||
const path = `${apiurl.systemM.userM.updatePassword}?oldPassword=${val.oldPassword}&newPassword=${val.newPassword}`;
|
||||
createCrudService(path).userEdit().then((result) => {
|
||||
if (result?.code === 200) {
|
||||
message.success('修改成功,即将重新登录')
|
||||
setOpen(false)
|
||||
setTimeout(() => {
|
||||
logout()
|
||||
}, 1500);
|
||||
}else{
|
||||
message.error(res.description)
|
||||
}
|
||||
})
|
||||
// if(val.newSecretKey!==val.secondSecretKey){
|
||||
// message.error('确认密码错误')
|
||||
// return
|
||||
// }
|
||||
// const params = {
|
||||
// oldSecretKey:encryptData(val.oldSecretKey),
|
||||
// newSecretKey:encryptData(val.newSecretKey),
|
||||
// secondSecretKey:encryptData(val.secondSecretKey),
|
||||
// userId: localStorage.getItem('userId')
|
||||
// }
|
||||
// const res = await httppost2(apiurl.setPassword,params)
|
||||
// if(res.code===200){
|
||||
// message.success('修改成功')
|
||||
// setTimeout(() => {
|
||||
// logout()
|
||||
// }, 1500);
|
||||
// }else{
|
||||
// message.error(res.description)
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -90,7 +100,7 @@ const HeaderUser: React.FC<{
|
|||
</div>:null
|
||||
}
|
||||
|
||||
<Modal title="修改密码" open={open} onOk={()=>setOpen(false)} onCancel={()=>setOpen(false)} footer={null}>
|
||||
<Modal destroyOnClose title="修改密码" open={open} onOk={()=>setOpen(false)} onCancel={()=>setOpen(false)} footer={null}>
|
||||
<Form
|
||||
name="basic"
|
||||
labelCol={{span: 5}}
|
||||
|
|
@ -101,23 +111,23 @@ const HeaderUser: React.FC<{
|
|||
>
|
||||
<Form.Item
|
||||
label="原密码"
|
||||
name="oldSecretKey"
|
||||
name="oldPassword"
|
||||
rules={[{required: true}]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="新密码"
|
||||
name="newSecretKey"
|
||||
name="newPassword"
|
||||
rules={[{required: true}]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
{/* <Form.Item
|
||||
label="确认密码"
|
||||
name="secondSecretKey"
|
||||
rules={[{required: true}]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
</Form.Item> */}
|
||||
|
||||
<Form.Item
|
||||
wrapperCol={{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {httppost2, download, httpPostFile, httpget, httpget2,httpget6} from "../../utils/request";
|
||||
import {httppost2, download, httpPostFile, httpget, httpget2,httpget6,xyt_httpput} from "../../utils/request";
|
||||
import apiurl from "../../service/apiurl";
|
||||
import {config} from "../../config";
|
||||
|
||||
|
|
@ -156,6 +156,10 @@ export function createCrudService(urlSet) {
|
|||
const resData = await httppost2(urlSet, params) || {};
|
||||
return resData;
|
||||
}
|
||||
const userEdit = async (params) => {
|
||||
const resData = await xyt_httpput(urlSet, params) || {};
|
||||
return resData;
|
||||
}
|
||||
|
||||
const edit1 = async (params) => {
|
||||
const resData = await httppost2(urlSet, params) || {};
|
||||
|
|
@ -246,6 +250,7 @@ export function createCrudService(urlSet) {
|
|||
todo: todo,
|
||||
save: save,
|
||||
edit: edit,
|
||||
userEdit,
|
||||
edit1: edit1,
|
||||
del: del,
|
||||
insert:insert,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@ const service_fxdd = '/gunshiApp/tsg'
|
|||
const service_xyt = '/gunshiApp/tsg'//登陆先用小玉潭
|
||||
const service_shzh = '/shzh'
|
||||
const apiurl = {
|
||||
|
||||
systemM: {
|
||||
userM: {
|
||||
updatePassword:service_xyt + '/system/user/profile/updatePwd'
|
||||
}
|
||||
},
|
||||
krline: {
|
||||
list: service_fxdd + "/stZvarlB/list",
|
||||
save: service_fxdd + "/stZvarlB/insert",
|
||||
|
|
|
|||
|
|
@ -53,7 +53,19 @@ async function send(url, options) {
|
|||
|
||||
return {};
|
||||
}
|
||||
export function xyt_httpput(url, data = {}) {
|
||||
const options = {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'adcd': localStorage.getItem('ADCD6'),
|
||||
"authorization":"Bearer" + ' ' + localStorage.getItem('access_token')
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
};
|
||||
|
||||
return send(url, options);
|
||||
}
|
||||
export function httpget(url, data = {}) {
|
||||
const params = [];
|
||||
for (const k in data) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue