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
8a2d3591
Commit
8a2d3591
authored
Dec 09, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:原有页面:新增接口地址&&切换页面路由内参数保留&&右上角操作
parent
0af1d7a8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
9 deletions
+43
-9
src/api/home.ts
+9
-0
src/layouts/Navbar/Navbar.tsx
+25
-6
src/pages/Home/HomeNew.tsx
+9
-3
No files found.
src/api/home.ts
View file @
8a2d3591
...
@@ -30,3 +30,12 @@ export function fetchToolList(params?: { userRoles?: string[] }) {
...
@@ -30,3 +30,12 @@ export function fetchToolList(params?: { userRoles?: string[] }) {
export
function
fetchEfficiencyQuestionList
(
data
:
any
)
{
export
function
fetchEfficiencyQuestionList
(
data
:
any
)
{
return
http
.
post
(
'/conversation/api/conversation/mobile/v1/generate_question'
,
data
)
return
http
.
post
(
'/conversation/api/conversation/mobile/v1/generate_question'
,
data
)
}
}
/**
* 清空记录 接口
* @params
* conversationIdList: 会话id (只传一个)
*/
export
function
deleteUserConversation
(
data
:
any
)
{
return
http
.
post
(
'/api/conversation/mobile/v1/delete_user_conversation'
,
data
)
}
src/layouts/Navbar/Navbar.tsx
View file @
8a2d3591
import
type
React
from
'react'
import
type
React
from
'react'
import
{
motion
}
from
'framer-motion'
import
{
motion
}
from
'framer-motion'
import
{
useEffect
,
useRef
,
useState
}
from
'react'
import
{
useEffect
,
useRef
,
useState
}
from
'react'
import
{
useNavigate
}
from
'react-router-dom'
import
{
use
Location
,
use
Navigate
}
from
'react-router-dom'
import
{
useClickAway
,
useSessionStorageState
}
from
'ahooks'
import
{
useClickAway
,
useSessionStorageState
}
from
'ahooks'
import
styles
from
'./Navbar.module.less'
import
styles
from
'./Navbar.module.less'
import
{
NavBarItem
}
from
'./components/NavBarItem'
import
{
NavBarItem
}
from
'./components/NavBarItem'
...
@@ -21,6 +21,7 @@ interface NavbarProps {
...
@@ -21,6 +21,7 @@ interface NavbarProps {
const
NavbarBase
:
React
.
FC
<
NavbarProps
&
WithAuthProps
>
=
({
isHistoryVisible
,
checkAuth
,
onSetHistoryVisible
})
=>
{
const
NavbarBase
:
React
.
FC
<
NavbarProps
&
WithAuthProps
>
=
({
isHistoryVisible
,
checkAuth
,
onSetHistoryVisible
})
=>
{
const
dispatch
=
useAppDispatch
()
const
dispatch
=
useAppDispatch
()
const
navigate
=
useNavigate
()
const
navigate
=
useNavigate
()
const
location
=
useLocation
()
const
{
currentConversationId
,
shouldNavigateToNewConversation
,
currentToolId
}
=
useAppSelector
(
state
=>
state
.
conversation
)
const
{
currentConversationId
,
shouldNavigateToNewConversation
,
currentToolId
}
=
useAppSelector
(
state
=>
state
.
conversation
)
...
@@ -103,11 +104,29 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
...
@@ -103,11 +104,29 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
shouldNavigateToNewConversation
&&
currentConversationId
)
{
if
(
shouldNavigateToNewConversation
&&
currentConversationId
)
{
// 如果当前有选中的 toolId,在 URL 中拼接,以便刷新页面后保留工具选择
// 获取当前 URL 的查询参数,保留除 'from' 之外的所有参数
const
url
=
currentToolId
const
currentSearchParams
=
new
URLSearchParams
(
location
.
search
)
?
`/chat/
${
currentConversationId
}
?toolId=
${
currentToolId
}
`
const
paramsToKeep
=
new
URLSearchParams
()
// 遍历当前查询参数,过滤掉 'from' 参数
currentSearchParams
.
forEach
((
value
,
key
)
=>
{
if
(
key
!==
'from'
)
{
paramsToKeep
.
set
(
key
,
value
)
}
})
// 如果当前有选中的 toolId,添加到查询参数中
if
(
currentToolId
)
{
paramsToKeep
.
set
(
'toolId'
,
currentToolId
)
}
// 构建跳转 URL
const
queryString
=
paramsToKeep
.
toString
()
const
url
=
queryString
?
`/chat/
${
currentConversationId
}
?
${
queryString
}
`
:
`/chat/
${
currentConversationId
}
`
:
`/chat/
${
currentConversationId
}
`
// 通过 location.state 传递 toolId,避免在 Chat 页面被误判为“外链残留参数”而强制清空
// 通过 location.state 传递 toolId,避免在 Chat 页面被误判为"外链残留参数"而强制清空
navigate
(
url
,
{
navigate
(
url
,
{
state
:
{
state
:
{
toolId
:
currentToolId
||
null
,
toolId
:
currentToolId
||
null
,
...
@@ -115,7 +134,7 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
...
@@ -115,7 +134,7 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
})
})
dispatch
(
clearNavigationFlag
())
dispatch
(
clearNavigationFlag
())
}
}
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
currentToolId
,
navigate
,
dispatch
])
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
currentToolId
,
navigate
,
dispatch
,
location
.
search
])
// keep latest conversation id in sessionStorage for cross-page returns (e.g., from collect)
// keep latest conversation id in sessionStorage for cross-page returns (e.g., from collect)
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
src/pages/Home/HomeNew.tsx
View file @
8a2d3591
...
@@ -266,12 +266,18 @@ export const Home: React.FC = () => {
...
@@ -266,12 +266,18 @@ export const Home: React.FC = () => {
<
div
className=
"box flex flex-col h-full w-full"
>
<
div
className=
"box flex flex-col h-full w-full"
>
<
div
className=
"flex-1 items-center pt-[24px] sm:pt-[32px] scrollbar-hide"
>
<
div
className=
"flex-1 items-center pt-[24px] sm:pt-[32px] scrollbar-hide"
>
{
isFromTactics
&&
(
{
isFromTactics
&&
(
<
div
className=
"flex items-center justify-end gap-[20px] text-[14px] leading-[22px] text-[#2F88FF]"
>
<
div
className=
"flex items-center justify-end gap-[20px] text-[14px] leading-[22px] text-[#2F88FF] mb-[14px] mr-[20px]"
>
<
div
className=
"flex items-center gap-[6px] cursor-pointer"
>
<
div
className=
"flex items-center gap-[6px] cursor-pointer"
onClick=
{
()
=>
window
.
dispatchEvent
(
new
CustomEvent
(
'tacticsClearHistory'
))
}
>
<
img
src=
{
DeleteIcon
}
alt=
"清除记录"
className=
"w-[14px] h-[14px]"
/>
<
img
src=
{
DeleteIcon
}
alt=
"清除记录"
className=
"w-[14px] h-[14px]"
/>
<
span
>
清除记录
</
span
>
<
span
>
清除记录
</
span
>
</
div
>
</
div
>
<
div
className=
"flex items-center gap-[6px] cursor-pointer"
>
<
div
className=
"flex items-center gap-[6px] cursor-pointer"
onClick=
{
()
=>
window
.
dispatchEvent
(
new
CustomEvent
(
'tacticsReAnalyze'
))
}
>
<
img
src=
{
RefreshIcon
}
alt=
"重新分析"
className=
"w-[14px] h-[14px]"
/>
<
img
src=
{
RefreshIcon
}
alt=
"重新分析"
className=
"w-[14px] h-[14px]"
/>
<
span
>
重新分析
</
span
>
<
span
>
重新分析
</
span
>
</
div
>
</
div
>
...
...
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