feat: 更新API模型和组件以支持签到排行开关功能

- 在api-models.ts中将SongRequest更改为LiveRequest,并添加CheckInRanking
- 更新CheckInSettings.vue以支持签到排行的开关
- 在多个视图中调整签到排行的显示逻辑
- 移除不再使用的allowCheckInRanking字段
This commit is contained in:
2025-05-06 02:19:23 +08:00
parent ec619b404d
commit 8f734af8b3
9 changed files with 33 additions and 28 deletions

View File

@@ -148,8 +148,8 @@
<NFormItem label="允许查看签到排行">
<NSwitch
v-model:value="serverSetting.allowCheckInRanking"
@update:value="updateServerSettings"
:value="accountInfo.settings.enableFunctions.includes(FunctionTypes.CheckInRanking)"
@update:value="updateCheckInRanking"
/>
<template #feedback>
启用后用户可以查看签到排行榜
@@ -381,8 +381,8 @@
</template>
<script lang="ts" setup>
import { SaveSetting, useAccount } from '@/api/account';
import { CheckInRankingInfo, CheckInResult } from '@/api/api-models';
import { SaveEnableFunctions, SaveSetting, useAccount } from '@/api/account';
import { CheckInRankingInfo, CheckInResult, FunctionTypes } from '@/api/api-models';
import { QueryGetAPI } from '@/api/query';
import { useAutoAction } from '@/client/store/useAutoAction';
import { CHECKIN_API_URL } from '@/data/constants';
@@ -791,6 +791,10 @@ async function handleTestCheckIn() {
});
}
}
function updateCheckInRanking(value: boolean) {
accountInfo.value.settings.enableFunctions = value ? [...accountInfo.value.settings.enableFunctions, FunctionTypes.CheckInRanking] : accountInfo.value.settings.enableFunctions.filter(f => f !== FunctionTypes.CheckInRanking);
SaveEnableFunctions(accountInfo.value.settings.enableFunctions);
}
// 组件挂载时加载排行榜
onMounted(() => {