Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
ddd495fb
Commit
ddd495fb
authored
Mar 31, 2026
by
erio
Browse files
feat(ui): 渠道列表状态列改为 Toggle 开关,支持直接启用/禁用
parent
58f20446
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/views/admin/ChannelsView.vue
View file @
ddd495fb
...
...
@@ -57,17 +57,11 @@
<span
class=
"text-sm text-gray-600 dark:text-gray-400"
>
{{
value
||
'
-
'
}}
</span>
</
template
>
<
template
#cell-status=
"{ value }"
>
<span
:class=
"[
'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium',
value === 'active'
? 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400'
: 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400'
]"
>
{{
value
===
'
active
'
?
t
(
'
admin.channels.statusActive
'
,
'
Active
'
)
:
t
(
'
admin.channels.statusDisabled
'
,
'
Disabled
'
)
}}
</span>
<
template
#cell-status=
"{ row }"
>
<Toggle
:modelValue=
"row.status === 'active'"
@
update:modelValue=
"toggleChannelStatus(row)"
/>
</
template
>
<
template
#cell-group_count=
"{ row }"
>
...
...
@@ -434,6 +428,7 @@ import EmptyState from '@/components/common/EmptyState.vue'
import
Select
from
'
@/components/common/Select.vue
'
import
Icon
from
'
@/components/icons/Icon.vue
'
import
PlatformIcon
from
'
@/components/common/PlatformIcon.vue
'
import
Toggle
from
'
@/components/common/Toggle.vue
'
import
PricingEntryCard
from
'
@/components/admin/channel/PricingEntryCard.vue
'
import
{
getPersistedPageSize
}
from
'
@/composables/usePersistedPageSize
'
...
...
@@ -950,6 +945,18 @@ async function handleSubmit() {
}
}
// ── Toggle status ──
async
function
toggleChannelStatus
(
channel
:
Channel
)
{
const
newStatus
=
channel
.
status
===
'
active
'
?
'
disabled
'
:
'
active
'
try
{
await
adminAPI
.
channels
.
update
(
channel
.
id
,
{
status
:
newStatus
})
channel
.
status
=
newStatus
}
catch
(
error
)
{
appStore
.
showError
(
t
(
'
admin.channels.updateError
'
,
'
Failed to update channel
'
))
console
.
error
(
'
Error toggling channel status:
'
,
error
)
}
}
// ── Delete ──
function
handleDelete
(
channel
:
Channel
)
{
deletingChannel
.
value
=
channel
...
...
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