Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chatGLM
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘坚-丰林-DEV
chatGLM
Commits
77abf4f9
Commit
77abf4f9
authored
Apr 16, 2023
by
littleforest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add reset funciton
parent
c177cecb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
21 deletions
+60
-21
index.tsx
src/pages/UserManage/index.tsx
+59
-20
api.ts
src/services/chatGLM/api.ts
+1
-1
No files found.
src/pages/UserManage/index.tsx
View file @
77abf4f9
...
@@ -4,6 +4,7 @@ import {
...
@@ -4,6 +4,7 @@ import {
getUserMessage
,
getUserMessage
,
postDelete
,
postDelete
,
postDeleteUser
,
postDeleteUser
,
postResetUser
,
}
from
'@/services/chatGLM/api'
;
}
from
'@/services/chatGLM/api'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
type
{
ActionType
}
from
'@ant-design/pro-components'
;
import
type
{
ActionType
}
from
'@ant-design/pro-components'
;
...
@@ -17,6 +18,14 @@ import styles from './index.less';
...
@@ -17,6 +18,14 @@ import styles from './index.less';
import
{
Exclamtion
}
from
'@/components/Icons/Icons'
;
import
{
Exclamtion
}
from
'@/components/Icons/Icons'
;
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
const
layout
=
{
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
18
},
};
const
resetLayout
=
{
labelCol
:
{
span
:
6
},
wrapperCol
:
{
span
:
16
},
};
const
UserManage
=
()
=>
{
const
UserManage
=
()
=>
{
const
actionRef
=
useRef
<
ActionType
>
();
const
actionRef
=
useRef
<
ActionType
>
();
...
@@ -26,16 +35,15 @@ const UserManage = () => {
...
@@ -26,16 +35,15 @@ const UserManage = () => {
name
:
''
,
name
:
''
,
id
:
' '
,
id
:
' '
,
});
});
const
[
isModalResetPassword
,
setisModalResetPassword
]
=
useState
(
false
);
const
[
isModalResetPassword
,
setIsModalResetPassword
]
=
useState
(
false
);
const
[
resetPassword
,
setResetPassword
]
=
useState
({});
const
[
resetPassword
,
setResetPassword
]
=
useState
({
id
:
''
,
});
const
[
roles
,
setRoles
]
=
useState
([]);
const
[
roles
,
setRoles
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
ressetLoading
,
setResetLoading
]
=
useState
(
false
);
const
[
accountModalName
,
setAccountModalName
]
=
useState
(
'新建账号'
);
const
[
accountModalName
,
setAccountModalName
]
=
useState
(
'新建账号'
);
const
[
accountForm
]
=
Form
.
useForm
();
const
[
accountForm
]
=
Form
.
useForm
();
const
layout
=
{
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
18
},
};
const
showModal
=
()
=>
{
const
showModal
=
()
=>
{
getRole
()
getRole
()
...
@@ -117,10 +125,10 @@ const UserManage = () => {
...
@@ -117,10 +125,10 @@ const UserManage = () => {
</
a
>,
</
a
>,
<
a
<
a
onClick=
{
()
=>
{
onClick=
{
()
=>
{
// postDeleteUser
(
{
setResetPassword
({
//
id: record.id,
id
:
record
.
id
,
// Password:
});
//
}
);
setIsModalResetPassword
(
true
);
}
}
}
}
key=
"reset"
key=
"reset"
>
>
...
@@ -211,12 +219,32 @@ const UserManage = () => {
...
@@ -211,12 +219,32 @@ const UserManage = () => {
})
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
setIsModalDeleteAccountOpen
(
false
);
setIsModalDeleteAccountOpen
(
false
);
actionRef
.
current
?.
reload
();
message
.
success
(
'删除成功'
);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
setIsModalDeleteAccountOpen
(
false
);
setIsModalDeleteAccountOpen
(
false
);
});
});
};
};
const
handleClickOpenModalReset
=
(
values
:
any
)
=>
{
setResetLoading
(
true
);
const
data
=
{
id
:
resetPassword
.
id
,
Password
:
values
?.
newPassword
,
};
postResetUser
(
data
)
.
then
((
res
)
=>
{
setResetLoading
(
false
);
setIsModalResetPassword
(
false
);
actionRef
.
current
?.
reload
();
message
.
success
(
'重置成功'
);
})
.
catch
((
err
)
=>
{
setResetLoading
(
false
);
});
};
return
(
return
(
<
PageContainer
>
<
PageContainer
>
<
Modal
<
Modal
...
@@ -224,6 +252,9 @@ const UserManage = () => {
...
@@ -224,6 +252,9 @@ const UserManage = () => {
destroyOnClose=
{
true
}
destroyOnClose=
{
true
}
open=
{
isModalDeleteAccountOpen
}
open=
{
isModalDeleteAccountOpen
}
onOk=
{
handleClickOpenModalDelete
}
onOk=
{
handleClickOpenModalDelete
}
onCancel=
{
()
=>
{
setIsModalDeleteAccountOpen
(
false
);
}
}
>
>
<
div
className=
{
styles
.
deleteTitle
}
>
<
div
className=
{
styles
.
deleteTitle
}
>
<
Exclamtion
/>
确定要删除
{
deleteMessage
.
name
}
的账号吗?
<
Exclamtion
/>
确定要删除
{
deleteMessage
.
name
}
的账号吗?
...
@@ -233,21 +264,20 @@ const UserManage = () => {
...
@@ -233,21 +264,20 @@ const UserManage = () => {
</
div
>
</
div
>
</
Modal
>
</
Modal
>
<
Modal
<
Modal
closable=
{
true
}
title=
"重置密码"
title=
"重置密码"
destroyOnClose=
{
true
}
destroyOnClose=
{
true
}
open=
{
isModalDeleteAccountOpen
}
open=
{
isModalResetPassword
}
onOk=
{
handleClickOpenModalDelete
}
onCancel=
{
()
=>
{
setIsModalResetPassword
(
false
);
}
}
footer=
{
null
}
>
>
<
Form
name=
"resetPassword"
>
<
Form
{
...
resetLayout
}
onFinish=
{
handleClickOpenModalReset
}
name=
"resetPassword"
>
<
Item
<
Item
name=
{
'newPassword'
}
name=
{
'newPassword'
}
label=
{
'新密码'
}
label=
{
'新密码'
}
rules=
{
[
rules=
{
[{
required
:
true
,
message
:
'请输入密码!'
},
{
validator
:
validatePassword
}]
}
{
required
:
true
,
message
:
'请输入你的密码'
,
},
]
}
>
>
<
Input
placeholder=
"请输入6-12位的数字或者字母"
/>
<
Input
placeholder=
"请输入6-12位的数字或者字母"
/>
</
Item
>
</
Item
>
...
@@ -271,6 +301,16 @@ const UserManage = () => {
...
@@ -271,6 +301,16 @@ const UserManage = () => {
>
>
<
Input
placeholder=
"请确认你的新密码"
/>
<
Input
placeholder=
"请确认你的新密码"
/>
</
Item
>
</
Item
>
<
Divider
/>
<
Row
justify=
{
'center'
}
>
<
Col
>
<
Item
key=
{
'saveButton'
}
noStyle=
{
true
}
>
<
Button
key=
"submit"
type=
"primary"
loading=
{
ressetLoading
}
htmlType=
"submit"
>
重置
</
Button
>
</
Item
>
</
Col
>
</
Row
>
</
Form
>
</
Form
>
</
Modal
>
</
Modal
>
<
Modal
<
Modal
...
@@ -378,7 +418,6 @@ const UserManage = () => {
...
@@ -378,7 +418,6 @@ const UserManage = () => {
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setAccountModalName
(
'添加账号'
);
setAccountModalName
(
'添加账号'
);
showModal
();
showModal
();
actionRef
.
current
?.
reload
();
}
}
}
}
type=
"primary"
type=
"primary"
>
>
...
...
src/services/chatGLM/api.ts
View file @
77abf4f9
...
@@ -100,7 +100,7 @@ export const postDeleteUser = (params?: any): Promise<string> => {
...
@@ -100,7 +100,7 @@ export const postDeleteUser = (params?: any): Promise<string> => {
};
};
export
const
postResetUser
=
(
params
?:
any
):
Promise
<
string
>
=>
{
export
const
postResetUser
=
(
params
?:
any
):
Promise
<
string
>
=>
{
return
request
(
'https://glm-mangement-api.baibaomen.com/User/
delete
'
,
{
return
request
(
'https://glm-mangement-api.baibaomen.com/User/
reset
'
,
{
method
:
'POST'
,
method
:
'POST'
,
data
:
params
,
data
:
params
,
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment