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