feat(sidebar+groups): available-channels above channel-status; show rate for subscription groups

- Sidebar user-side order: /available-channels now sits directly above
  /monitor (渠道状态) for regular users, mirroring the admin section where
  it sits above /admin/channels.
- GroupBadge gains an alwaysShowRate prop. Subscription groups default to
  a "订阅"/days-remaining label; the new flag swaps that for the rate
  multiplier while keeping the subscription theme color, so the Available
  Channels page can surface rates on every group type.
This commit is contained in:
erio
2026-04-21 22:10:51 +08:00
parent ff4ef1b574
commit 9dae6c7aee
3 changed files with 24 additions and 5 deletions

View File

@@ -37,13 +37,20 @@ interface Props {
userRateMultiplier?: number | null // 用户专属倍率
showRate?: boolean
daysRemaining?: number | null // 剩余天数(订阅类型时使用)
/**
* 订阅分组默认在右侧 label 展示"订阅"或剩余天数;
* 开启后订阅分组也改为显示倍率(保留订阅主题色 label配合可用渠道这类
* 只关心费率、不关心有效期的场景)。
*/
alwaysShowRate?: boolean
}
const props = withDefaults(defineProps<Props>(), {
subscriptionType: 'standard',
showRate: true,
daysRemaining: null,
userRateMultiplier: null
userRateMultiplier: null,
alwaysShowRate: false
})
const { t } = useI18n()
@@ -71,7 +78,8 @@ const showLabel = computed(() => {
// Label text
const labelText = computed(() => {
if (isSubscription.value) {
const rateLabel = props.rateMultiplier !== undefined ? `${props.rateMultiplier}x` : ''
if (isSubscription.value && !props.alwaysShowRate) {
// 如果有剩余天数,显示天数
if (props.daysRemaining !== null && props.daysRemaining !== undefined) {
if (props.daysRemaining <= 0) {
@@ -82,7 +90,7 @@ const labelText = computed(() => {
// 否则显示"订阅"
return t('groups.subscription')
}
return props.rateMultiplier !== undefined ? `${props.rateMultiplier}x` : ''
return rateLabel
})
// Label style based on type and days remaining