Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a23955a0
authored
Sep 19, 2025
by
JoeyLearnsToCode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: jump between section on channel edit page
parent
d77aa81f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
2 deletions
+96
-2
web/src/components/table/channels/modals/EditChannelModal.jsx
+96
-2
No files found.
web/src/components/table/channels/modals/EditChannelModal.jsx
View file @
a23955a0
...
...
@@ -66,6 +66,8 @@ import {
IconCode
,
IconGlobe
,
IconBolt
,
IconChevronUp
,
IconChevronDown
,
}
from
'@douyinfe/semi-icons'
;
const
{
Text
,
Title
}
=
Typography
;
...
...
@@ -184,6 +186,18 @@ const EditChannelModal = (props) => {
const
[
verifyCode
,
setVerifyCode
]
=
useState
(
''
);
const
[
verifyLoading
,
setVerifyLoading
]
=
useState
(
false
);
// 表单块导航相关状态
const
formSectionRefs
=
useRef
({
basicInfo
:
null
,
apiConfig
:
null
,
modelConfig
:
null
,
advancedSettings
:
null
,
channelExtraSettings
:
null
,
});
const
[
currentSectionIndex
,
setCurrentSectionIndex
]
=
useState
(
0
);
const
formSections
=
[
'basicInfo'
,
'apiConfig'
,
'modelConfig'
,
'advancedSettings'
,
'channelExtraSettings'
];
const
formContainerRef
=
useRef
(
null
);
// 2FA状态更新辅助函数
const
updateTwoFAState
=
(
updates
)
=>
{
setTwoFAState
((
prev
)
=>
({
...
prev
,
...
updates
}));
...
...
@@ -207,6 +221,37 @@ const EditChannelModal = (props) => {
setVerifyLoading
(
false
);
};
// 表单导航功能
const
scrollToSection
=
(
sectionKey
)
=>
{
const
sectionElement
=
formSectionRefs
.
current
[
sectionKey
];
if
(
sectionElement
)
{
sectionElement
.
scrollIntoView
({
behavior
:
'smooth'
,
block
:
'start'
,
inline
:
'nearest'
});
}
};
const
navigateToSection
=
(
direction
)
=>
{
const
availableSections
=
formSections
.
filter
(
section
=>
{
if
(
section
===
'apiConfig'
)
{
return
showApiConfigCard
;
}
return
true
;
});
let
newIndex
;
if
(
direction
===
'up'
)
{
newIndex
=
currentSectionIndex
>
0
?
currentSectionIndex
-
1
:
availableSections
.
length
-
1
;
}
else
{
newIndex
=
currentSectionIndex
<
availableSections
.
length
-
1
?
currentSectionIndex
+
1
:
0
;
}
setCurrentSectionIndex
(
newIndex
);
scrollToSection
(
availableSections
[
newIndex
]);
};
// 渠道额外设置状态
const
[
channelSettings
,
setChannelSettings
]
=
useState
({
force_format
:
false
,
...
...
@@ -672,6 +717,8 @@ const EditChannelModal = (props) => {
fetchModelGroups
();
// 重置手动输入模式状态
setUseManualInput
(
false
);
// 重置导航状态
setCurrentSectionIndex
(
0
);
}
else
{
// 统一的模态框关闭重置逻辑
resetModalState
();
...
...
@@ -1108,7 +1155,41 @@ const EditChannelModal = (props) => {
visible=
{
props
.
visible
}
width=
{
isMobile
?
'100%'
:
600
}
footer=
{
<
div
className=
'flex justify-end bg-white'
>
<
div
className=
'flex justify-between items-center bg-white'
>
<
div
className=
'flex gap-2'
>
<
Button
size=
'small'
type=
'tertiary'
icon=
{
<
IconChevronUp
/>
}
onClick=
{
()
=>
navigateToSection
(
'up'
)
}
style=
{
{
borderRadius
:
'50%'
,
width
:
'32px'
,
height
:
'32px'
,
padding
:
0
,
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'center'
}
}
title=
{
t
(
'上一个表单块'
)
}
/>
<
Button
size=
'small'
type=
'tertiary'
icon=
{
<
IconChevronDown
/>
}
onClick=
{
()
=>
navigateToSection
(
'down'
)
}
style=
{
{
borderRadius
:
'50%'
,
width
:
'32px'
,
height
:
'32px'
,
padding
:
0
,
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'center'
}
}
title=
{
t
(
'下一个表单块'
)
}
/>
</
div
>
<
Space
>
<
Button
theme=
'solid'
...
...
@@ -1139,7 +1220,11 @@ const EditChannelModal = (props) => {
>
{
()
=>
(
<
Spin
spinning=
{
loading
}
>
<
div
className=
'p-2'
>
<
div
className=
'p-2'
ref=
{
formContainerRef
}
>
<
div
ref=
{
el
=>
formSectionRefs
.
current
.
basicInfo
=
el
}
>
<
Card
className=
'!rounded-2xl shadow-sm border-0 mb-6'
>
{
/* Header: Basic Info */
}
<
div
className=
'flex items-center mb-2'
>
...
...
@@ -1597,9 +1682,11 @@ const EditChannelModal = (props) => {
/>
)
}
</
Card
>
</
div
>
{
/* API Configuration Card */
}
{
showApiConfigCard
&&
(
<
div
ref=
{
el
=>
formSectionRefs
.
current
.
apiConfig
=
el
}
>
<
Card
className=
'!rounded-2xl shadow-sm border-0 mb-6'
>
{
/* Header: API Config */
}
<
div
className=
'flex items-center mb-2'
>
...
...
@@ -1790,9 +1877,11 @@ const EditChannelModal = (props) => {
</
div
>
)
}
</
Card
>
</
div
>
)
}
{
/* Model Configuration Card */
}
<
div
ref=
{
el
=>
formSectionRefs
.
current
.
modelConfig
=
el
}
>
<
Card
className=
'!rounded-2xl shadow-sm border-0 mb-6'
>
{
/* Header: Model Config */
}
<
div
className=
'flex items-center mb-2'
>
...
...
@@ -1989,8 +2078,10 @@ const EditChannelModal = (props) => {
extraText=
{
t
(
'键为请求中的模型名称,值为要替换的模型名称'
)
}
/>
</
Card
>
</
div
>
{
/* Advanced Settings Card */
}
<
div
ref=
{
el
=>
formSectionRefs
.
current
.
advancedSettings
=
el
}
>
<
Card
className=
'!rounded-2xl shadow-sm border-0 mb-6'
>
{
/* Header: Advanced Settings */
}
<
div
className=
'flex items-center mb-2'
>
...
...
@@ -2207,8 +2298,10 @@ const EditChannelModal = (props) => {
)
}
/>
</
Card
>
</
div
>
{
/* Channel Extra Settings Card */
}
<
div
ref=
{
el
=>
formSectionRefs
.
current
.
channelExtraSettings
=
el
}
>
<
Card
className=
'!rounded-2xl shadow-sm border-0 mb-6'
>
{
/* Header: Channel Extra Settings */
}
<
div
className=
'flex items-center mb-2'
>
...
...
@@ -2311,6 +2404,7 @@ const EditChannelModal = (props) => {
/>
</
Card
>
</
div
>
</
div
>
</
Spin
>
)
}
</
Form
>
...
...
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