Add match status

This commit is contained in:
the1812 2025-04-08 09:16:18 +08:00
parent beb17e1ece
commit 4bde283ef2
2 changed files with 26 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import { VLoading, VButton } from '@/ui'
import { bilibiliApi, getJsonWithCredentials, postTextWithCredentials } from '@/core/ajax' import { bilibiliApi, getJsonWithCredentials, postTextWithCredentials } from '@/core/ajax'
import { CustomNavbarItem } from '../custom-navbar-item' import { CustomNavbarItem } from '../custom-navbar-item'
import { usePopper } from '../mixins' import { usePopper } from '../mixins'
import type { MatchInfo, MatchPreviewItem } from './types' import { type MatchInfo, type MatchPreviewItem, MatchHotItemStatus } from './types'
import { getCsrf } from '@/core/utils' import { getCsrf } from '@/core/utils'
import { logError } from '@/core/utils/log' import { logError } from '@/core/utils/log'
@ -83,6 +83,14 @@ defineExpose({
:title="card.name" :title="card.name"
class="hot-match-card" class="hot-match-card"
> >
<div
class="hot-match-card-status"
:class="{ 'in-progress': card.status === MatchHotItemStatus.InProgress }"
>
<template v-if="card.status === MatchHotItemStatus.NotStarted">未开始</template>
<template v-if="card.status === MatchHotItemStatus.InProgress">进行中</template>
<template v-if="card.status === MatchHotItemStatus.Finished">已结束</template>
</div>
<div class="hot-match-card-title"> <div class="hot-match-card-title">
{{ card.name }} {{ card.name }}
</div> </div>
@ -183,6 +191,16 @@ defineExpose({
.hot-match-card { .hot-match-card {
@include h-center(6px); @include h-center(6px);
padding: 5px 0; padding: 5px 0;
&-status {
font-size: 11px;
background-color: #8882;
padding: 1px 4px;
border-radius: 4px;
&.in-progress {
background-color: var(--theme-color);
color: var(--foreground-color);
}
}
&-title { &-title {
@include single-line(); @include single-line();
transition: color 0.2s ease-out; transition: color 0.2s ease-out;

View File

@ -4,11 +4,17 @@ export interface MatchInfo {
preview: MatchPreviewItem[] preview: MatchPreviewItem[]
} }
export enum MatchHotItemStatus {
NotStarted = 1,
InProgress,
Finished,
}
export interface MatchHotItem { export interface MatchHotItem {
index: number index: number
cid: number cid: number
desc: string desc: string
status: number status: MatchHotItemStatus
name: string name: string
jump_url: string jump_url: string
} }