From f525bbb759dad27f394f95f0b5ff01b36e509f0c Mon Sep 17 00:00:00 2001 From: Megghy Date: Thu, 1 May 2025 08:18:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8F=8A=E7=9B=B8=E5=85=B3=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新 .gitignore,添加 SpecStory 说明文件 - 在 App.vue 中引入 NGlobalStyle 组件 - 更新 api-models.ts,添加签到相关数据模型 - 在 CheckInSettings.vue 中实现签到功能的配置界面 - 添加签到排行榜功能,允许用户查看签到情况 - 更新 PointHistoryCard.vue,增加签到记录显示 - 在 PointSettings.vue 中添加签到相关设置项 - 更新路由,添加签到排行页面 --- .gitignore | 2 + README.md | 10 +- src/App.vue | 5 +- src/api/api-models.ts | 37 +- src/api/query.ts | 3 - .../autoaction/ActionHistoryViewer.vue | 8 +- .../autoaction/settings/CheckInSettings.vue | 824 +++++++++++++----- .../store/autoAction/modules/checkin.ts | 327 +++---- src/client/store/useAutoAction.ts | 362 +++----- src/client/store/useBiliFunction.ts | 27 +- src/components.d.ts | 2 + src/components/UpdateNoteContainer.vue | 2 +- src/components/manage/PointHistoryCard.vue | 77 +- src/data/UpdateNote.ts | 44 +- src/data/constants.ts | 1 + src/router/user.ts | 9 + src/views/ViewerLayout.vue | 6 + src/views/manage/point/PointSettings.vue | 24 +- .../manage/point/PointUserDetailCard.vue | 2 +- src/views/view/CheckInRankingView.vue | 468 ++++++++++ 20 files changed, 1479 insertions(+), 761 deletions(-) create mode 100644 src/views/view/CheckInRankingView.vue diff --git a/.gitignore b/.gitignore index efbe486..f5e69df 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ pnpm-debug.log* env.d.ts /.specstory /.cursor +# SpecStory explanation file +.specstory/.what-is-this.md diff --git a/README.md b/README.md index bfbdd4b..166f220 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,23 @@ ## Project setup ``` -yarn install +bun install ``` ### Compiles and hot-reloads for development ``` -yarn serve +bun dev ``` ### Compiles and minifies for production ``` -yarn build +bun run build ``` ### Lints and fixes files ``` -yarn lint +bun run lint ``` ### Customize configuration -See [Configuration Reference](https://cli.vuejs.org/config/). +See [Configuration Reference](https://cli.vuejs.org/config/). \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 98087e5..ff43eee 100644 --- a/src/App.vue +++ b/src/App.vue @@ -67,7 +67,8 @@ 'Inter ,"Noto Sans SC",-apple-system,blinkmacsystemfont,"Segoe UI",roboto,"Helvetica Neue",arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"!important', }, // ... - }; +}; + const body = document.body; onMounted(() => { if (isDarkMode.value) { @@ -84,6 +85,7 @@ style="height: 100vh" :locale="zhCN" :date-locale="dateZhCN" + inline-theme-disabled > @@ -93,6 +95,7 @@ + diff --git a/src/api/api-models.ts b/src/api/api-models.ts index d5df165..031c728 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -40,6 +40,7 @@ export interface UserInfo extends UserBasicInfo { isInBlackList: boolean templateTypes: { [key: string]: string } streamerInfo?: StreamerModel + allowCheckInRanking?: boolean // 是否允许查看签到排行 } } export interface EventFetcherStateModel { @@ -226,6 +227,18 @@ export interface Setting_Point { scPointPercent: number // double maps to number in TypeScript giftPointPercent: number // double maps to number in TypeScript giftAllowType: SettingPointGiftAllowType + + // 签到系统设置 + enableCheckIn: boolean // 是否启用签到功能 + checkInKeyword: string // 签到关键词 + givePointsForCheckIn: boolean // 是否为签到提供积分 + baseCheckInPoints: number // 基础签到积分 + enableConsecutiveBonus: boolean // 是否启用连续签到奖励 + bonusPointsPerDay: number // 每天额外奖励积分 + maxBonusPoints: number // 最大奖励积分 + allowSelfCheckIn: boolean // 是否允许自己签到 + requireAuth: boolean // 是否需要认证 + allowCheckInRanking: boolean // 是否允许查询签到排行 } export interface Setting_QuestionDisplay { font?: string // Optional string, with a maximum length of 30 characters @@ -801,7 +814,8 @@ export interface ResponsePointHisrotyModel { export enum PointFrom { Danmaku, Manual, - Use + Use, + CheckIn } export interface ResponseUserIndexModel { @@ -809,3 +823,24 @@ export interface ResponseUserIndexModel { videos: VideoCollectVideo[] links: { [key: string]: string } } + +// 签到排行信息 +export interface CheckInRankingInfo { + ouId: string + name: string + consecutiveDays: number + points: number + lastCheckInTime: number + isAuthed: boolean + monthlyCheckInCount?: number // 本月签到次数 + totalCheckInCount?: number // 总签到次数 +} + +// 签到结果 +export interface CheckInResult { + success: boolean + message: string + points: number + consecutiveDays: number + todayRank: number +} diff --git a/src/api/query.ts b/src/api/query.ts index 3c6c63b..a10dfee 100644 --- a/src/api/query.ts +++ b/src/api/query.ts @@ -142,9 +142,6 @@ function getParams(params: any) { resultParams.set('token', urlParams.get('token') || '') } - // 添加时间戳用于解决意外添加的缓存 - resultParams.set('timestamp', Date.now().toString()) - return resultParams.toString() } export async function QueryPostPaginationAPI( diff --git a/src/client/components/autoaction/ActionHistoryViewer.vue b/src/client/components/autoaction/ActionHistoryViewer.vue index 3c6d95e..485d676 100644 --- a/src/client/components/autoaction/ActionHistoryViewer.vue +++ b/src/client/components/autoaction/ActionHistoryViewer.vue @@ -34,6 +34,7 @@ const columns = [ title: '时间', key: 'timestamp', width: 180, + sorter: (a: HistoryItem, b: HistoryItem) => a.timestamp - b.timestamp, render: (row: HistoryItem) => { return h(NTime, { time: new Date(row.timestamp), @@ -106,9 +107,9 @@ async function loadHistory() { ]); historyData.value = { - [HistoryType.DANMAKU]: danmakuHistory, - [HistoryType.PRIVATE_MSG]: privateMsgHistory, - [HistoryType.COMMAND]: commandHistory + [HistoryType.DANMAKU]: danmakuHistory.sort((a, b) => b.timestamp - a.timestamp), + [HistoryType.PRIVATE_MSG]: privateMsgHistory.sort((a, b) => b.timestamp - a.timestamp), + [HistoryType.COMMAND]: commandHistory.sort((a, b) => b.timestamp - a.timestamp) }; } catch (error) { console.error('加载历史数据失败:', error); @@ -253,6 +254,7 @@ onUnmounted(() => { pageSizes: [10, 20, 50], }" :row-key="row => row.id" + default-sort-order="descend" >