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
407bb3c3
Commit
407bb3c3
authored
Dec 11, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:清理toolId
parent
af79aca0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
src/pages/Home/HomeNew.tsx
+9
-0
No files found.
src/pages/Home/HomeNew.tsx
View file @
407bb3c3
...
@@ -202,8 +202,14 @@ export const Home: React.FC = () => {
...
@@ -202,8 +202,14 @@ export const Home: React.FC = () => {
let
res
=
{}
as
any
let
res
=
{}
as
any
if
(
viteOutputObj
===
'inner'
)
{
if
(
viteOutputObj
===
'inner'
)
{
if
(
_loginCode
)
{
if
(
_loginCode
)
{
// 每次进入页面调用 sso_login 时,先清空 sessionStorage 中的 currentToolId
// 避免关闭标签页后再次打开时使用上次的历史 toolId
safeSessionStorageRemoveItem
(
'currentToolId'
)
res
=
await
fetchLoginByToken
(
_loginCode
)
res
=
await
fetchLoginByToken
(
_loginCode
)
if
(
res
.
data
)
{
if
(
res
.
data
)
{
// 登录成功后先打印完整的原始链接(删除之前)
// eslint-disable-next-line no-console
console
.
log
(
'登录成功,删除前完整链接:'
,
window
.
location
.
href
)
// 登录成功后先清理旧状态,避免沿用上一次的工具模式
// 登录成功后先清理旧状态,避免沿用上一次的工具模式
dispatch
(
clearCurrentToolId
())
dispatch
(
clearCurrentToolId
())
safeSessionStorageRemoveItem
(
'currentToolId'
)
safeSessionStorageRemoveItem
(
'currentToolId'
)
...
@@ -213,6 +219,9 @@ export const Home: React.FC = () => {
...
@@ -213,6 +219,9 @@ export const Home: React.FC = () => {
// 使用 replace 避免产生新的历史记录
// 使用 replace 避免产生新的历史记录
window
.
history
.
replaceState
({},
''
,
currentUrl
.
toString
())
window
.
history
.
replaceState
({},
''
,
currentUrl
.
toString
())
}
}
// 删除后打印链接
// eslint-disable-next-line no-console
console
.
log
(
'登录成功,删除后完整链接:'
,
window
.
location
.
href
)
setToken
(
res
.
data
.
token
)
setToken
(
res
.
data
.
token
)
// 主动触发 storage 事件,确保其他组件能监听到变化
// 主动触发 storage 事件,确保其他组件能监听到变化
window
.
dispatchEvent
(
window
.
dispatchEvent
(
...
...
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