123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528 |
- <template>
- <div id="index">
- <el-row>
- <el-col :span="24" class="main animate__animated animate__backInRight">
- <el-col :span="24" class="home">
- <el-image class="image" :src="home" fit="fill" />
- </el-col>
- <div class="w_1200" v-loading="loading">
- <el-row :gutter="20">
- <el-col :span="18" class="oneLeft">
- <el-col :span="24" class="one">
- <el-col :span="24" class="one_1">
- <el-col :span="12" class="left">政策信息</el-col>
- <el-col :span="12" class="right" @click="selectMenu('brain')"
- >查看政策信息</el-col
- >
- </el-col>
- <el-col :span="24" class="one_2">
- <el-col
- :span="24"
- class="list"
- v-for="(item, index) in newsList"
- :key="index"
- @click="toView(item, '0')"
- >
- <el-col :span="2" class="left">
- <div class="year" v-if="item.time">
- {{ moment(item.time).format('YYYY') }}
- </div>
- <div class="date" v-if="item.time">
- {{ moment(item.time).format('MM-DD') }}
- </div>
- </el-col>
- <el-col :span="22" class="right">
- <el-col :span="24" class="name textOver">
- <el-tooltip effect="dark" :content="item.title" placement="top">
- {{ item.title || '暂无标题' }}
- </el-tooltip>
- </el-col>
- <el-col :span="24" class="content">
- <div v-html="removeHtmlStyle(item.content)"></div>
- </el-col>
- </el-col>
- </el-col>
- </el-col>
- </el-col>
- <el-col :span="24" class="one">
- <el-col :span="24" class="one_1">
- <el-col :span="12" class="left">新闻通知</el-col>
- <el-col :span="12" class="right" @click="selectMenu('brain')"
- >查看新闻通知</el-col
- >
- </el-col>
- <el-col :span="24" class="one_2">
- <el-col
- :span="24"
- class="list"
- v-for="(item, index) in newsList"
- :key="index"
- @click="toView(item, '0')"
- >
- <el-col :span="2" class="left">
- <div class="year" v-if="item.time">
- {{ moment(item.time).format('YYYY') }}
- </div>
- <div class="date" v-if="item.time">
- {{ moment(item.time).format('MM-DD') }}
- </div>
- </el-col>
- <el-col :span="22" class="right">
- <el-col :span="24" class="name textOver">
- <el-tooltip effect="dark" :content="item.title" placement="top">
- {{ item.title || '暂无标题' }}
- </el-tooltip>
- </el-col>
- <el-col :span="24" class="content">
- <div v-html="removeHtmlStyle(item.content)"></div>
- </el-col>
- </el-col>
- </el-col>
- </el-col>
- </el-col>
- <el-col :span="24" class="one">
- <el-col :span="24" class="one_1">
- <el-col :span="12" class="left">工作动态</el-col>
- <el-col :span="12" class="right" @click="selectMenu('brain')"
- >查看工作动态</el-col
- >
- </el-col>
- <el-col :span="24" class="one_2">
- <el-col
- :span="24"
- class="list"
- v-for="(item, index) in newsList"
- :key="index"
- @click="toView(item, '0')"
- >
- <el-col :span="2" class="left">
- <div class="year" v-if="item.time">
- {{ moment(item.time).format('YYYY') }}
- </div>
- <div class="date" v-if="item.time">
- {{ moment(item.time).format('MM-DD') }}
- </div>
- </el-col>
- <el-col :span="22" class="right">
- <el-col :span="24" class="name textOver">
- <el-tooltip effect="dark" :content="item.title" placement="top">
- {{ item.title || '暂无标题' }}
- </el-tooltip>
- </el-col>
- <el-col :span="24" class="content">
- <div v-html="removeHtmlStyle(item.content)"></div>
- </el-col>
- </el-col>
- </el-col>
- </el-col>
- </el-col>
- </el-col>
- <el-col :span="6" class="oneRight">
- <el-col :span="24" class="carousel">
- <a-carousel autoplay>
- <el-image
- v-for="(item, index) in carouselList"
- :key="index"
- class="image"
- :src="item.url"
- fit="fill"
- />
- </a-carousel>
- </el-col>
- <el-col :span="24" class="title">
- <el-col :span="16" class="left">赛事推广 </el-col>
- <el-col :span="8" class="right" @click="toMore"> 查看更多</el-col>
- </el-col>
- <el-col :span="24" class="content">
- <el-col
- :span="24"
- v-for="(item, index) in matchList"
- :key="index"
- @click="toView(item, '1')"
- class="list"
- >
- <el-image
- v-if="item.file && item.file.length > 0"
- class="image"
- :src="getUrl(item.file)"
- fit="cover"
- />
- <el-image v-else class="image" :src="match" fit="fill" />
- <div class="name">
- {{ item.name }}
- </div>
- </el-col>
- </el-col>
- </el-col>
- </el-row>
- <el-row :gutter="20" class="type">
- <el-col :span="8" class="list" v-for="(item, index) in typeList" :key="index">
- <div class="list_1">
- <div class="title">{{ item.title }}</div>
- </div>
- <div
- class="list_2"
- v-for="(tag, indexx) in item.list"
- :key="indexx"
- @click="toLink(tag)"
- >
- {{ tag.name }}
- </div>
- </el-col>
- </el-row>
- </div>
- </el-col>
- </el-row>
- </div>
- </template>
- <script setup>
- import moment from 'moment'
- const selectMenu = inject('selectMenu')
- // 图片引入
- import home from '/images/home.jpg'
- import match from '/images/match.jpg'
- import match1 from '/images/match_1.jpg'
- import match2 from '/images/match_2.jpg'
- import match3 from '/images/match_3.jpg'
- import match4 from '/images/match_4.jpg'
- // 接口
- import { NewsStore } from '@/store/api/platform/news'
- import { MatchStore } from '@/store/api/platform/match'
- const newsStore = NewsStore()
- const matchStore = MatchStore()
- // 路由
- const router = useRouter()
- // 加载中
- const loading = ref(false)
- // 新闻
- const newsList = ref([])
- // 比赛
- const matchList = ref([])
- // 分类
- const typeList = ref([
- {
- title: '热门高校',
- list: [
- { name: '吉林省人民政府', href: 'https://www.jl.gov.cn/' },
- { name: '长春市人民政府', href: 'http://www.changchun.gov.cn/' },
- { name: '吉林省工信厅', href: 'http://gxt.jl.gov.cn/' },
- { name: '吉林省国资委', href: 'http://gzw.jl.gov.cn/' },
- { name: '吉林省财政厅', href: 'http://czt.jl.gov.cn/' },
- { name: '吉林省金融监管局', href: 'http://jr.jl.gov.cn/' }
- ]
- },
- {
- title: '政府部门',
- list: [
- { name: '吉林省人民政府', href: 'https://www.jl.gov.cn/' },
- { name: '长春市人民政府', href: 'http://www.changchun.gov.cn/' },
- { name: '吉林省工信厅', href: 'http://gxt.jl.gov.cn/' },
- { name: '吉林省国资委', href: 'http://gzw.jl.gov.cn/' },
- { name: '吉林省财政厅', href: 'http://czt.jl.gov.cn/' },
- { name: '吉林省金融监管局', href: 'http://jr.jl.gov.cn/' }
- ]
- },
- {
- title: '科研机构',
- list: [
- { name: '吉林省人民政府', href: 'https://www.jl.gov.cn/' },
- { name: '长春市人民政府', href: 'http://www.changchun.gov.cn/' },
- { name: '吉林省工信厅', href: 'http://gxt.jl.gov.cn/' },
- { name: '吉林省国资委', href: 'http://gzw.jl.gov.cn/' },
- { name: '吉林省财政厅', href: 'http://czt.jl.gov.cn/' },
- { name: '吉林省金融监管局', href: 'http://jr.jl.gov.cn/' }
- ]
- }
- ])
- const carouselList = ref([{ url: match1 }, { url: match2 }, { url: match3 }, { url: match4 }])
- // 请求
- onMounted(async () => {
- loading.value = true
- await searchNews()
- await searchMatch()
- loading.value = false
- })
- const searchNews = async () => {
- const info = {
- skip: 0,
- limit: 4,
- is_use: '0',
- status: '1'
- }
- const res = await newsStore.query(info)
- if (res.errcode == '0') newsList.value = res.data
- }
- const searchMatch = async () => {
- const info = {
- skip: 0,
- limit: 6,
- is_use: '0',
- status: '1'
- }
- const res = await matchStore.query(info)
- if (res.errcode == '0') matchList.value = res.data
- }
- // 查看详情
- const toView = (item, type) => {
- if (type == '0') router.push({ path: '/news/detail', query: { id: item.id || item._id } })
- else router.push({ path: '/innovation/detail', query: { id: item.id || item._id } })
- }
- const removeHtmlStyle = (html) => {
- let relStyle = /style\s*?=\s*?([‘"])[\s\S]*?\1/g //去除样式
- let relTag = /<.+?>/g //去除标签
- let relClass = /class\s*?=\s*?([‘"])[\s\S]*?\1/g // 清除类名
- let newHtml = ''
- if (html) {
- newHtml = html.replace(relStyle, '')
- newHtml = newHtml.replace(relTag, '')
- newHtml = newHtml.replace(relClass, '')
- }
- return newHtml
- }
- const toLink = (item) => {
- window.open(item.href, '_blank') // 在新标签页中打开URL
- }
- const getUrl = (item) => {
- if (item) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
- }
- // 查看更多
- const toMore = () => {
- router.push({ path: `/five` })
- }
- </script>
- <style scoped lang="scss">
- .main {
- .home {
- position: relative;
- .image {
- width: 100%;
- height: 200px;
- }
- }
- .one {
- padding: 25px 0;
- .one_1 {
- display: flex;
- justify-content: space-between;
- margin: 0 0 10px 0;
- .left {
- font-size: $global-font-size-26;
- font-family:
- PingFangSC-Semibold,
- PingFang SC;
- font-weight: 600;
- color: #111;
- line-height: 33px;
- }
- .right {
- text-align: right;
- font-size: $global-font-size-18;
- font-family:
- PingFangSC-Regular,
- PingFang SC;
- font-weight: 400;
- color: #2280ff;
- line-height: $global-font-size-16;
- display: block;
- margin-top: 13px;
- margin-right: 34px;
- }
- .right:hover {
- cursor: pointer;
- }
- }
- .one_2 {
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- .list {
- display: flex;
- align-items: center;
- padding: 15px;
- transition: all 0.3s;
- border-bottom: #9d9898 1px dashed;
- .left {
- font-family: PingFangSC-Regular;
- font-size: $global-font-size-14;
- color: #2374ff;
- line-height: $global-font-size-14;
- padding: 0 !important;
- .year {
- margin-bottom: 2px;
- }
- .date {
- font-size: $global-font-size-24;
- line-height: $global-font-size-24;
- margin-bottom: 10px;
- }
- }
- .right {
- padding: 0 !important;
- .name {
- font-family: PingFangSC-Medium;
- font-size: $global-font-size-18;
- color: #121834;
- line-height: $global-font-size-18;
- font-weight: 700;
- margin-bottom: 8px;
- }
- .content {
- font-size: $global-font-size-14;
- color: #525a68;
- line-height: 19px;
- font-weight: 400;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- overflow: hidden;
- text-overflow: ellipsis;
- margin-top: 8px;
- }
- }
- }
- .list:hover {
- background: #f0f7ff;
- box-shadow: 0 0 16px rgba(205, 205, 205, 0.6);
- cursor: pointer;
- }
- }
- }
- .oneRight {
- padding: 25px 0 0 0 !important;
- .carousel {
- padding: 0 !important;
- margin: 0 0 10px 0;
- border-radius: 4px;
- :deep(.slick-slide) {
- text-align: center;
- height: 220px;
- background: #364d79;
- overflow: hidden;
- border-radius: 4px;
- }
- .image {
- width: 100%;
- height: 100%;
- border-radius: 4px;
- }
- }
- .title {
- padding: 0 !important;
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: linear-gradient(90deg, #d7e8ff, #fff);
- width: 300px;
- height: 64px;
- padding-left: 21px;
- box-sizing: border-box;
- margin-bottom: 7px;
- .left {
- font-size: $global-font-size-22;
- font-family:
- PingFangSC-Medium,
- PingFang SC;
- font-weight: 500;
- color: #111;
- line-height: $global-font-size-20;
- }
- .right {
- text-align: right;
- font-size: $global-font-size-16;
- font-family:
- PingFangSC-Regular,
- PingFang SC;
- font-weight: 400;
- color: #666;
- cursor: pointer;
- }
- }
- .content {
- padding: 0 !important;
- margin: 10px 0 0 0;
- .list {
- padding: 0 !important;
- background: #eff4f9;
- width: 100%;
- margin: 0 0 10px 0;
- border-radius: 4px;
- .image {
- width: 100%;
- height: 150px;
- border-radius: 4px 4px 0 0;
- }
- .name {
- padding: 10px;
- font-size: $global-font-size-18;
- font-family:
- PingFangSC-Medium,
- PingFang SC;
- font-weight: 500;
- color: #111;
- }
- }
- }
- }
- .type {
- margin: 10px 0;
- .list {
- .list_1 {
- margin: 0 0 20px 0;
- .title {
- font-size: $global-font-size-20;
- font-weight: 600;
- text-align: center;
- color: #252f49;
- }
- .title::before {
- content: '';
- position: absolute;
- transform: translateY(-50%);
- top: 12px;
- margin-left: -100px;
- width: 80px;
- height: 1px;
- border-bottom: 1px #252f49 solid;
- }
- .title::after {
- content: '';
- position: absolute;
- transform: translateY(-50%);
- top: 12px;
- margin-left: 30px;
- width: 80px;
- height: 1px;
- border-bottom: 1px #252f49 solid;
- }
- }
- .list_2 {
- font-size: $global-font-size-18;
- margin: 8px;
- padding: 5px;
- text-align: center;
- border: 1px #ebe2e2 solid;
- border-radius: 4px;
- }
- .list_2:hover {
- background: #2280ff;
- color: #ffffff;
- }
- }
- }
- }
- </style>
|