重构新闻列表 配置动态浏览器图标 问题修改

base
JayChou 6 months ago
parent 4c504f76d4
commit 3a6254d1cc
  1. 3
      index.html
  2. BIN
      public/favicon.ico
  3. 18
      src/Layout/main/index.vue
  4. 36
      src/Layout/tabbar/index.vue
  5. 10
      src/api/news.ts
  6. 3
      src/directives/defaultImage.ts
  7. 19
      src/store/module/setting.ts
  8. 3
      src/styles/index.scss
  9. 2
      src/views/competition/index.vue
  10. 101
      src/views/home/index.vue
  11. 2
      src/views/news/components/newsDetail.vue
  12. 308
      src/views/news/index.vue
  13. 114
      src/views/raceInfo/index.vue

@ -2,7 +2,8 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>高赛通</title> <title>高赛通</title>
</head> </head>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -4,20 +4,24 @@
<router-view :key="$route.path" /> <router-view :key="$route.path" />
</transition> </transition>
</section> --> </section> -->
<router-view></router-view> <!-- <router-view></router-view> -->
<!-- <router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<keep-alive> <keep-alive :include="cachedRoutes">
<component :is="Component"></component> <component :is="Component"></component>
</keep-alive> </keep-alive>
</router-view> --> </router-view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {} from 'vue' import { ref } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import settingStore from '@/store/module/setting'
const $route = useRoute() const $route = useRoute()
const useSettingStore = settingStore()
console.log($route) console.log($route)
//
const cachedRoutes = ref(['Home']) // name
useSettingStore.setLogo()
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

@ -4,11 +4,7 @@
<div class="left"> <div class="left">
<div class="logo-box"> <div class="logo-box">
<div class="lesson"> <div class="lesson">
<img <img :src="logoUrl" alt="" />
src="../../assets/images/LOGO.png"
alt=""
/>
<!-- <img src="../../assets/images/LOGO.png" alt=""> --> <!-- <img src="../../assets/images/LOGO.png" alt=""> -->
</div> </div>
</div> </div>
@ -30,7 +26,10 @@
</div> </div>
</div> </div>
<div class="right" v-if="!useUserStore.token"> <div class="right" v-if="!useUserStore.token">
<div class="registered gradient" @click="$router.push('/login?registered=true')"> <div
class="registered gradient"
@click="$router.push('/login?registered=true')"
>
注册 注册
</div> </div>
<div class="login" @click="$router.push('/login')">登录</div> <div class="login" @click="$router.push('/login')">登录</div>
@ -40,7 +39,7 @@
<img <img
:src="setImageUrl(useUserStore.userInfo.avatar)" :src="setImageUrl(useUserStore.userInfo.avatar)"
alt="" alt=""
v-default-image="defaultUserAvater"
/> />
</div> </div>
<el-dropdown style="width: 0.625rem"> <el-dropdown style="width: 0.625rem">
@ -67,11 +66,13 @@
<script lang="ts" setup> <script lang="ts" setup>
import { constRouter } from '@/router/module/constRouter' import { constRouter } from '@/router/module/constRouter'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { onMounted, ref } from 'vue' import { onMounted, ref, watch } from 'vue'
import userStore from '@/store/module/user' import userStore from '@/store/module/user'
import settingStore from '@/store/module/setting'
import Item from './components/item.vue' import Item from './components/item.vue'
import { getLogo } from '@/api/setting' import defaultUserAvater from '@/assets/images/default.png'
const useUserStore = userStore() const useUserStore = userStore()
const useSettingStore = settingStore()
const $router = useRouter() const $router = useRouter()
const $route = useRoute() const $route = useRoute()
const flog = ref(false) const flog = ref(false)
@ -89,17 +90,24 @@ const layout = async () => {
$router.push('/login') $router.push('/login')
} }
const setImageUrl = (url: string) => { const setImageUrl = (url: string) => {
return import.meta.env.VITE_APP_BASE_API + '/sys/common/static/' + url return import.meta.env.VITE_APP_BASE_API + '/' + url
} }
// logo // logo
const logoUrl = ref<string>('') const logoUrl = ref<string>('')
const getLogoSetting = async () => { const getLogoSetting = async () => {
const res: any = await getLogo() setTimeout(() => {
console.log(res, 'res') console.log(useSettingStore.logo, 'useSettingStore.logo')
logoUrl.value = res.result.logo logoUrl.value = setImageUrl(useSettingStore.logo)
}, 100)
} }
getLogoSetting() watch(
() => useSettingStore.logo,
() => {
getLogoSetting()
},
)
// getLogoSetting()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -6,10 +6,16 @@ export const getColumnListApi = () => {
}) })
} }
//根据栏目id获取新闻列表 //根据栏目id获取新闻列表
export function queryEssayListApi(columnId) { export function queryEssayListApi(columnId:any) {
return request.get(`/cms/front/getArticleListByColumn?columnId=${columnId}`) return request.get(`/cms/front/getArticleListByColumn?columnId=${columnId}`)
} }
//根据点击的新闻id获取新闻详细信息 //根据点击的新闻id获取新闻详细信息
export function queryEssayApi(id) { export function queryEssayApi(id:any) {
return request.get(`/cms/front/getByArticleTitle?id=${id}`) return request.get(`/cms/front/getByArticleTitle?id=${id}`)
} }
// 获取新闻列表
export const getNewsListApi = () => {
return request({
url: '/cms/cmsArticle/getColumArt',
})
}

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

