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
bd776721
Commit
bd776721
authored
Apr 17, 2023
by
littleforest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add role
parent
b59a755e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
66 deletions
+57
-66
index.tsx
src/components/EditAndAddPromptModal/index.tsx
+35
-37
index.tsx
src/components/deletePromptModal/index.tsx
+9
-19
index.less
src/pages/Chat/index.less
+1
-0
index.tsx
src/pages/Chat/index.tsx
+4
-6
index.tsx
src/pages/UserManage/index.tsx
+8
-4
No files found.
src/components/EditAndAddPromptModal/index.tsx
View file @
bd776721
import
{
Form
,
Modal
,
Select
}
from
"antd"
;
import
TextArea
from
"antd/lib/input/TextArea"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
Form
,
Modal
,
Select
}
from
'antd'
;
import
TextArea
from
'antd/lib/input/TextArea'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
styles
from
'./index.less'
;
import
{
IFormValue
}
from
"@/pages/PromptWord"
;
import
type
{
IFormValue
}
from
'@/pages/PromptWord'
;
interface
IEditPromptModalProps
{
open
:
boolean
;
...
...
@@ -16,34 +16,35 @@ interface IEditPromptModalProps {
}
const
EditPromptModal
=
(
props
:
IEditPromptModalProps
)
=>
{
const
{
open
,
setOpen
,
types
,
modalType
,
handleEditPrompt
,
loading
,
oldRow
,
handleCreatePrompt
}
=
props
;
const
{
open
,
setOpen
,
types
,
modalType
,
handleEditPrompt
,
loading
,
oldRow
,
handleCreatePrompt
}
=
props
;
const
[
currentSelectValue
,
setCurrentSelectValue
]
=
useState
<
string
|
null
>
(
"请选择"
);
const
[
currentSelectValue
,
setCurrentSelectValue
]
=
useState
<
string
|
null
>
(
'请选择'
);
const
[
textAreaValue
,
setTextAreaValue
]
=
useState
(
''
);
useEffect
(()
=>
{
if
(
modalType
===
'create'
)
{
if
(
modalType
===
'create'
)
{
setTextAreaValue
(
''
);
setCurrentSelectValue
(
''
);
}
else
{
setTextAreaValue
(
oldRow
.
content
);
setCurrentSelectValue
(
oldRow
.
type
||
'请选择'
);
}
},
[
open
])
},
[
open
])
;
const
handleSavePrompt
=
async
()
=>
{
if
(
modalType
===
'create'
)
{
if
(
modalType
===
'create'
)
{
await
handleCreatePrompt
({
type
:
currentSelectValue
,
content
:
textAreaValue
,
});
}
}
if
(
modalType
===
'edit'
)
{
if
(
modalType
===
'edit'
)
{
await
handleEditPrompt
({
type
:
currentSelectValue
,
content
:
textAreaValue
,
})
})
;
}
setOpen
(
false
);
...
...
@@ -60,39 +61,36 @@ const EditPromptModal = (props: IEditPromptModalProps) => {
confirmLoading=
{
loading
}
wrapClassName=
{
styles
.
modal
}
title=
{
modalType
===
'create'
?
'新增提示用语'
:
'编辑提示用语'
}
okText=
'保存'
onOk=
{
handleSavePrompt
}
okText=
"保存"
onOk=
{
handleSavePrompt
}
onCancel=
{
()
=>
{
setCurrentSelectValue
(
'请选择'
);
setOpen
(
false
);
}
}
}
}
width=
{
574
}
bodyStyle=
{
{
padding
:
'20px'
padding
:
'20px'
,
}
}
>
<
Form
labelAlign=
"right"
{
...
layout
}
>
<
Form
.
Item
label=
"类型:"
>
<
Form
labelAlign=
"right"
{
...
layout
}
>
<
Form
.
Item
label=
"类型:"
>
<
Select
onChange=
{
(
value
:
string
)
=>
{
setCurrentSelectValue
(
value
);
}
}
value=
{
currentSelectValue
}
>
{
types
.
map
(
item
=>
<
Select
.
Option
value=
{
item
}
key=
{
item
}
>
{
item
}
</
Select
.
Option
>)
}
onChange=
{
(
value
:
string
)
=>
{
setCurrentSelectValue
(
value
);
}
}
value=
{
currentSelectValue
}
>
{
types
.
map
((
item
)
=>
(
<
Select
.
Option
value=
{
item
}
key=
{
item
}
>
{
item
}
</
Select
.
Option
>
))
}
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
"提示词语"
>
<
TextArea
<
Form
.
Item
label=
"提示词语"
>
<
TextArea
style=
{
{
height
:
'200px'
height
:
'200px'
,
}
}
value=
{
textAreaValue
}
onChange=
{
(
e
)
=>
{
...
...
@@ -102,7 +100,7 @@ const EditPromptModal = (props: IEditPromptModalProps) => {
</
Form
.
Item
>
</
Form
>
</
Modal
>
)
}
)
;
}
;
export
default
EditPromptModal
;
\ No newline at end of file
export
default
EditPromptModal
;
src/components/deletePromptModal/index.tsx
View file @
bd776721
import
{
Modal
}
from
"antd"
;
import
{
Modal
}
from
'antd'
;
import
styles
from
'./index.less'
;
import
{
Exclamtion
}
from
"../Icons/Icons"
;
import
{
Exclamtion
}
from
'../Icons/Icons'
;
interface
IDeletePromptModalProps
{
title
:
string
;
open
:
boolean
;
...
...
@@ -12,25 +12,17 @@ interface IDeletePromptModalProps {
}
const
DeletePromptModal
=
(
props
:
IDeletePromptModalProps
)
=>
{
const
{
title
,
open
,
setOpen
,
tip
,
content
,
loading
,
handleDeletePrompt
,
}
=
props
;
const
{
title
,
open
,
setOpen
,
tip
,
content
,
loading
,
handleDeletePrompt
}
=
props
;
const
handleSavePrompt
=
async
()
=>
{
await
handleDeletePrompt
();
setOpen
(
false
);
}
}
;
return
(
<
Modal
title=
{
title
}
okText=
'确认'
okText=
"确认"
open=
{
open
}
onOk=
{
handleSavePrompt
}
onCancel=
{
()
=>
{
...
...
@@ -41,11 +33,9 @@ const DeletePromptModal = (props: IDeletePromptModalProps) => {
<
div
className=
{
styles
.
deleteTitle
}
>
<
Exclamtion
/>
{
tip
}
</
div
>
<
div
className=
{
styles
.
deleteContent
}
>
{
content
}
</
div
>
<
div
className=
{
styles
.
deleteContent
}
>
{
content
}
</
div
>
</
Modal
>
)
}
)
;
}
;
export
default
DeletePromptModal
;
\ No newline at end of file
export
default
DeletePromptModal
;
src/pages/Chat/index.less
View file @
bd776721
...
...
@@ -81,6 +81,7 @@
color: #ffffff;
font-size: 18px;
line-height: 25px;
cursor: pointer;
}
.footer {
...
...
src/pages/Chat/index.tsx
View file @
bd776721
...
...
@@ -162,13 +162,11 @@ const Chat: React.FC = () => {
span=
{
24
}
className=
{
styles
.
chatFooterItem
}
hidden=
{
!
access
.
roles
?.
find
((
x
)
=>
[
'管理员'
,
'admin'
].
includes
(
x
))
}
onClick=
{
()
=>
{
history
.
push
(
'/'
);
}
}
>
<
Space
wrap
onClick=
{
()
=>
{
history
.
push
(
'/'
);
}
}
>
<
Space
wrap
>
<
SettingOutlined
/>
后台管理
</
Space
>
...
...
src/pages/UserManage/index.tsx
View file @
bd776721
...
...
@@ -13,7 +13,7 @@ import { ProTable } from '@ant-design/pro-components';
import
{
Button
,
Col
,
Divider
,
Form
,
Input
,
Modal
,
Radio
,
Row
,
Switch
,
message
}
from
'antd'
;
import
classNames
from
'classnames'
;
import
{
isEmpty
}
from
'lodash'
;
import
{
useRef
,
useState
}
from
'react'
;
import
{
useRef
,
useState
,
useEffect
}
from
'react'
;
import
styles
from
'./index.less'
;
import
{
Exclamtion
}
from
'@/components/Icons/Icons'
;
...
...
@@ -51,13 +51,18 @@ const UserManage = () => {
const
[
accountForm
]
=
Form
.
useForm
();
const
[
resetPasswordForm
]
=
Form
.
useForm
();
const
showModal
=
()
=>
{
useEffect
(
()
=>
{
getRole
().
then
((
res
)
=>
{
if
(
!
isEmpty
(
res
))
{
setRoles
(
res
);
setIsModalAccountOpen
(
true
);
}
});
},
[]);
const
showModal
=
()
=>
{
if
(
!
isEmpty
(
roles
))
{
setIsModalAccountOpen
(
true
);
}
};
const
columns
:
any
[]
=
[
...
...
@@ -438,7 +443,6 @@ const UserManage = () => {
rowKey=
"id"
pagination=
{
{
pageSize
:
9
,
onChange
:
(
page
)
=>
{},
}
}
options=
{
false
}
dateFormatter=
"string"
...
...
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