|
@@ -1,12 +1,15 @@
|
|
|
<route lang="json">
|
|
|
-{ "style": { "navigationBarTitleText": "线下活动" } }
|
|
|
+{ "style": { "navigationBarTitleText": "线下活动", "navigationBarBackgroundColor": "#fff" } }
|
|
|
</route>
|
|
|
<script setup lang="ts">
|
|
|
-import { getContents, getAllCategories, getActivities } from '../../../../core/libs/requests'
|
|
|
+import { getAllCategories, getActivities } from '../../../../core/libs/requests'
|
|
|
import Card from '@/components/card.vue'
|
|
|
import PageHelper from '@/components/page-helper.vue'
|
|
|
import TiltedButton from '@/components/tilted-button.vue'
|
|
|
import { useRouter } from '../../../../core/utils/router'
|
|
|
+import dayjs from 'dayjs'
|
|
|
+import ActivityCountDown from '../../components/activity-count-down.vue'
|
|
|
+import { getActivityStatus } from '../../../../core/utils/common'
|
|
|
|
|
|
const tab = ref<number>(0)
|
|
|
const contentCategory = ref()
|
|
@@ -14,38 +17,21 @@ const router = useRouter()
|
|
|
const { data: categories, run: setCategories } = useRequest(() => getAllCategories(), {
|
|
|
initialData: [],
|
|
|
})
|
|
|
-const { data, run: setData } = useRequest(
|
|
|
- () =>
|
|
|
- getContents({
|
|
|
- contentType: '1',
|
|
|
- contentCategory: contentCategory.value,
|
|
|
- }),
|
|
|
- {
|
|
|
- initialData: { list: [] },
|
|
|
- },
|
|
|
-)
|
|
|
const setContentCategory = (index) => {
|
|
|
- contentCategory.value = categories.value.find(({ id }) => id === 2).children[index].id.toString()
|
|
|
+ contentCategory.value = categories.value.find(({ id }) => id === 2)?.children[index].id.toString()
|
|
|
}
|
|
|
const handleTabChange = ({ index }) => {
|
|
|
setContentCategory(index)
|
|
|
- setData()
|
|
|
}
|
|
|
onMounted(async () => {
|
|
|
await setCategories()
|
|
|
setContentCategory(tab.value)
|
|
|
- await setData()
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
|
<div class="flex-grow flex flex-col gap-6 mx-3.5">
|
|
|
<div class="mx--3.5">
|
|
|
- <wd-tabs
|
|
|
- v-model="tab"
|
|
|
- custom-class="bg-transparent!"
|
|
|
- :slidable-num="4"
|
|
|
- @change="handleTabChange"
|
|
|
- >
|
|
|
+ <wd-tabs v-model="tab" custom-class="" :slidable-num="4" @change="handleTabChange">
|
|
|
<block v-for="(it, item) in categories.find(({ id }) => id === 2).children" :key="item">
|
|
|
<wd-tab :title="it.name"></wd-tab>
|
|
|
</block>
|
|
@@ -77,9 +63,11 @@ onMounted(async () => {
|
|
|
活动时间:
|
|
|
</div>
|
|
|
<div
|
|
|
- class="text-black/40 text-sm font-normal font-['PingFang SC'] leading-[34px]"
|
|
|
+ class="text-black/40 text-sm font-normal font-['PingFang SC'] leading-[34px] flex items-center"
|
|
|
>
|
|
|
- 07.15 08.10
|
|
|
+ {{ dayjs(it.activityStartTime).format('MM.DD') }}
|
|
|
+ <wd-icon name="play" size="22px"></wd-icon>
|
|
|
+ {{ dayjs(it.activityEndTime).format('MM.DD') }}
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flex items-end">
|
|
@@ -100,39 +88,45 @@ onMounted(async () => {
|
|
|
<view
|
|
|
class="flex items-center text-black/40 text-sm font-normal font-['PingFang SC'] leading-[34px]"
|
|
|
>
|
|
|
- 距结束还剩
|
|
|
- <view
|
|
|
- class="w-4 h-4 bg-black/90 rounded flex-col justify-center items-center gap-2.5 inline-flex mx-1.5"
|
|
|
- >
|
|
|
- <view
|
|
|
- class="text-white text-[10px] font-normal font-['PingFang SC'] leading-[10.18px]"
|
|
|
- >
|
|
|
- 05
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- 天
|
|
|
- <div
|
|
|
- class="w-4 h-4 bg-black/90 rounded flex-col justify-center items-center gap-2.5 inline-flex mx-1.5"
|
|
|
- >
|
|
|
- <div
|
|
|
- class="text-white text-[10px] font-normal font-['PingFang SC'] leading-[10.18px]"
|
|
|
- >
|
|
|
- 05
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- 时
|
|
|
- <div
|
|
|
- class="w-4 h-4 bg-black/90 rounded flex-col justify-center items-center gap-2.5 inline-flex mx-1.5"
|
|
|
+ <!-- <wd-count-down
|
|
|
+ :time="dayjs(it.applyStartTime).diff(new Date(), 'millisecond')"
|
|
|
>
|
|
|
- <div
|
|
|
- class="text-white text-[10px] font-normal font-['PingFang SC'] leading-[10.18px]"
|
|
|
- >
|
|
|
- 05
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- 分
|
|
|
+ <template #default="{ current }">
|
|
|
+ <div class="flex items-center gap-1.25 text-black/40 text-sm">
|
|
|
+ <div>距结束还剩</div>
|
|
|
+ <div
|
|
|
+ class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
|
|
|
+ >
|
|
|
+ {{ current.days }}
|
|
|
+ </div>
|
|
|
+ <span class="custom-count-down-colon">天</span>
|
|
|
+ <div
|
|
|
+ class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
|
|
|
+ >
|
|
|
+ {{ current.hours }}
|
|
|
+ </div>
|
|
|
+ <span class="custom-count-down-colon">时</span>
|
|
|
+ <div
|
|
|
+ class="w-4 h-4 bg-black/90 rounded text-white text-2.5 flex items-center justify-center"
|
|
|
+ >
|
|
|
+ {{ current.minutes }}
|
|
|
+ </div>
|
|
|
+ <span class="custom-count-down-colon">分</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </wd-count-down> -->
|
|
|
+ <ActivityCountDown
|
|
|
+ :start-at="it.applyStartTime"
|
|
|
+ :end-at="it.applyEndTime"
|
|
|
+ ></ActivityCountDown>
|
|
|
</view>
|
|
|
- <tilted-button>立即报名</tilted-button>
|
|
|
+ <tilted-button>
|
|
|
+ {{
|
|
|
+ getActivityStatus(it.applyStartTime, it.applyEndTime) === 'running'
|
|
|
+ ? '立即报名'
|
|
|
+ : '查看详情'
|
|
|
+ }}
|
|
|
+ </tilted-button>
|
|
|
</view>
|
|
|
</div>
|
|
|
</Card>
|