|
|
|
<template>
|
|
|
|
<!-- 比赛列表 -->
|
|
|
|
<div class="container-1420" v-if="isLoading">
|
|
|
|
<div class="nav-title">
|
|
|
|
<div class="top">竞赛导航</div>
|
|
|
|
<div class="bottom">30+项目登陆后报名</div>
|
|
|
|
</div>
|
|
|
|
<div class="race-list">
|
|
|
|
<div
|
|
|
|
class="item"
|
|
|
|
v-for="item in splietArr"
|
|
|
|
:key="item.id"
|
|
|
|
@click="toDetail(item.id)"
|
|
|
|
>
|
|
|
|
<div class="image">
|
|
|
|
<img :src="setImageUrl(item.compImg)" alt="" />
|
|
|
|
</div>
|
|
|
|
<div class="reac-info">
|
|
|
|
<div class="reac-title">{{ item.compName }}</div>
|
|
|
|
<div class="reac-project"><div v-html="item.compName"></div></div>
|
|
|
|
<!-- <div class="time">
|
|
|
|
报名时间:{{ item.starttime }}-{{ item.endtime }}
|
|
|
|
</div> -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="page">
|
|
|
|
<el-pagination
|
|
|
|
background
|
|
|
|
layout="prev, pager, next"
|
|
|
|
:total="total"
|
|
|
|
@change="handleSizeChange"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
import { getRaceList } from '@/api/race'
|
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
import { ElLoading } from 'element-plus'
|
|
|
|
const router = useRouter()
|
|
|
|
const reacProjectList = ref<any>([])
|
|
|
|
const splietArr = ref<any>([])
|
|
|
|
const isLoading = ref(false)
|
|
|
|
const total = ref<any>(0)
|
|
|
|
|
|
|
|
const getRaceProjectListEvent = async () => {
|
|
|
|
let page = {
|
|
|
|
column: 'createTime',
|
|
|
|
order: 'desc',
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 8,
|
|
|
|
}
|
|
|
|
const loading = ElLoading.service({
|
|
|
|
lock: true,
|
|
|
|
text: 'Loading',
|
|
|
|
background: 'rgba(255, 255, 255, 0.7)',
|
|
|
|
})
|
|
|
|
const res: any = await getRaceList(page)
|
|
|
|
console.log(res)
|
|
|
|
reacProjectList.value = res.result
|
|
|
|
splietArr.value = reacProjectList.value.slice(0, 8)
|
|
|
|
total.value = res.result.length
|
|
|
|
console.log(total.value, 'reacProjectList.value ')
|
|
|
|
|
|
|
|
isLoading.value = true
|
|
|
|
loading.close()
|
|
|
|
}
|
|
|
|
getRaceProjectListEvent()
|
|
|
|
const setImageUrl = (url: string) => {
|
|
|
|
return import.meta.env.VITE_APP_BASE_API + '/sys/common/static/' + url
|
|
|
|
}
|
|
|
|
// 前往比赛综述
|
|
|
|
const toDetail = (id: number) => {
|
|
|
|
router.push({
|
|
|
|
path: '/race-info',
|
|
|
|
query: {
|
|
|
|
id,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
// 分页
|
|
|
|
const handleSizeChange = (e: any) => {
|
|
|
|
console.log(e)
|
|
|
|
splietArr.value = reacProjectList.value.slice((e - 1) * 8, (e - 1) * 8 + 8)
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.race-list {
|
|
|
|
position: relative;
|
|
|
|
width: 100%;
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(4, 1fr);
|
|
|
|
grid-template-rows: repeat(2, 1fr);
|
|
|
|
// gap: 10px;
|
|
|
|
margin-top: 20px;
|
|
|
|
.item {
|
|
|
|
width: 340px;
|
|
|
|
height: 360px;
|
|
|
|
// background-color: pink;
|
|
|
|
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.06);
|
|
|
|
cursor: pointer;
|
|
|
|
border-radius: 10px;
|
|
|
|
transition: all 0.2s;
|
|
|
|
.image {
|
|
|
|
width: 100%;
|
|
|
|
height: 194px;
|
|
|
|
img {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.reac-info {
|
|
|
|
padding: 0 8px;
|
|
|
|
.reac-title {
|
|
|
|
margin-top: 19px;
|
|
|
|
color: #c9c9c9;
|
|
|
|
font-size: 12px;
|
|
|
|
}
|
|
|
|
.reac-project {
|
|
|
|
font-size: 16px;
|
|
|
|
font-weight: 600;
|
|
|
|
color: #333333;
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
|
|
|
.time {
|
|
|
|
font-size: 14px;
|
|
|
|
color: #8c8b8b;
|
|
|
|
margin-top: 40px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.item:hover {
|
|
|
|
transform: translateY(-5px);
|
|
|
|
}
|
|
|
|
.item:nth-child(n) {
|
|
|
|
margin-top: 20px;
|
|
|
|
}
|
|
|
|
.more {
|
|
|
|
position: absolute;
|
|
|
|
right: 20px;
|
|
|
|
top: -20px;
|
|
|
|
color: #0bd7c6;
|
|
|
|
cursor: pointer;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.nav-title {
|
|
|
|
margin-top: 100px;
|
|
|
|
color: #1e2033;
|
|
|
|
.top {
|
|
|
|
font-size: 40px;
|
|
|
|
font-weight: 600;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.bottom {
|
|
|
|
font-size: 16px;
|
|
|
|
text-align: center;
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.page {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
margin-top: 25px;
|
|
|
|
}
|
|
|
|
</style>
|