fwb 8 months ago
commit 6012514386
  1. 4
      src/Layout/tabbar/components/item.vue
  2. 2
      src/Layout/tabbar/index.vue
  3. 16
      src/api/race.ts
  4. 1
      src/assets/icons/race-none.svg
  5. BIN
      src/assets/images/left-top.png
  6. 9
      src/directives/defaultImage.ts
  7. 3
      src/main.ts
  8. 16
      src/router/module/constRouter/index.ts
  9. 49
      src/views/home/index.vue
  10. 379
      src/views/raceInfo/index.vue

@ -1,7 +1,6 @@
<template>
<!-- 根据路由动态生成菜单 -->
<template v-for="item in menuList" :key="item.path">
<!-- 没有子路由 -->
<template v-if="!item.children">
<el-menu-item
v-if="!item.meta.hidden"
@ -19,7 +18,6 @@
</template>
</el-menu-item>
</template>
<!-- 有子路由但是只有一个子路由 -->
<template v-if="item.children && item.children.length === 1">
<el-menu-item
v-if="!item.children[0].meta.hidden"
@ -34,7 +32,6 @@
</template>
</el-menu-item>
</template>
<!-- 有子路由且有多个 -->
<el-sub-menu
:index="item.path"
v-if="item.children && item.children.length > 1"
@ -51,7 +48,6 @@
</template>
<script lang="ts" setup>
import { useRouter } from 'vue-router'
// import { onMounted, reactive, ref, toRefs, watch } from 'vue'
//
defineProps(['menuList'])
const $router = useRouter()

@ -30,7 +30,7 @@
<div class="avater">
<img src="../../assets/images/default.png" alt="" />
</div>
<el-dropdown>
<el-dropdown style="width:.625rem">
<span class="el-dropdown-link">
{{ useUserStore.userInfo.username }}
<el-icon class="el-icon--right">

