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
341e1b72
authored
Nov 30, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完善标签编辑
parent
96e3eece
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
6 deletions
+36
-6
controller/channel.go
+1
-1
web/src/components/ChannelsTable.js
+22
-3
web/src/pages/Channel/EditTagModal.js
+13
-2
No files found.
controller/channel.go
View file @
341e1b72
...
...
@@ -311,7 +311,7 @@ type ChannelTag struct {
NewTag
*
string
`json:"new_tag"`
Priority
*
int64
`json:"priority"`
Weight
*
uint
`json:"weight"`
ModelMapping
*
string
`json:"m
ap
_mapping"`
ModelMapping
*
string
`json:"m
odel
_mapping"`
Models
*
string
`json:"models"`
Groups
*
string
`json:"groups"`
}
...
...
web/src/components/ChannelsTable.js
View file @
341e1b72
...
...
@@ -31,7 +31,7 @@ import {
Typography
}
from
'@douyinfe/semi-ui'
;
import
EditChannel
from
'../pages/Channel/EditChannel'
;
import
{
IconTreeTriangleDown
}
from
'@douyinfe/semi-icons'
;
import
{
Icon
List
,
Icon
TreeTriangleDown
}
from
'@douyinfe/semi-icons'
;
import
{
loadChannelModels
}
from
'./utils.js'
;
import
EditTagModal
from
'../pages/Channel/EditTagModal.js'
;
...
...
@@ -56,6 +56,20 @@ function renderType(type) {
);
}
function
renderTagType
(
type
)
{
return
(
<
Tag
color
=
'light-blue'
prefixIcon
=
{
<
IconList
/>
}
size
=
'large'
shape
=
'circle'
type
=
'light'
>
标签聚合
<
/Tag
>
);
}
const
ChannelsTable
=
()
=>
{
const
columns
=
[
// {
...
...
@@ -90,7 +104,11 @@ const ChannelsTable = () => {
title
:
'类型'
,
dataIndex
:
'type'
,
render
:
(
text
,
record
,
index
)
=>
{
return
<
div
>
{
renderType
(
text
)}
<
/div>
;
if
(
record
.
children
===
undefined
)
{
return
<>
{
renderType
(
text
)}
<
/>
;
}
else
{
return
<>
{
renderTagType
(
0
)}
<
/>
;
}
}
},
{
...
...
@@ -441,7 +459,8 @@ const ChannelsTable = () => {
let
channelGroupsStr
=
channels
[
i
].
group
;
channelGroupsStr
.
split
(
','
).
forEach
((
item
,
index
)
=>
{
if
(
tagChannelDates
.
group
.
indexOf
(
item
)
===
-
1
)
{
tagChannelDates
.
group
+=
item
+
','
;
// join
tagChannelDates
.
group
+=
','
+
item
;
}
});
}
...
...
web/src/pages/Channel/EditTagModal.js
View file @
341e1b72
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
API
,
showError
,
show
Success
}
from
'../../helpers'
;
import
{
API
,
showError
,
show
Info
,
showSuccess
,
showWarning
,
verifyJSON
}
from
'../../helpers'
;
import
{
SideSheet
,
Space
,
Button
,
Input
,
Typography
,
Spin
,
Modal
,
Select
,
Banner
,
TextArea
}
from
'@douyinfe/semi-ui'
;
import
TextInput
from
'../../components/TextInput.js'
;
import
{
getChannelModels
}
from
'../../components/utils.js'
;
...
...
@@ -122,7 +122,12 @@ const EditTagModal = (props) => {
let
data
=
{
tag
:
tag
,
}
if
(
inputs
.
model_mapping
!==
null
)
{
if
(
inputs
.
model_mapping
!==
null
&&
inputs
.
model_mapping
!==
''
)
{
if
(
inputs
.
model_mapping
!==
''
&&
!
verifyJSON
(
inputs
.
model_mapping
))
{
showInfo
(
'模型映射必须是合法的 JSON 格式!'
);
setLoading
(
false
);
return
;
}
data
.
model_mapping
=
inputs
.
model_mapping
}
if
(
inputs
.
groups
.
length
>
0
)
{
...
...
@@ -132,6 +137,12 @@ const EditTagModal = (props) => {
data
.
models
=
inputs
.
models
.
join
(
','
);
}
data
.
newTag
=
inputs
.
newTag
;
// check have any change
if
(
data
.
model_mapping
===
undefined
&&
data
.
groups
===
undefined
&&
data
.
models
===
undefined
&&
data
.
newTag
===
undefined
)
{
showWarning
(
'没有任何修改!'
);
setLoading
(
false
);
return
;
}
await
submit
(
data
);
setLoading
(
false
);
};
...
...
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