@@ -141,13 +141,19 @@
class="item"
v-for="item in reacProjectList"
:key="item.id"
- @click="goToCompetition(item.id)"
+ @click="goToCompetition(item.id, item.endtime)"
+ :style="{
+ 'background-color': isTimePassed(item.endtime) ? 'rgb(232 232 232)' : '#fff',
+ }"
>
-
{{ item.annualname }}年度
报名
+
+
{{ item.annualname }}年度
+
报名
+
{
id: Route.query.id,
column: 'createTime',
order: 'desc',
- pageNo: 1,
- pageSize: 8,
+ // pageNo: 1,
+ // pageSize: 8,2
}
const res: any = await getYearRaceList(page)
console.log(res)
- reacProjectList.value = res.result.slice(0, 8)
+ reacProjectList.value = res.result
console.log(reacProjectList.value, 'reacProjectList.value ')
}
getRaceProjectListEvent()
@@ -225,8 +232,11 @@ const getraceInfoEvent = async () => {
getraceInfoEvent()
// 前往年度比赛页面
-const goToCompetition = async (id: any) => {
- const projectId = await getProjectId({ anncmopid: id })
+const goToCompetition = async (id: any, endTime: string) => {
+ if (isTimePassed(endTime)) {
+ return ElMessage.error('比赛已结束')
+ }
+ const projectId: any = await getProjectId({ anncmopid: id })
console.log(projectId.result)
// return
@@ -234,7 +244,16 @@ const goToCompetition = async (id: any) => {
// Router.push({ path: '/competition', query: { id, raceId: Route.query.id } })
}
+function isTimePassed(targetTime) {
+ // 获取当前时间
+ const now = new Date()
+ // 将传入的时间字符串转换为 Date 对象
+ const target = new Date(targetTime)
+
+ // 比较当前时间和目标时间
+ return now > target
+}
const doLoadFile = (url: any) => {
// console.log( import.meta.env.VITE_APP_BASE_API + "/sys/common/static/" + url)
window.open(import.meta.env.VITE_APP_BASE_API + '/sys/common/static/' + url)