@ -8,9 +8,23 @@ export const getRaceProjectList = (params:any) => {
})
}
// 获取年度比赛列表
export const getYearRaceList = (params:any) => {
return request({
url:'/annualcomp/annualComp/findndbswlj',
params
})
}
// 获取比赛列表
export const getRaceList = (params:any) => {
return request({
url:'/annualcomp/annualComp/schoollist',
url:'/comp/comp/complistnolj',
params
})
}
// 获取比赛详细信息
export const getRaceInfo = (params:any) => {
return request({
url:'/comp/comp/complistnoxq',
params
})
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

@ -0,0 +1,9 @@
export default {
mounted(el:any, binding:any) {
el.onerror = () => {
// 当图片加载失败时,设置默认图片
el.src = binding.value ||'/src/assets/images/item.png'; // 默认图片
};
}
};

@ -18,10 +18,13 @@ import pinia from '@/store/index'
// 引入路由
import router from './permissions'
import '@/utils/rem.js'
import defaultImage from '@/directives/defaultImage';
// 创建vue实例
const app = createApp(App)
app.use(pinia)
// 注册全局指令
app.directive('default-image', defaultImage);
// 注册element plus组件库
app.use(ElementPlus, {
locale: zhCn,

@ -1,12 +1,11 @@
export const constRouter: any =
{
export const constRouter: any = {
path: '/',
component: () => import('@/Layout/index.vue'),
name: 'Layout',
redirect: '/home',
meta: {
icon: '',
title: '',
title: '首页',
hidden: false,
},
children: [
@ -153,6 +152,15 @@ export const constRouter: any =
hidden: false,
},
},
{
path: '/race-info',
name: 'RaecInfo',
component: () => import('@/views/raceInfo/index.vue'),
meta: {
icon: '',
title: '比赛详情',
hidden: true,
},
},
],
}

@ -1,9 +1,9 @@
<template>
<div class="container-1420" v-if="isLoading">
<div class="banner">
<div class="title">{{ reacProjectList[0].objName}}火热报名中</div>
<div class="title">{{ reacProjectList[0].compName }}火热报名中</div>
<div class="description">
{{ reacProjectList[0].annualCompId_dictText }}
<div v-html="reacProjectList[0].compName"></div>
</div>
<div class="application gradient">立即报名</div>
<div class="nav-title">
@ -13,14 +13,16 @@
</div>
<!-- 比赛列表 -->
<div class="race-list">
<div class="item" v-for="item in reacProjectList" :key="item.id">
<div class="item" v-for="item in reacProjectList" :key="item.id" @click="toDetail(item.id)">
<div class="image">
<img :src="setImageUrl(item.image)" alt="" />
<img :src="setImageUrl(item.compImg)" alt="" v-default-image/>
</div>
<div class="reac-info">
<div class="reac-title">{{ item.compname }}</div>
<div class="reac-project"><div v-html="item.introduce"></div></div>
<div class="time">报名时间:{{item.starttime}}-{{ item.endtime }}</div>
<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>
@ -68,7 +70,8 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { getRaceList } from '@/api/race'
import { useRouter } from 'vue-router';
const router = useRouter()
const reacProjectList = ref<any>([])
const isLoading = ref(false)
const getRaceProjectListEvent = async () => {
@ -78,17 +81,27 @@ const getRaceProjectListEvent = async () => {
pageNo: 1,
pageSize: 8,
}
const res:any = await getRaceList(page)
const res: any = await getRaceList(page)
console.log(res)
reacProjectList.value = res.result.records
console.log(reacProjectList.value ,'reacProjectList.value ');
reacProjectList.value = res.result.slice(0, 8)
console.log(reacProjectList.value, 'reacProjectList.value ')
isLoading.value = true
}
getRaceProjectListEvent()
const active = ref(1)
const setImageUrl = (url:string) => {
return import.meta.env.VITE_APP_BASE_API +url
const setImageUrl = (url: string) => {
return import.meta.env.VITE_APP_BASE_API + url
}
//
const toDetail = (id: number) => {
router.push({
path:'/race-info',
query: {
id
}
})
}
</script>
@ -158,6 +171,10 @@ const setImageUrl = (url:string) => {
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;
@ -167,6 +184,7 @@ const setImageUrl = (url:string) => {
}
}
.reac-info {
padding: 0 8px;
.reac-title {
margin-top: 19px;
color: #c9c9c9;
@ -185,6 +203,9 @@ const setImageUrl = (url:string) => {
}
}
}
.item:hover{
transform: translateY(-5px);
}
.item:nth-child(n) {
margin-top: 20px;
}

@ -0,0 +1,379 @@
<template>
<div class="container-1420 container">
<div class="top-image">Banner</div>
<!-- 年度比赛列表 -->
<div class="race-list">
<div class="item" v-for="item in reacProjectList" :key="item.id" @click="goToCompetition(item.id)">
<div class="image">
<img
:src="setImageUrl(item.image)"
alt=""
v-default-image="defaultImageUrl"
/>
</div>
<div class="reac-info">
<div class="reac-title">{{ item.name }}</div>
<div class="reac-project">{{ item.introduction }}</div>
<div class="time">
报名时间:{{ item.starttime }}-{{ item.endtime }}
</div>
</div>
</div>
</div>
<el-card v-if="reacProjectList.length === 0">
<div
style="
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
color: #aaa;
"
>
<svgIcon name="race-none" width="200px" height="200px" />
<p>没有年度比赛~</p>
</div>
</el-card>
<!-- 年度比赛详细信息 -->
<div class="year-race-info">
<div class="left-info">
<el-card>
<template #header>
<el-breadcrumb>
<el-breadcrumb-item
v-for="item in Route.matched"
:key="item.path"
:to="{ path: item.path }"
>
{{ item.meta.title }}
</el-breadcrumb-item>
</el-breadcrumb>
</template>
<div>
<!-- {{ raceInfo }} -->
<div class="race-info">
<div class="top">
<div class="left">
<el-image
src="https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg"
style="width: 300px"
:preview-src-list="[
'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
]"
></el-image>
</div>
<div class="right">
<ul>
<li>
<div class="label">比赛名称:</div>
<div class="text">{{ raceInfo.compName }}</div>
</li>
<li>
<div class="label">负责人:</div>
<div class="text">{{ raceInfo.createBy }}</div>
</li>
<li>
<div class="label">负责部门:</div>
<div class="text">{{ raceInfo.dept }}</div>
</li>
<li style="width: 33%">
<div class="label">比赛类型:</div>
<div class="text">A</div>
</li>
<li style="width: 33%">
<div class="label">比赛权重:</div>
<div class="text">{{ raceInfo.compweight }}</div>
</li>
<li style="width: 33%">
<div class="label">比赛内部排名:</div>
<div class="text">{{ raceInfo.compOrder }}</div>
</li>
</ul>
</div>
</div>
<div class="center">
<div class="label">比赛简介:</div>
<div class="deaceiption">
亲爱的同学们老师们以及各位编程爱好者们
在这个充满创新与挑战的时代一场精彩纷呈的大学生编程大赛即将拉开帷幕
本次大学生编程大赛是智慧与技能的激烈碰撞是创意与实践的完美结合它为广大有才华有梦想的大学生们提供了一个展现自我超越自我的广阔舞台
在这里你将与来自不同高校不同专业的编程高手们同场竞技大家将用代码编织梦想用算法开拓未来无论是擅长网页开发移动应用编程还是热衷于数据分析人工智能算法设计都能在这个舞台上找到属于自己的一片天地
大赛不仅考验选手们的编程技术水平更注重创新思维和解决实际问题的能力在比赛过程中选手们将面临各种复杂的问题和挑战需要运用所学知识发挥创造力提出独特而有效的解决方案
同时本次大赛也为同学们提供了一个与行业专家企业代表交流互动的机会他们将带来最前沿的技术资讯和行业动态为同学们的未来发展提供宝贵的建议和指导
来吧亲爱的大学生们加入这场编程的盛宴释放你的无限潜力用代码书写属于你们的辉煌篇章让我们一起见证新一代编程之星的诞生
</div>
<div class="label">附件:</div>
<div class="file">
<el-tag type="primary">fhsuihfiaosdufasiu.pdf</el-tag>
</div>
</div>
</div>
</div>
</el-card>
</div>
<div class="right-history">
<el-card style="padding: 0">
<div class="title">历史比赛</div>
<div class="description">往年历史赛事</div>
<ul>
<li v-for="i in 4" :key="i">
<div class="year">2024年度</div>
<div class="name">河南省大学生创新创业大赛</div>
<div class="time">报名时间:2023.06.01 - 2023.06.30</div>
<div class="go-to">前往查看</div>
<div class="icon">
<img src="../../assets/images/编组.png" alt="" srcset="" />
</div>
</li>
</ul>
</el-card>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref, toRefs, watch } from 'vue'
import { getYearRaceList, getRaceInfo } from '@/api/race'
import { useRouter, useRoute } from 'vue-router'
const Route = useRoute()
const Router = useRouter()
console.log(Route, 'Route')
const defaultImageUrl = '/src/assets/images/item.png'
const reacProjectList = ref<any>([])
const getRaceProjectListEvent = async () => {
let page = {
id: Route.query.id,
column: 'createTime',
order: 'desc',
pageNo: 1,
pageSize: 8,
}
const res: any = await getYearRaceList(page)
console.log(res)
reacProjectList.value = res.result.slice(0, 8)
console.log(reacProjectList.value, 'reacProjectList.value ')
}
getRaceProjectListEvent()
const setImageUrl = (url: string) => {
return import.meta.env.VITE_APP_BASE_API + url
}
//
const raceInfo = ref<any>({})
const getraceInfoEvent = async () => {
const res: any = await getRaceInfo({ id: Route.query.id })
console.log(res)
raceInfo.value = res.result
}
getraceInfoEvent()
//
const goToCompetition = (id:any) => {
Router.push({ path: '/competition', query: { id } })
}
</script>
<style lang="scss" scoped>
.container {
padding-top: 80px;
.top-image {
width: 100%;
height: 300px;
background-color: skyblue;
text-align: center;
color: #fff;
font-size: 32px;
font-weight: 700;
line-height: 300px;
}
.race-list {
width: 100%;
display: grid;
grid-template-columns: repeat(4, 1fr);
// grid-template-rows: repeat(2, 1fr);
// gap: 10px;
margin-top: 40px;
.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;
}
}
.year-race-info {
display: flex;
margin-top: 30px;
min-height: 750px;
.left-info {
flex: 1;
}
.right-history {
width: 300px;
margin-left: 40px;
.title {
color: #1e2033;
font-size: 28px;
font-weight: 600;
}
.description {
color: #1e2033;
font-size: 14px;
margin-top: 15px;
}
ul {
margin-top: 30px;
li {
position: relative;
width: 100%;
height: 140px;
// background-color: pink;
color: #333333;
padding: 15px;
display: flex;
flex-direction: column;
justify-content: space-between;
box-shadow: 0rem 0rem 0.05208rem rgba(0, 0, 0, 0.06);
margin-top: 10px;
cursor: pointer;
.year {
font-size: 12px;
}
.name {
width: 130px;
font-size: 16px;
font-weight: 600;
margin-top: 10px;
}
.time {
font-size: 12px;
}
.go-to {
position: absolute;
right: 0;
top: 0;
width: 115px;
height: 28px;
line-height: 28px;
text-align: center;
font-size: 14px;
color: #f6f5fb;
background: url('../../assets/images/left-top.png') no-repeat;
background-size: contain;
}
.icon {
position: absolute;
right: 25px;
top: 50%;
transform: translateY(-50%);
width: 34px;
height: 41px;
img {
width: 100%;
height: 100%;
}
}
}
}
}
.race-info {
.top {
display: flex;
.right {
margin-left: 25px;
flex: 1;
ul {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
align-items: center;
padding: 5px;
li {
width: 50%;
display: flex;
.label {
font-size: 16px;
color: #aaa;
width: 100px;
}
.text {
font-size: 16px;
font-weight: 600;
}
}
li:first-child {
align-items: center;
width: 100%;
.text {
font-size: 26px;
}
}
li:nth-child(3n) {
width: 33%;
}
}
}
}
.center {
margin-top: 25px;
.label {
font-size: 16px;
color: #aaa;
}
.deaceiption {
font-size: 16px;
text-indent: 2em;
line-height: 26px;
margin-top: 15px;
height: 300px;
}
.file {
margin-top: 25px;
}
}
}
}
}
:deep(.el-card) {
width: 100%;
height: 100%;
}
</style>
Loading…
Cancel
Save