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
2b1e4e52
Commit
2b1e4e52
authored
Dec 16, 2025
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 用户分析传参
parent
3895ddce
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
src/pages/ChatTactics/TacticsChat.tsx
+0
-0
src/pages/ChatTactics/TacticsHome.tsx
+42
-2
No files found.
src/pages/ChatTactics/TacticsChat.tsx
View file @
2b1e4e52
This diff is collapsed.
Click to expand it.
src/pages/ChatTactics/TacticsHome.tsx
View file @
2b1e4e52
...
...
@@ -60,6 +60,37 @@ export const TacticsHome: React.FC = () => {
},
[])
const
tacticsMeta
=
useMemo
(()
=>
tacticsMetaFromSearch
||
tacticsMetaFromStorage
,
[
tacticsMetaFromSearch
,
tacticsMetaFromStorage
])
// 读取 place=user 时的 userMeta 参数
const
userMetaFromSearch
=
useMemo
(()
=>
{
const
place
=
searchParams
.
get
(
'place'
)
if
(
place
!==
'user'
)
{
return
undefined
}
return
{
place
,
cstId
:
searchParams
.
get
(
'cstId'
)
||
undefined
,
userId
:
searchParams
.
get
(
'userId'
)
||
undefined
,
numberType
:
searchParams
.
get
(
'numberType'
)
||
undefined
,
}
},
[
searchParams
])
const
userMetaFromStorage
=
useMemo
(()
=>
{
const
raw
=
sessionStorage
.
getItem
(
'userMeta'
)
if
(
!
raw
)
{
return
undefined
}
try
{
const
parsed
=
JSON
.
parse
(
raw
)
if
(
parsed
?.
place
===
'user'
)
{
return
parsed
}
}
catch
{
// ignore
}
return
undefined
},
[])
const
userMeta
=
useMemo
(()
=>
userMetaFromSearch
||
userMetaFromStorage
,
[
userMetaFromSearch
,
userMetaFromStorage
])
// 同步到 sessionStorage,便于跳转后读取;仅在有 meta 时写入,避免覆盖重定向缓存
useEffect
(()
=>
{
if
(
tacticsMeta
)
{
...
...
@@ -67,6 +98,13 @@ export const TacticsHome: React.FC = () => {
}
},
[
tacticsMeta
])
// 同步 userMeta 到 sessionStorage
useEffect
(()
=>
{
if
(
userMeta
)
{
sessionStorage
.
setItem
(
'userMeta'
,
JSON
.
stringify
(
userMeta
))
}
},
[
userMeta
])
const
initTacticsConversation
=
()
=>
{
const
fromCollect
=
location
.
state
?.
fromCollect
// 只有在访问问答首页时才创建新对话
...
...
@@ -93,6 +131,7 @@ export const TacticsHome: React.FC = () => {
state
:
{
shouldSendQuestion
:
question
,
tacticsMeta
,
userMeta
,
},
})
return
...
...
@@ -105,7 +144,7 @@ export const TacticsHome: React.FC = () => {
shouldSendQuestion
:
question
,
}),
)
},
[
dispatch
,
currentConversationId
,
navigate
,
tacticsMeta
])
},
[
dispatch
,
currentConversationId
,
navigate
,
tacticsMeta
,
userMeta
])
// 监听导航到新对话
useEffect
(()
=>
{
...
...
@@ -115,12 +154,13 @@ export const TacticsHome: React.FC = () => {
state
:
{
shouldSendQuestion
,
tacticsMeta
,
userMeta
,
},
replace
:
true
,
})
dispatch
(
clearTacticsNavigationFlag
())
}
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
shouldSendQuestion
,
navigate
,
dispatch
,
tacticsMeta
])
},
[
shouldNavigateToNewConversation
,
currentConversationId
,
shouldSendQuestion
,
navigate
,
dispatch
,
tacticsMeta
,
userMeta
])
const
login
=
useCallback
(
async
()
=>
{
if
(
hasFetched
.
current
)
{
...
...
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