@ -0,0 +1,19 @@
import { defineStore } from 'pinia'
import { getLogo } from '@/api/setting'
const settingStore = defineStore('setting', {
state: () => ({
logo: '',
}),
actions: {
setLogo() {
getLogo().then((res: any) => {
console.log(res, 'this.logo')
this.logo = res.result.logo
document.querySelector("link[rel~='icon']").href = import.meta.env.VITE_APP_BASE_API + '/' + this.logo
})
},
},
})
export default settingStore

@ -43,4 +43,7 @@
color: #6da0ff !important; color: #6da0ff !important;
font-weight: 700; font-weight: 700;
opacity: .5; opacity: .5;
}
img{
width: 100%;
} }

@ -96,7 +96,7 @@
<div class="top">2024年度</div> <div class="top">2024年度</div>
<div class="center"> <div class="center">
<div class="text">{{ i.name }}</div> <div class="text">{{ i.name }}</div>
<img src="../../assets/images/编组.png" alt="" /> <img style="width: 35px;" src="../../assets/images/编组.png" alt="" />
</div> </div>
<div class="bottom"> <div class="bottom">
报名时间{{ i.starttime }} - {{ i.endtime }} 报名时间{{ i.starttime }} - {{ i.endtime }}

@ -2,24 +2,28 @@
<div class="container-1420" v-if="isLoading"> <div class="container-1420" v-if="isLoading">
<div class="banner"> <div class="banner">
<div class="title">{{ reacProjectList[0].compName }}火热报名中</div> <div class="title">{{ reacProjectList[0].compName }}火热报名中</div>
<!-- <div class="description"> <div class="description">
<div v-html="reacProjectList[0].compName"></div> <div v-html="reacProjectList[0].compInfo"></div>
</div> --> </div>
<div <div
class="application gradient" class="application gradient"
@click="toDetail(reacProjectList[0].id)" @click="toDetail(reacProjectList[0].id)"
> >
立即报名 立即报名
</div> </div>
</div> </div>
<!-- 比赛列表 --> <!-- 比赛列表 -->
<!-- 新闻列表 --> <!-- 新闻列表 -->
<div class="news-list"> <div class="news-list">
<div class="news-title"> <div class="news-title">
<div class="top">新闻资讯</div> <div class="top">
<div class="bottom">30+项目登陆后报名</div> <div>新闻资讯</div>
<div @click="router.push('/news')">
<el-icon><ArrowRightBold /></el-icon>
</div>
</div>
<!-- <div class="bottom">30+项目登陆后报名</div> -->
</div> </div>
<div class="newa-panel"> <div class="newa-panel">
<div class="tab"> <div class="tab">
@ -34,12 +38,7 @@
</div> </div>
<div class="newa-main"> <div class="newa-main">
<div class="left"> <div class="left">
<img <img src="" alt="" style="width: 100%; height: 100%" />
src=""
alt=""
style="width: 100%; height: 100%"
/>
</div> </div>
<div class="right"> <div class="right">
<div class="title">{{ newInfo.name }}</div> <div class="title">{{ newInfo.name }}</div>
@ -48,10 +47,14 @@
</div> </div>
<div class="newa-main-list"> <div class="newa-main-list">
<ul> <ul>
<li v-for="item in childrenNewList" :key="item.id"> <li v-for="item in childrenNewList" :key="item.id" @click="toNewsDetail(item.id)">
<div class="time">{{ item.createTime }}</div>
<div class="info"> <div class="info">
{{ item.info }} {{ item.columnName }}
</div>
<div class="time">{{ item.createTime }}</div>
<div class="name">
{{ item.createBy_dictText }}
</div> </div>
</li> </li>
</ul> </ul>
@ -64,6 +67,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
import { getRaceList } from '@/api/race' import { getRaceList } from '@/api/race'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@ -109,7 +113,12 @@ const toDetail = (id: number) => {
}, },
}) })
} }
const toNewsDetail = (id: number) => {
router.push({
path: '/detail/' + id,
})
}
// //
const newList = ref<any>([]) const newList = ref<any>([])
const getNewsList = async () => { const getNewsList = async () => {
@ -139,7 +148,11 @@ const toggleTab = (item: any, index: number) => {
getNewInfo(newInfo.value.id) getNewInfo(newInfo.value.id)
} }
</script> </script>
<script lang="ts">
export default {
name: 'Home', //
};
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.banner { .banner {
position: relative; position: relative;
@ -167,6 +180,12 @@ const toggleTab = (item: any, index: number) => {
font-size: 20px; font-size: 20px;
color: #666; color: #666;
margin-top: 37px; margin-top: 37px;
line-height: 32px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
} }
.application { .application {
width: 272px; width: 272px;
@ -263,6 +282,25 @@ const toggleTab = (item: any, index: number) => {
font-size: 40px; font-size: 40px;
font-weight: 600; font-weight: 600;
text-align: center; 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);
}
}
} }
.bottom { .bottom {
font-size: 16px; font-size: 16px;
@ -346,20 +384,22 @@ const toggleTab = (item: any, index: number) => {
ul { ul {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; // display: flex;
flex-wrap: wrap; // flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
// align-items: center; // align-items: center;
li { li {
width: 227px; // width: 227px;
width: 100%;
height: 65px; height: 65px;
cursor: pointer;
display: flex;
.time { .time {
position: relative;
font-size: 14px; font-size: 14px;
color: #1e2033; color: #1e2033;
padding-left: 13px; margin-left: 20px;
} }
.time::before { .info::before {
content: ' '; content: ' ';
display: block; display: block;
position: absolute; position: absolute;
@ -370,10 +410,19 @@ const toggleTab = (item: any, index: number) => {
background-color: #319245; background-color: #319245;
} }
.info { .info {
margin-top: 12px; position: relative;
font-size: 12px;
// margin-top: 12px;
font-size: 14px;
color: #1e2033; color: #1e2033;
line-height: 18px; // line-height: 18px;
padding-left: 13px;
}
.name{
font-size: 14px;
margin-left: 20px;
} }
} }
} }

@ -49,7 +49,7 @@ const completeImageUrl = computed(() => {
width: 60%; width: 60%;
margin: auto; margin: auto;
height: 98vh; height: 98vh;
overflow-y: scroll; /* overflow-y: scroll; */
padding: 0; padding: 0;
display: block; display: block;
margin-top: 100px; margin-top: 100px;

@ -1,183 +1,161 @@
<template> <template>
<div class="main"> <div class="container">
<el-tabs <div class="news-list">
v-model="activeName" <div class="item" v-for="(item,index) in newsList" :key="item.id">
style="max-width: 70%; margin: auto" <div class="news-title" :id="index.toString()">{{ item.name }}</div>
class="container" <div class="children">
@tab-click="handleTabClick" <div class="son-item" v-for="obj in item.cmsArticleList" :key="obj.id" @click="toNewsDetail(obj.id)">
> <div class="left">
<el-tab-pane <div class="title">{{ obj.title }}</div>
v-for="category in categories" <div class="content">
:key="category.id" {{ obj.info }}
:label="category.name"
:name="category.id"
>
<ul>
<li
v-for="newsItem in getNewsItemsForCategory(category)"
:key="newsItem.id"
>
<div class="box-list" @click.stop="handleNewsClick(newsItem)">
<div class="left-box-list">
<p class="list-title">{{ newsItem.title }}</p>
<p class="list-summary">
{{ stripHtmlTags(newsItem.summary) }}
</p>
<p class="list-time">{{ newsItem.date }}</p>
</div> </div>
<img <div class="time"><div>{{ obj.publishTime }}</div> <div style="margin-left: 20px;">发布人{{ obj.createBy }}</div></div>
class="news-image"
:src="newsItem.imageUrl"
alt="News Image"
/>
</div> </div>
<el-divider /> <div class="right">
</li> <img :src="setImageUrl(obj.comimg)" alt="" v-default-image/>
</ul> </div>
</el-tab-pane> </div>
</el-tabs> <el-empty description="无新闻" v-if="item.cmsArticleList.length === 0" style="height: 200px;"/>
</div>
</div>
</div>
<!-- 右侧栏目 -->
</div>
<div class="right-coulom">
<div :class="active === index ? 'item active' : 'item' " @click="scrollById(index)" v-for="(item,index) in columnList" :key="item">{{ item }}</div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { getColumnListApi, queryEssayListApi } from '@/api/news' import { getNewsListApi } from '@/api/news'
let categories = ref([])
let newsItems = ref({})
let activeName = ref('')
const router = useRouter()
//使html
function stripHtmlTags(html) {
return html.replace(/<[^>]*>/g, '')
}
//
const fetchColumnList = async () => {
const response = await getColumnListApi()
if (response.success && response.result) {
categories.value = response.result.filter(
(category) => category.isShow === '1',
)
//
if (categories.value.length > 0) {
await fetchNewsList(categories.value[0].id)
activeName.value = categories.value[0].id
}
}
}
// const router = useRouter()
const fetchNewsList = async (categoryId) => { const newsList = ref<any>([])
try { const columnList = ref<any>([])
const response = await queryEssayListApi(categoryId) const active = ref(0)
// console.log(response.success,'') const getNewsListApiEvent = async () => {
// console.log(response.result.records,'') const res:any = await getNewsListApi()
if (response.success && response.result.records) { console.log(res, '212121')
newsItems.value[categoryId] = response.result.records.map((data) => ({ columnList.value = res.result.map(item => item.name)
id: data.id, newsList.value = res.result
title: data.title, }
date: data.publishTime, getNewsListApiEvent()
summary: data.content, const scrollById = (index: number) => {
imageUrl: data.comimg ? getAbsoluteImagePath(data.comimg) : '', active.value = index
})) const targetPosition = (document.getElementById(index.toString()) as HTMLElement).offsetTop - 120;
} window.scrollTo({
} catch (error) { top: targetPosition,
console.error('获取新闻列表失败', error) behavior: 'smooth', //
} });
} }
const toNewsDetail = (id: number) => {
//
const getAbsoluteImagePath = (relativePath) => {
const baseImageUrl = 'https://localhost:18085/jeecg-boot/' //
return baseImageUrl + relativePath
}
//
const getNewsItemsForCategory = (category) => {
return newsItems.value[category.id] || []
}
//
onMounted(() => {
fetchColumnList()
})
//
const handleTabClick = async (tab) => {
const categoryId = tab.props.name
if (!newsItems.value[categoryId]?.length) {
await fetchNewsList(categoryId)
}
activeName.value = categoryId
}
//
const handleNewsClick = (newsItem) => {
router.push({ router.push({
name: 'newsDetail', path: '/detail/' + id
params: { id: newsItem.id.toString() },
}) })
} }
</script> const setImageUrl = (url: string) => {
<style scoped> return import.meta.env.VITE_APP_BASE_API + '/sys/common/static/' + url
.main {
margin-top: 100px;
} }
</script>
<style scoped lang="scss">
.container { .container {
width: 1200px;
margin: auto; margin: auto;
height: 98vh; margin-top: 100px;
overflow-y: scroll; .news-list {
padding: 0; width: 100%;
display: block; // height: 900px;
} // background-color: #f2f3f5;
.container::-webkit-scrollbar { padding: 15px;
width: 0; border: 1px solid #f2f3f5;
} border-radius: 5px;
.box-list { .item {
display: flex; .news-title {
width: 95%; font-size: 24px;
height: 100px; font-weight: 700;
margin-left: 30px; }
margin-bottom: 10px; .children {
align-items: center; margin: 20px 0;
cursor: pointer; /* 默认鼠标指针形状 */ .son-item {
} width: 100%;
.box-list:hover { height: 100px;
background-color: lightgrey; /* 鼠标悬停时改变背景颜色 */ background-color: #fff;
} padding: 15px;
.left-box-list { display: flex;
display: flex; border-bottom: 1px solid rgba(228, 230, 235, 0.5);
flex-direction: column; justify-content: space-between;
justify-content: space-between; cursor: pointer;
flex: 1; .left {
padding-right: 10px; width: 1000px;
} .title {
.list-title { font-size: 18px;
font-size: 22px; font-weight: 700;
margin-left: 60px; color: #4f5153;
} }
.list-summary { .content {
font-size: 16px; margin-top: 8px;
margin-left: 60px; font-size: 13px;
margin-top: 15px; color: #8a919f;
color: #999999; display: -webkit-box;
display: -webkit-box; -webkit-line-clamp: 1;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 1; overflow: hidden;
overflow: hidden; }
text-overflow: ellipsis; /* 溢出部分显示为省略号 */ .time {
max-width: calc(100% - 130px); /* 减去右侧图片宽度和内边距 */ margin-top: 8px;
} font-size: 12px;
.list-time { color: #8a919f;
margin-left: 60px; display: flex;
margin-top: 20px; }
color: #999999; }
.right {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
img {
width: 100%;
height: 100%;
}
}
&:hover {
background-color: #f7f8fa;
}
}
}
}
}
} }
.news-image { .right-coulom {
width: 100px; position: fixed;
height: 80px; left: 200px;
margin-right: 30px; top: 100px;
z-index: 999;
width: 150px;
// height: 300px;
background-color: #f2f3f5;
padding: 10px;
border-radius: 5px;
.item {
height: 45px;
// text-align: center;
line-height: 22px;
font-size: 16px;
padding: 10px;
border-radius: 5px;
cursor: pointer;
margin: 5px 0;
&:hover {
background-color: #0bd7c628;
color: #0bd7c6;
}
}
.active {
background-color: #0bd7c628;
color: #0bd7c6;
}
} }
</style> </style>

@ -1,6 +1,5 @@
<template> <template>
<div class="container-1420 container"> <div class="container-1420 container">
<el-card v-if="reacProjectList.length === 0"> <el-card v-if="reacProjectList.length === 0">
<div <div
style=" style="
@ -21,15 +20,18 @@
<div class="left-info"> <div class="left-info">
<el-card> <el-card>
<template #header> <template #header>
<el-breadcrumb> <div style="display: flex;justify-content: space-between;">
<el-breadcrumb-item <el-breadcrumb>
v-for="item in Route.matched" <el-breadcrumb-item
:key="item.path" v-for="item in Route.matched"
:to="{ path: item.path }" :key="item.path"
> :to="{ path: item.path }"
{{ item.meta.title }} >
</el-breadcrumb-item> {{ item.meta.title }}
</el-breadcrumb> </el-breadcrumb-item>
</el-breadcrumb>
<div><el-button @click="scrollToPosition">查看详情</el-button></div>
</div>
</template> </template>
<div> <div>
<!-- {{ raceInfo }} --> <!-- {{ raceInfo }} -->
@ -51,11 +53,11 @@
<div class="label">比赛名称:</div> <div class="label">比赛名称:</div>
<div class="text">{{ raceInfo.compName }}</div> <div class="text">{{ raceInfo.compName }}</div>
</li> </li>
<li style="width: 40%;"> <li style="width: 40%">
<div class="label" >负责人:</div> <div class="label">负责人:</div>
<div class="text">{{ raceInfo.createBy }}</div> <div class="text">{{ raceInfo.createBy }}</div>
</li> </li>
<li style="width: 60%;"> <li style="width: 60%">
<div class="label">负责部门:</div> <div class="label">负责部门:</div>
<div class="text">{{ raceInfo.comporderc }}</div> <div class="text">{{ raceInfo.comporderc }}</div>
</li> </li>
@ -77,6 +79,7 @@
<div class="center"> <div class="center">
<div class="label">比赛简介:</div> <div class="label">比赛简介:</div>
<div class="deaceiption"> <div class="deaceiption">
<!-- <div v-html="raceInfo.compDetail"></div> -->
{{ raceInfo.compInfo }} {{ raceInfo.compInfo }}
<!-- 亲爱的同学们老师们以及各位编程爱好者们 <!-- 亲爱的同学们老师们以及各位编程爱好者们
在这个充满创新与挑战的时代一场精彩纷呈的大学生编程大赛即将拉开帷幕 在这个充满创新与挑战的时代一场精彩纷呈的大学生编程大赛即将拉开帷幕
@ -88,7 +91,13 @@
</div> </div>
<div class="label">附件:</div> <div class="label">附件:</div>
<div class="file"> <div class="file">
<el-tag v-for="item in fileList" :key="item" type="primary" @click="doLoadFile(item)" style="margin-right: 15px;"> <el-tag
v-for="item in fileList"
:key="item"
type="primary"
@click="doLoadFile(item)"
style="margin-right: 15px"
>
{{ item }} {{ item }}
</el-tag> </el-tag>
</div> </div>
@ -121,10 +130,11 @@
</el-card> </el-card>
</div> </div>
</div> </div>
<!-- 年度比赛列表 --> <!-- 年度比赛列表 -->
<div style="margin-top: 30px;font-size: 24px;font-weight: 600;">年度比赛列表:</div> <div style="margin-top: 30px; font-size: 24px; font-weight: 600">
年度比赛列表:
</div>
<div class="race-list"> <div class="race-list">
<div <div
class="item" class="item"
v-for="item in reacProjectList" v-for="item in reacProjectList"
@ -132,21 +142,25 @@
@click="goToCompetition(item.id)" @click="goToCompetition(item.id)"
> >
<div class="image"> <div class="image">
<img <img :src="setImageUrl(item.image)" alt="" v-default-image/>
:src="setImageUrl(item.image)"
alt=""
/>
</div> </div>
<div class="reac-info"> <div class="reac-info">
<div class="niandu">{{item.annualname}}年度</div> <div class="niandu">{{ item.annualname }}年度</div>
<div class="reac-title" style="font-weight: 600;color: #000;font-size: 16px;">{{ item.name }}</div> <div
class="reac-title"
style="font-weight: 600; color: #000; font-size: 16px"
>
{{ item.name }}
</div>
<div class="reac-title">负责部门{{ item.compOrgan }}</div> <div class="reac-title">负责部门{{ item.compOrgan }}</div>
<!-- <div class="reac-project">{{ item.introduction }}</div> --> <!-- <div class="reac-project">{{ item.introduction }}</div> -->
<div class="time" style="display: flex;justify-content: space-between;"> <div
<div> 开始时间:{{ item.starttime }} </div> class="time"
结束时间:{{ item.endtime }} style="display: flex; justify-content: space-between"
<div></div> >
<div>开始时间:{{ item.starttime }}</div>
结束时间:{{ item.endtime }}
<div></div>
</div> </div>
<!-- <div class="time"> <!-- <div class="time">
@ -154,6 +168,13 @@
</div> </div>
</div> </div>
</div> </div>
<h3
style="margin-top: 20px; font-size: 24px; font-weight: 700"
id="introduction"
>
比赛详情
</h3>
<div class="race-description" v-html="raceInfo.compDetail"></div>
</div> </div>
</template> </template>
@ -196,7 +217,7 @@ getraceInfoEvent()
// //
const goToCompetition = (id: any) => { const goToCompetition = (id: any) => {
Router.push({ path: '/competition', query: { id ,raceId:Route.query.id } }) Router.push({ path: '/competition', query: { id, raceId: Route.query.id } })
} }
const doLoadFile = (url: any) => { const doLoadFile = (url: any) => {
@ -215,13 +236,20 @@ getHistoryRaceListEvent()
const fileList = ref<any>([]) const fileList = ref<any>([])
const createfileLink = (url: any) => { const createfileLink = (url: any) => {
console.log(url); console.log(url)
const list = url.split(",") const list = url.split(',')
console.log(list); console.log(list)
fileList.value = list fileList.value = list
} }
const scrollToPosition = () => {
const targetPosition = (document.getElementById('introduction')as HTMLElement).offsetTop - 100;
window.scrollTo({
top: targetPosition,
behavior: 'smooth', //
});
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -284,7 +312,7 @@ const createfileLink = (url: any) => {
color: #8c8b8b; color: #8c8b8b;
margin-top: 30px; margin-top: 30px;
} }
.niandu{ .niandu {
color: #1e2033; color: #1e2033;
font-size: 18px; font-size: 18px;
margin-top: 20px; margin-top: 20px;
@ -434,9 +462,25 @@ const createfileLink = (url: any) => {
} }
} }
} }
.race-description {
width: 100%;
font-size: 14px;
line-height: 22px;
border: 1px solid #ccc;
padding: 10px;
margin-top: 20px;
p {
img {
width: 100%;
}
}
}
} }
:deep(.el-card) { :deep(.el-card) {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
img {
width: 100%;
}
</style> </style>

Loading…
Cancel
Save