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
3da94271
Commit
3da94271
authored
Aug 11, 2025
by
weiw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:按消金的需求整改布局
parent
732073e6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
131 additions
and
14 deletions
+131
-14
src/config/nav.ts
+2
-3
src/layouts/MainLayout/MainLayout.tsx
+1
-1
src/layouts/Navbar/Navbar.tsx
+5
-6
src/pages/Chat/components/ChatItem/ChatAnswerAttchment.tsx
+1
-1
src/pages/Home/HomeNew.tsx
+117
-0
src/pages/Home/index.ts
+2
-1
src/routes/AppRoutes.tsx
+3
-2
No files found.
src/config/nav.ts
View file @
3da94271
import
Tools
from
'@/assets/svg/tools.svg?react'
import
AddNewChat
from
'@/assets/svg/addNewChat.svg?react'
import
HistoryChat
from
'@/assets/svg/historyChat.svg?react'
import
Collect
from
'@/assets/svg/collect.svg?react'
...
...
@@ -10,6 +9,6 @@ export const NAV_BAR_ITEMS = [
{
icon
:
HistoryChat
,
label
:
'历史对话'
,
key
:
'history'
},
{
icon
:
Collect
,
label
:
'收藏'
,
key
:
'collect'
},
{
icon
:
''
,
label
:
''
,
key
:
'line2'
},
{
icon
:
Tools
,
label
:
'工具'
,
key
:
'tools'
},
{
icon
:
''
,
label
:
''
,
key
:
'line3'
},
//
{ icon: Tools, label: '工具', key: 'tools' },
//
{ icon: '', label: '', key: 'line3' },
]
src/layouts/MainLayout/MainLayout.tsx
View file @
3da94271
...
...
@@ -70,7 +70,7 @@ export const MainLayout: React.FC<MainLayoutProps> = ({ children }) => {
<
motion
.
div
animate=
{
navBarVisibleLocal
===
'0'
?
isHistoryVisible
?
'shrunk'
:
'expanded'
:
'navTween'
}
variants=
{
contentVariants
}
className=
{
`fixed right-[-12px] top-[10px] z-[49] h-auto sm:relative flex sm:h-full
pl-[12px]
items-center ${isHistoryVisible && !isMobile() ? 'w-[340px]' : 'w-[90px]'} box-border`
}
className=
{
`fixed right-[-12px] top-[10px] z-[49] h-auto sm:relative flex sm:h-full items-center ${isHistoryVisible && !isMobile() ? 'w-[340px]' : 'w-[90px]'} box-border`
}
>
<
Navbar
...
...
src/layouts/Navbar/Navbar.tsx
View file @
3da94271
...
...
@@ -5,7 +5,6 @@ import { useNavigate } from 'react-router-dom'
import
{
useClickAway
,
useSessionStorageState
}
from
'ahooks'
import
styles
from
'./Navbar.module.less'
import
{
NavBarItem
}
from
'./components/NavBarItem'
import
{
User
}
from
'./components/User'
import
{
clearNavigationFlag
,
createConversation
}
from
'@/store/conversationSlice'
import
type
{
WithAuthProps
}
from
'@/auth/withAuth'
import
{
withAuth
}
from
'@/auth/withAuth'
...
...
@@ -67,10 +66,10 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
navigate
(
'/tools'
)
}
}
const
handleLogout
=
()
=>
{
onSetHistoryVisible
(
false
)
navigate
(
'/'
)
}
//
const handleLogout = () => {
//
onSetHistoryVisible(false)
//
navigate('/')
//
}
const
[
navBarVisibleLocal
,
setNavBarVisibleLocal
]
=
useSessionStorageState
<
string
|
undefined
>
(
'__NAV_BAR_VISIBLE_LOCAL__'
,
...
...
@@ -112,7 +111,7 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
<
NavBarItem
isHistoryVisible=
{
isHistoryVisible
}
onClick=
{
handleClick
}
icon=
{
item
.
icon
}
label=
{
item
.
label
}
key=
{
item
.
key
}
type=
{
item
.
key
}
/>
)
})
}
<
User
onLogout=
{
handleLogout
}
/>
{
/* <User onLogout={handleLogout} /> */
}
</
motion
.
div
>
<
div
onClick=
{
toggleNavBarVisible
}
className=
{
`${styles.sidebarAction} ${navBarVisibleLocal === '0' ? styles.open : ''}`
}
></
div
>
</
motion
.
nav
>
...
...
src/pages/Chat/components/ChatItem/ChatAnswerAttchment.tsx
View file @
3da94271
...
...
@@ -56,7 +56,7 @@ export const ChatAnswerAttachment: React.FC<ChatAnswerAttachmentProps> = ({ from
</
div
>
)
}
{
/* 附件:引用文件 */
}
{
attachment
.
type
===
'reference'
&&
attachment
.
content
.
docList
.
length
!==
0
&&
(
{
attachment
.
type
===
'reference'
&&
attachment
.
content
?.
docList
&&
attachment
.
content
.
docList
.
length
!==
0
&&
(
<
div
>
<
p
className=
"text-[14px] text-[#8D9795] mb-[12px]"
>
已为您找到
...
...
src/pages/Home/HomeNew.tsx
0 → 100644
View file @
3da94271
import
type
React
from
'react'
import
{
motion
}
from
'framer-motion'
import
{
Outlet
,
useLocation
}
from
'react-router-dom'
import
styles
from
'./Home.module.less'
import
{
QuestionList
}
from
'./components/QuestionList'
import
{
Slogan
}
from
'./components/Slogan/Slogan'
import
HomeIcon1
from
'@/assets/homeIcon1.png'
import
HomeIcon2
from
'@/assets/homeIcon2.png'
import
{
GradientBackground
}
from
'@/components/GradientBackground'
import
{
ChatEditor
}
from
'@/components/ChatEditor'
import
{
RECOMMEND_QUESTIONS_OTHER
,
RECOMMEND_QUESTIONS_PRODUCT
}
from
'@/config/recommendQuestion'
import
{
createConversation
}
from
'@/store/conversationSlice'
import
{
useAppDispatch
}
from
'@/store/hook'
function
getAnimationProps
(
delay
:
number
)
{
return
{
variants
:
{
hidden
:
{
opacity
:
0
,
y
:
50
,
scale
:
0.9
,
rotateX
:
-
6
,
},
visible
:
{
opacity
:
1
,
y
:
0
,
scale
:
1
,
rotateX
:
0
,
transition
:
{
duration
:
0.4
,
delay
:
delay
*
0.1
,
ease
:
[
0.25
,
0.1
,
0.25
,
1
],
},
},
},
initial
:
'hidden'
,
animate
:
'visible'
,
}
}
export
const
Home
:
React
.
FC
=
()
=>
{
const
dispatch
=
useAppDispatch
()
const
location
=
useLocation
()
// 检查当前路径是否包含 "/chat/"
const
showOutlet
=
location
.
pathname
.
includes
(
'/chat/'
)
const
handleCreateConversation
=
(
question
:
string
)
=>
{
dispatch
(
createConversation
({
conversationData
:
{},
shouldNavigate
:
true
,
shouldSendQuestion
:
question
,
}),
)
}
return
(
<
div
className=
{
styles
.
homePage
}
>
<
GradientBackground
/>
<
div
className=
"h-full w-full"
>
<
div
className=
"box flex flex-col h-full w-full"
>
<
div
className=
"flex-1 items-center pt-[24px] overflow-y-scroll sm:pt-[32px] scrollbar-hide sm:overflow-hidden"
>
<
div
className=
"w-full"
>
<
div
className=
"flex justify-center gap-[20px] mt-[22px] sm:mt-[62px]"
>
{
/* 左侧区域 - 产品问答和您可以试着问我 */
}
<
div
className=
"flex flex-col gap-[20px]"
>
<
motion
.
div
className=
"w-full hidden sm:block sm:w-auto"
{
...
getAnimationProps
(2)}
>
<
QuestionList
questions=
{
RECOMMEND_QUESTIONS_PRODUCT
}
dotColor=
"#D4CCFF"
title=
"产品问答"
iconImg=
{
HomeIcon1
}
/>
</
motion
.
div
>
<
motion
.
div
className=
"w-full sm:w-auto"
{
...
getAnimationProps
(3)}
>
<
QuestionList
questions=
{
RECOMMEND_QUESTIONS_OTHER
}
dotColor=
"#CBECFF"
title=
"您可以试着问我"
iconImg=
{
HomeIcon2
}
/>
</
motion
.
div
>
</
div
>
{
/* 右侧区域 */
}
<
div
className=
"hidden sm:flex flex-1 h-full sm:mt-[-62px]"
>
<
div
className=
"w-full h-full bg-transparent box-border rounded-[24px]"
style=
{
{
height
:
'calc(100vh - 64px)'
}
}
>
{
showOutlet
?
(
<
Outlet
/>
)
:
(
<
div
style=
{
{
display
:
'flex'
,
flexDirection
:
'column'
,
justifyContent
:
'space-between'
,
height
:
'100%'
}
}
>
<
Slogan
/>
<
div
className=
"box-border px-[0] mx-auto iptContainer w-full max-w-[912px] flex-shrink-0 sm:px-0 pb-[18px]"
>
<
ChatEditor
showContentTips
onSubmit=
{
handleCreateConversation
}
placeholders=
{
RECOMMEND_QUESTIONS_OTHER
}
/>
<
div
className=
"hidden sm:block w-full text-center mt-[12px] text-[#3333334d] text-[12px]"
>
内容由AI模型生成,其准确性和完整性无法保证,仅供参考
</
div
>
</
div
>
</
div
>
)
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
)
}
src/pages/Home/index.ts
View file @
3da94271
export
{
Home
}
from
'./Home'
// export { Home } from './Home'
export
{
Home
}
from
'./HomeNew'
src/routes/AppRoutes.tsx
View file @
3da94271
...
...
@@ -10,8 +10,9 @@ import { withRouteChangeHandler } from './RouteChangeHandler'
const
AppRoutesComponent
:
React
.
FC
=
()
=>
{
return
(
<
Routes
>
<
Route
path=
"/"
element=
{
<
Home
/>
}
/>
<
Route
path=
"/chat/:id"
element=
{
<
Chat
/>
}
/>
<
Route
path=
"/"
element=
{
<
Home
/>
}
>
<
Route
path=
"/chat/:id"
element=
{
<
Chat
/>
}
/>
</
Route
>
<
Route
path=
"/collect"
element=
{
<
Collect
/>
}
/>
<
Route
path=
"/tools"
element=
{
<
Tools
/>
}
/>
<
Route
path=
"/protocol/:id"
element=
{
<
Protocol
/>
}
/>
...
...
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