You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

435 lines
10 KiB

9 months ago
<template>
<div class="container-1420" v-if="isLoading">
9 months ago
<div class="banner">
<div class="title">{{ reacProjectList[0].compName }}火热报名中</div>
<div class="description">
<div v-html="reacProjectList[0].compInfo"></div>
</div>
<div
class="application gradient"
@click="toDetail(reacProjectList[0].id)"
>
立即报名
</div>
9 months ago
</div>
<!-- 比赛列表 -->
9 months ago
<!-- 新闻列表 -->
<div class="news-list">
<div class="news-title">
<div class="top">
<div>新闻资讯</div>
<div @click="router.push('/news')">
<el-icon><ArrowRightBold /></el-icon>
</div>
</div>
<!-- <div class="bottom">30+项目登陆后报名</div> -->
9 months ago
</div>
<div class="newa-panel">
<div class="tab">
<div
8 months ago
:class="active === index ? 'item active gradient' : 'item'"
v-for="(item, index) in newList"
8 months ago
:key="index"
8 months ago
@click="toggleTab(item, index)"
>
{{ item.name }}
</div>
</div>
<div class="newa-main">
<div class="left">
4 months ago
<img src="../../assets/images/news.png" alt="" style="width: 100%; height: 100%" />
</div>
<div class="right">
<div class="title">{{ newInfo.name }}</div>
<div class="description">
<!-- 我是新闻描述,我是新闻描述,我是新闻描述 -->
</div>
<div class="newa-main-list">
<ul>
<li v-for="item in childrenNewList" :key="item.id" @click="toNewsDetail(item.id)">
<div class="info">
{{ item.columnName }}
</div>
<div class="time">{{ item.createTime }}</div>
<div class="name">
{{ item.createBy_dictText }}
</div>
</li>
</ul>
</div>
</div>
9 months ago
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
9 months ago
import { ref } from 'vue'
import { getRaceList } from '@/api/race'
import { useRouter } from 'vue-router'
import { ElLoading } from 'element-plus'
8 months ago
import { getColumnListApi, queryEssayListApi } from '@/api/news'
const router = useRouter()
const reacProjectList = ref<any>([])
const isLoading = ref(false)
8 months ago
const News = ref<any>(['全部', '通知公告', '赛事资讯', '活动速递', '政策文件'])
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.slice(0, 8)
console.log(reacProjectList.value, 'reacProjectList.value ')
isLoading.value = true
loading.close()
}
getRaceProjectListEvent()
8 months ago
const active = ref(0)
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 toNewsDetail = (id: number) => {
router.push({
path: '/detail/' + id,
})
}
// 获取新闻栏目
const newList = ref<any>([])
const getNewsList = async () => {
const res: any = await getColumnListApi()
console.log(res)
newList.value = res.result
console.log(newList.value, 'newList.value')
newInfo.value = newList.value[0]
8 months ago
getNewInfo(newList.value[0].id)
}
getNewsList()
// 新闻详情
const newInfo = ref<any>({})
// 栏目下的新闻
const childrenNewList = ref<any>([])
8 months ago
const getNewInfo = async (id: any) => {
const res: any = await queryEssayListApi(id)
8 months ago
childrenNewList.value = res.result.records
console.log(childrenNewList, 'childrenNewList')
}
// 切换tab
const toggleTab = (item: any, index: number) => {
active.value = index
newInfo.value = item
8 months ago
getNewInfo(newInfo.value.id)
}
9 months ago
</script>
<script lang="ts">
export default {
name: 'Home', // 必须显式设置
};
</script>
9 months ago
<style lang="scss" scoped>
.banner {
position: relative;
width: 100%;
height: 692px;
// background: radial-gradient(
// circle,
// rgba(131, 255, 197, 1) 0%,
// rgba(255, 255, 255, 1) 50%
// );
background: url('../../assets/images/banner1.png') no-repeat;
background-size: cover;
9 months ago
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.title {
font-size: 50px;
font-weight: 600;
color: #333333;
}
.description {
width: 1074px;
text-align: center;
font-size: 20px;
color: #666;
margin-top: 37px;
line-height: 32px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
9 months ago
}
.application {
width: 272px;
height: 64px;
text-align: center;
line-height: 64px;
border-radius: 10px;
font-size: 24px;
color: #fff;
cursor: pointer;
margin-top: 50px;
}
.nav-title {
position: absolute;
bottom: 0;
color: #1e2033;
.top {
font-size: 40px;
font-weight: 600;
text-align: center;
}
.bottom {
font-size: 16px;
text-align: center;
margin-top: 10px;
}
}
}
.race-list {
position: relative;
9 months ago
width: 100%;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(2, 1fr);
// gap: 10px;
9 months ago
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;
9 months ago
.image {
width: 100%;
height: 194px;
img {
width: 100%;
height: 100%;
}
}
.reac-info {
padding: 0 8px;
9 months ago
.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);
}
9 months ago
.item:nth-child(n) {
margin-top: 20px;
}
.more {
position: absolute;
right: 20px;
top: -20px;
color: #0bd7c6;
cursor: pointer;
font-size: 14px;
}
9 months ago
}
.news-list {
margin-top: 170px;
background: url('../../assets/images/bg2.png') no-repeat;
background-size: cover;
9 months ago
.news-title {
.top {
font-size: 40px;
font-weight: 600;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
div {
display: flex;
align-items: center;
justify-content: center;
margin: 0 10px;
}
div:last-child {
cursor: pointer;
transition: all 0.2s;
&:hover {
color: #0bd7c6;
transform: scale(1.2);
}
}
9 months ago
}
.bottom {
font-size: 16px;
text-align: center;
margin-top: 10px;
}
}
.newa-panel {
width: 100%;
height: 630px;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
box-shadow: 2px 6px 14px rgba(0, 0, 0, 0.25);
margin-top: 25px;
// padding: 46px 180px 70px 180px;
padding-top: 46px;
display: flex;
flex-direction: column;
align-items: center;
9 months ago
.tab {
display: flex;
justify-content: space-between;
align-items: center;
.item {
width: 152px;
height: 70px;
border-radius: 10px;
text-align: center;
line-height: 70px;
color: #1e2033;
font-size: 18px;
box-shadow: 7px 7px 22px -10px rgba(0, 0, 0, 0.22);
cursor: pointer;
transition: all 0.2s;
margin-right: 48px;
9 months ago
}
.item:hover {
9 months ago
transform: scale(1.1);
}
.item:last-child {
margin: 0;
}
9 months ago
.active {
color: #fff;
}
}
.newa-main {
width: 1200px;
height: 465px;
padding: 58px 54px 19px 25px;
display: flex;
align-items: center;
justify-content: space-between;
.left {
width: 546px;
height: 388px;
background-color: #d9d9d9;
border-radius: 15px;
overflow: hidden;
}
.right {
flex: 1;
height: 388px;
margin-left: 89px;
padding: 15px 0;
.title {
font-size: 24px;
font-weight: 600;
color: #1e2033;
}
.description {
font-size: 14px;
margin-top: 10px;
color: #1e2033;
}
.newa-main-list {
width: 100%;
height: 270px;
// background-color: pink;
margin-top: 38px;
ul {
width: 100%;
height: 100%;
// display: flex;
// flex-wrap: wrap;
justify-content: space-between;
// align-items: center;
li {
// width: 227px;
width: 100%;
height: 65px;
cursor: pointer;
display: flex;
.time {
font-size: 14px;
color: #1e2033;
margin-left: 20px;
}
.info::before {
content: ' ';
display: block;
position: absolute;
top: 0;
left: 0;
width: 6px;
height: 13px;
background-color: #319245;
}
.info {
position: relative;
// margin-top: 12px;
font-size: 14px;
color: #1e2033;
// line-height: 18px;
padding-left: 13px;
}
.name{
font-size: 14px;
margin-left: 20px;
}
}
}
}
}
}
9 months ago
}
}
</style>