Browse Source

热门排序

赵添更 6 ngày trước cách đây
mục cha
commit
d66edc0934

+ 3 - 0
packages/app/src/core/libs/models.ts

@@ -235,6 +235,7 @@ export interface Activity {
    * 报名开始时间 or 计划报名时间
    */
   applyStartTime: string
+  headRecommendTime: string
   planApplyStartTime?: string
   studyStartTime: string
   studyEndTime: string
@@ -357,6 +358,7 @@ export interface StudyTour {
   needPointsCount: any
   badgeId: any
   applyStartTime: any
+  headRecommendTime: any
   applyEndTime: any
   applyStatus: string
   studyStartTime: any
@@ -437,6 +439,7 @@ export interface MyStudyTour {
   needPointsCount?: number
   badgeId?: number
   applyStartTime: number
+  headRecommendTime: number
   applyEndTime: number
   applyStatus?: number
   studyStartTime: number

+ 3 - 3
packages/app/src/pages/home/index.vue

@@ -100,13 +100,13 @@ const handleLike = async (options) => {
 const setHotActivities = async () => {
   const res = await Promise.all([
     getStudyTours({ headRecommend: 1 }).then((res) =>
-      res.data.list.map((it) => ({ type: 'studyTour', data: it, startAt: it.applyStartTime })),
+      res.data.list.map((it) => ({ type: 'studyTour', data: it, startAt: it.headRecommendTime })),
     ),
     getActivities({ headRecommend: 1 }).then((res) =>
-      res.data.list.map((it) => ({ type: 'activity', data: it, startAt: it.applyStartTime })),
+      res.data.list.map((it) => ({ type: 'activity', data: it, startAt: it.headRecommendTime })),
     ),
   ])
-  hotActivities.value = sort(res.flat(), (it) => it.startAt) as any
+  hotActivities.value = sort(res.flat(), (it) => it.startAt, true) as any
 }
 const handlePlay = async (id) => {
   const body = pick(swiperData.value?.find((it) => it.data.id === id).data, ['id', 'status'])