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
cf37e68e
Commit
cf37e68e
authored
Dec 03, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:常见问题初始化
parent
ec975429
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
src/pages/Home/HomeNew.tsx
+5
-4
No files found.
src/pages/Home/HomeNew.tsx
View file @
cf37e68e
...
...
@@ -77,7 +77,7 @@ export const Home: React.FC = () => {
}
// 处理工具按钮点击
const
_handleToolClick
=
useCallback
(
async
(
isToolBtn
:
boolean
,
toolId
?:
string
)
=>
{
const
_handleToolClick
=
useCallback
(
async
(
isToolBtn
:
boolean
,
toolId
?:
string
,
ignoreUrlToolId
?:
boolean
)
=>
{
// 提质增效模式 / 数据助手 / 通用模式:都先清空数据,重新拉常见问题
setOtherQuestions
((
prev
:
any
)
=>
({
...
prev
,
...
...
@@ -87,7 +87,8 @@ export const Home: React.FC = () => {
try
{
const
storedToolId
=
sessionStorage
.
getItem
(
'currentToolId'
)
||
''
const
searchParams
=
new
URLSearchParams
(
location
.
search
)
const
urlToolId
=
searchParams
.
get
(
'toolId'
)
||
''
// 首页初始化加载常见问题时,允许忽略路由中的 toolId,避免带入上一次的工具 ID
const
urlToolId
=
ignoreUrlToolId
?
''
:
(
searchParams
.
get
(
'toolId'
)
||
''
)
const
shouldForceClearToolId
=
!
storedToolId
&&
!
urlToolId
let
finalToolId
=
toolId
||
''
...
...
@@ -223,10 +224,10 @@ export const Home: React.FC = () => {
}
},
[
setToken
,
dispatch
])
// 修改 useEffect
useEffect
(()
=>
{
login
()
_handleToolClick
(
false
,
''
)
// 首页首次挂载时强制忽略路由中的 toolId,只按通用模式拉常见问题
_handleToolClick
(
false
,
''
,
true
)
},
[])
// 依赖数组为空,只在组件挂载时执行一次
return
(
...
...
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