Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
33e12ad8
Commit
33e12ad8
authored
Nov 13, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:点踩反馈逻辑
parent
3256bd57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
src/components/UnLikeModal/index.tsx
+24
-14
No files found.
src/components/UnLikeModal/index.tsx
View file @
33e12ad8
import
{
Button
,
Modal
,
ModalBody
,
ModalContent
,
ModalFooter
,
ModalHeader
}
from
'@heroui/react'
import
{
Button
,
Modal
,
ModalBody
,
ModalContent
,
ModalFooter
,
ModalHeader
,
Textarea
}
from
'@heroui/react'
import
{
useEffect
,
useState
}
from
'react'
import
{
fetchGetFeedbackConfig
,
fetchSubmitFeedback
}
from
'@/api/chat'
import
type
{
Answer
}
from
'@/types/chat'
...
...
@@ -11,7 +11,7 @@ interface UnLikeModalProps {
export
const
UnLikeModal
:
React
.
FC
<
UnLikeModalProps
>
=
({
isOpen
,
onClose
,
answer
})
=>
{
const
[
feedbackConfig
,
setFeedbackConfig
]
=
useState
<
any
>
()
const
[
answerValue
]
=
useState
(
''
)
const
[
answerValue
,
setAnswerValue
]
=
useState
(
''
)
const
getConfig
=
async
()
=>
{
const
res
=
await
fetchGetFeedbackConfig
()
if
(
res
.
ok
)
{
...
...
@@ -19,22 +19,32 @@ export const UnLikeModal: React.FC<UnLikeModalProps> = ({ isOpen, onClose, answe
}
}
const
handleClick
=
(
item
:
any
,
index
:
number
)
=>
{
const
handleClick
=
(
_item
:
any
,
index
:
number
)
=>
{
if
(
!
feedbackConfig
)
return
const
_data
=
JSON
.
parse
(
JSON
.
stringify
(
feedbackConfig
))
item
.
answerValue
=
item
.
answerValue
===
'1'
?
'0'
:
'1'
_data
.
questionList
[
0
].
answerList
[
index
]
=
item
_data
.
questionList
[
0
].
answerList
=
_data
.
questionList
[
0
].
answerList
.
map
((
item
:
any
,
idx
:
number
)
=>
idx
===
index
?
{
...
item
,
answerValue
:
item
.
answerValue
===
'1'
?
'0'
:
'1'
,
}
:
item
,
)
setFeedbackConfig
(
_data
)
}
const
onSubmit
=
async
()
=>
{
const
content
=
JSON
.
parse
(
JSON
.
stringify
(
feedbackConfig
))
content
.
questionList
[
0
].
answerList
=
content
.
questionList
[
0
].
answerList
.
filter
(
(
item
:
any
)
=>
item
.
answerValue
===
'1'
,
)
content
.
questionList
[
1
].
answerValue
=
answerValue
const
params
=
{
recordId
:
answer
.
recordId
,
feedbackStatus
:
'02'
,
content
:
JSON
.
stringify
(
content
),
}
const
res
=
await
fetchSubmitFeedback
(
params
)
if
(
res
)
{
onClose
(
true
)
...
...
@@ -53,7 +63,7 @@ export const UnLikeModal: React.FC<UnLikeModalProps> = ({ isOpen, onClose, answe
<
ModalContent
>
{
onClose
=>
(
<>
<
ModalHeader
className=
"flex flex-col gap-1"
>
你的反馈将帮助 晓得 优化进步
</
ModalHeader
>
<
ModalHeader
className=
"flex flex-col gap-1"
>
感谢您的反馈!
</
ModalHeader
>
<
ModalBody
className=
"text-[#27353C]"
>
<
div
className=
"flex flex-wrap gap-[6px]"
>
{
feedbackConfig
&&
feedbackConfig
.
questionList
[
0
].
answerList
.
map
((
item
:
any
,
index
:
number
)
=>
(
...
...
@@ -72,13 +82,13 @@ export const UnLikeModal: React.FC<UnLikeModalProps> = ({ isOpen, onClose, answe
</
Button
>
)
))
}
{
/*
<Textarea
value={answerValue}
onValueChange={setAnswerValue}
label="留下更多反馈
"
placeholder=""
className="w-full mt-[10px]"
/> */
}
<
Textarea
value=
{
answerValue
}
onValueChange=
{
setAnswerValue
}
label=
"可在此详细描述您所遇到的问题
"
placeholder=
""
className=
"w-full mt-[10px]"
/>
</
div
>
</
ModalBody
>
<
ModalFooter
>
...
...
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