From df2d71003b002cbb46c87f075416d54558378c5a Mon Sep 17 00:00:00 2001 From: ADKCodeXD <790532173@qq.com> Date: Fri, 10 May 2024 00:47:09 +0800 Subject: [PATCH] feat: support sort --- composables/useActivityMainPage.ts | 2 +- types/movie.type.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/composables/useActivityMainPage.ts b/composables/useActivityMainPage.ts index df3e8a6..d66c357 100644 --- a/composables/useActivityMainPage.ts +++ b/composables/useActivityMainPage.ts @@ -96,7 +96,7 @@ export const useActivityMain = () => { const getVideoByDay = async (day: number, activityId: number) => { isLoading.value = true const { data } = await getMovieByActivityId(activityId, day) - movies.value = data?.result || [] + movies.value = data?.result.sort((a, b) => (a.sortIndex || 0) - (b.sortIndex || 0)) || [] activeVideo.value = (movies.value && movies.value[0]) || null players.value = [] isLoading.value = false diff --git a/types/movie.type.ts b/types/movie.type.ts index 2a6100e..9cd6fb7 100644 --- a/types/movie.type.ts +++ b/types/movie.type.ts @@ -7,6 +7,8 @@ declare module 'Movie' { * 关联活动id 如果不存在则为非活动作品 */ activityId: null | number + + sortIndex: null | number /** * 作者id 可以关联本站拥有的用户 如果不存在可以输入作者名 */