|
|
|
@ -99,7 +99,7 @@ |
|
|
|
|
<div class="description">往年历史赛事</div> |
|
|
|
|
<el-scrollbar height="650px"> |
|
|
|
|
<ul> |
|
|
|
|
<li v-for="item in historyRaceList" :key="item.id"> |
|
|
|
|
<li v-for="item in historyRaceList" :key="item.id" > |
|
|
|
|
<div class="year">2024年度</div> |
|
|
|
|
<div class="name">{{ item.name }}</div> |
|
|
|
|
<div class="time"> |
|
|
|
@ -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', |
|
|
|
|
}" |
|
|
|
|
> |
|
|
|
|
<div class="image"> |
|
|
|
|
<img :src="setImageUrl(item.image)" alt="" v-default-image /> |
|
|
|
|
</div> |
|
|
|
|
<div class="reac-info"> |
|
|
|
|
<div class="niandu"><div>{{ item.annualname }}年度</div><el-button type="primary" size="small">报名</el-button></div> |
|
|
|
|
<div class="niandu"> |
|
|
|
|
<div>{{ item.annualname }}年度</div> |
|
|
|
|
<el-button type="primary" size="small">报名</el-button> |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
class="reac-title" |
|
|
|
|
style="font-weight: 600; color: #000; font-size: 16px" |
|
|
|
@ -191,6 +197,7 @@ import { |
|
|
|
|
getProjectId, |
|
|
|
|
} from '@/api/race' |
|
|
|
|
import { useRouter, useRoute } from 'vue-router' |
|
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
const Route = useRoute() |
|
|
|
|
const Router = useRouter() |
|
|
|
|
console.log(Route, 'Route') |
|
|
|
@ -202,12 +209,12 @@ const getRaceProjectListEvent = async () => { |
|
|
|
|
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) |
|
|
|
|