parent
f4fbb304d3
commit
b2aaaebce7
13 changed files with 604 additions and 56 deletions
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,371 @@ |
|||||||
|
<template> |
||||||
|
<div class="wrap"> |
||||||
|
<div class="banner"> |
||||||
|
IASF的最新新闻、公告、活动 |
||||||
|
</div> |
||||||
|
<div class="column-wrap"> |
||||||
|
<div class="article"> |
||||||
|
<div class="left"> |
||||||
|
<div class="forms"> |
||||||
|
<div class="item"> |
||||||
|
<span class="label">文章类型:</span> |
||||||
|
<el-select v-model="form.typeId"> |
||||||
|
<el-option |
||||||
|
v-for="item in labels" |
||||||
|
:key="item.id" |
||||||
|
:label="item.name" |
||||||
|
:value="item.id"> |
||||||
|
</el-option> |
||||||
|
</el-select> |
||||||
|
</div> |
||||||
|
<div class="item"> |
||||||
|
<span class="label">主题:</span> |
||||||
|
<el-select v-model="form.labelId"> |
||||||
|
<el-option |
||||||
|
v-for="item in labels" |
||||||
|
:key="item.id" |
||||||
|
:label="item.name" |
||||||
|
:value="item.id"> |
||||||
|
</el-option> |
||||||
|
</el-select> |
||||||
|
</div> |
||||||
|
<div class="search"> |
||||||
|
<input type="text" placeholder="请输入搜索内容" v-model="form.title"> |
||||||
|
<i class="icon"> |
||||||
|
<img src="@/assets/images/search-white.png" alt=""> |
||||||
|
</i> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="contents"> |
||||||
|
<ul class="columns"> |
||||||
|
<li v-for="(item, i) in columns" :key="i" :class="{active: i === curColumn}" @click="toArticle(i)">{{ item.columnName }}</li> |
||||||
|
</ul> |
||||||
|
<div style="width: 1113px"> |
||||||
|
<ul class="articles"> |
||||||
|
<li v-for="(item, i) in articles" :key="i"> |
||||||
|
<div class="texts"> |
||||||
|
<p class="type">新闻类型</p> |
||||||
|
<h6>{{ item.title }}</h6> |
||||||
|
<span class="meta">{{ item.releaseTime }} | 建设进展</span> |
||||||
|
</div> |
||||||
|
<img class="pic" :src="item.titleImg" alt=""> |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
<div v-if="articles.length" class="pagination"> |
||||||
|
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="right"> |
||||||
|
<el-tree class="column" ref="column" :data="columns" highlight-current :expand-on-click-node="false" :props="defaultProps" node-key="id" ></el-tree> |
||||||
|
|
||||||
|
<p class="l-title">热点内容</p> |
||||||
|
<ul class="list"> |
||||||
|
<li> |
||||||
|
<p class="text">喜报 | 深圳粒子研究院荣获全国科研…</p> |
||||||
|
<span class="date">2022-08-09</span> |
||||||
|
</li> |
||||||
|
<li> |
||||||
|
<p class="text">喜报 | 深圳粒子研究院荣获全国科研…</p> |
||||||
|
<span class="date">2022-08-09</span> |
||||||
|
</li> |
||||||
|
<li> |
||||||
|
<p class="text">喜报 | 深圳粒子研究院荣获全国科研…</p> |
||||||
|
<span class="date">2022-08-09</span> |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
|
||||||
|
<p class="l-title">最新资讯</p> |
||||||
|
<ul class="list"> |
||||||
|
<li v-for="(item, i) in news" :key="i"> |
||||||
|
<p class="text">{{ item.title }}</p> |
||||||
|
<span class="date">{{ item.createTime }}</span> |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Setting from '@/setting' |
||||||
|
import Util from '@/libs/util' |
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
id: this.$route.query.id, |
||||||
|
columnId: '', |
||||||
|
searchTimer: null, |
||||||
|
form: { |
||||||
|
title: '' |
||||||
|
}, |
||||||
|
labels: {}, |
||||||
|
columns: [], |
||||||
|
curColumn: 0, |
||||||
|
page: 1, |
||||||
|
pageSize: 10, |
||||||
|
total: 0, |
||||||
|
articles: [], |
||||||
|
defaultProps: { |
||||||
|
value: 'id', |
||||||
|
label: 'columnName' |
||||||
|
}, |
||||||
|
news: [] |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
'$route'() { |
||||||
|
this.id = this.$route.query.id |
||||||
|
this.getInfo() |
||||||
|
}, |
||||||
|
'form.title': function(val) { |
||||||
|
clearTimeout(this.searchTimer) |
||||||
|
this.searchTimer = setTimeout(() => { |
||||||
|
this.initData() |
||||||
|
}, 500) |
||||||
|
} |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.getColumn() |
||||||
|
this.getNews() |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
// 获取banner 规则:当前文章有上传的,用上传的,没有上传的栏目有图片,读取上级栏目的(上级没有读上上级,以此类推)都没有的读取默认的 |
||||||
|
getBanner(data) { |
||||||
|
this.columnBanner = '' |
||||||
|
for (const e of data) { |
||||||
|
if (e.columnBanner) this.columnBanner = e.columnBanner |
||||||
|
if (e.id == this.columnId) { |
||||||
|
break |
||||||
|
} else { |
||||||
|
this.getBanner(e.children) |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
// 资讯 |
||||||
|
getColumn() { |
||||||
|
this.$post(this.api.listWithTree, { |
||||||
|
siteId: 1, |
||||||
|
columnName: '', |
||||||
|
templateId: '', |
||||||
|
typeId : '', |
||||||
|
isSort: 0 |
||||||
|
}).then(({ data }) => { |
||||||
|
this.columns = data |
||||||
|
this.initData() |
||||||
|
}).catch(err => {}) |
||||||
|
}, |
||||||
|
// 最新资讯 |
||||||
|
getNews() { |
||||||
|
this.$post(this.api.newlyPublishedArticles, { |
||||||
|
pageNum: 1, |
||||||
|
pageSize: 5, |
||||||
|
siteId: 1 |
||||||
|
}).then(({ data }) => { |
||||||
|
this.news = data.records |
||||||
|
}).catch(res => {}) |
||||||
|
}, |
||||||
|
// 查询文章列表 |
||||||
|
toArticle(i) { |
||||||
|
this.curColumn = i |
||||||
|
this.initData() |
||||||
|
}, |
||||||
|
// 查询文章列表 |
||||||
|
getArticle() { |
||||||
|
this.$post(this.api.queryArticle, { |
||||||
|
siteId: 1, |
||||||
|
columnIds: [this.columns[this.curColumn].id], |
||||||
|
pageNum: this.page, |
||||||
|
pageSize: this.pageSize, |
||||||
|
...this.form |
||||||
|
}).then(({ data }) => { |
||||||
|
this.articles = data.records |
||||||
|
this.total = +data.total |
||||||
|
}).catch(res => {}) |
||||||
|
}, |
||||||
|
initData() { |
||||||
|
this.page = 1 |
||||||
|
this.getArticle() |
||||||
|
}, |
||||||
|
currentChange(val) { |
||||||
|
this.page = val |
||||||
|
this.getData() |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped> |
||||||
|
.banner { |
||||||
|
height: 280px; |
||||||
|
padding: 123px 0 0 243px; |
||||||
|
font-size: 48px; |
||||||
|
color: #fff; |
||||||
|
background: url(../../assets/images/intro-bg.png) 0 0/100% 100% no-repeat; |
||||||
|
} |
||||||
|
.column-wrap { |
||||||
|
padding: 40px 0; |
||||||
|
background: #F9FAFA url(../../assets/images/column-bg.png) no-repeat; |
||||||
|
} |
||||||
|
.article { |
||||||
|
display: flex; |
||||||
|
justify-content: space-between; |
||||||
|
width: 1666px; |
||||||
|
margin: 0 auto; |
||||||
|
.left { |
||||||
|
width: 1295px; |
||||||
|
} |
||||||
|
.forms { |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
padding: 30px; |
||||||
|
background-color: #fff; |
||||||
|
.item { |
||||||
|
display: inline-flex; |
||||||
|
align-items: center; |
||||||
|
margin-right: 30px; |
||||||
|
} |
||||||
|
.label { |
||||||
|
font-size: 16px; |
||||||
|
color: #333; |
||||||
|
} |
||||||
|
/deep/.el-input__inner { |
||||||
|
width: 238px; |
||||||
|
height: 48px; |
||||||
|
line-height: 48px; |
||||||
|
border: 0; |
||||||
|
background: #F7F7F7; |
||||||
|
} |
||||||
|
.search { |
||||||
|
display: inline-flex; |
||||||
|
input { |
||||||
|
width: 443px; |
||||||
|
height: 48px; |
||||||
|
padding: 0 10px; |
||||||
|
font-size: 14px; |
||||||
|
color: #333; |
||||||
|
background: #F7F7F7; |
||||||
|
border: 0; |
||||||
|
border-top-left-radius: 6px; |
||||||
|
border-bottom-left-radius: 6px; |
||||||
|
&:focus { |
||||||
|
outline: none; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.icon { |
||||||
|
display: inline-flex; |
||||||
|
justify-content: center; |
||||||
|
align-items: center; |
||||||
|
width: 62px; |
||||||
|
height: 48px; |
||||||
|
background: #1583FF; |
||||||
|
border-radius: 0px 6px 6px 0px; |
||||||
|
cursor: pointer; |
||||||
|
} |
||||||
|
} |
||||||
|
.contents { |
||||||
|
display: flex; |
||||||
|
margin-top: 20px; |
||||||
|
} |
||||||
|
.columns { |
||||||
|
width: 174px; |
||||||
|
margin-right: 12px; |
||||||
|
li { |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
height: 48px; |
||||||
|
padding-left: 24px; |
||||||
|
margin-bottom: 1px; |
||||||
|
font-size: 16px; |
||||||
|
color: #666; |
||||||
|
background-color: #fff; |
||||||
|
border-right: 2px solid transparent; |
||||||
|
cursor: pointer; |
||||||
|
&:before { |
||||||
|
content: ''; |
||||||
|
width: 2px; |
||||||
|
height: 2px; |
||||||
|
margin-right: 5px; |
||||||
|
background-color: #666; |
||||||
|
border-radius: 50%; |
||||||
|
} |
||||||
|
&:hover { |
||||||
|
color: #0c84eb; |
||||||
|
} |
||||||
|
&.active { |
||||||
|
border-right-color: #083A93; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.articles { |
||||||
|
li { |
||||||
|
display: flex; |
||||||
|
justify-content: space-between; |
||||||
|
align-items: center; |
||||||
|
margin-bottom: 20px; |
||||||
|
background-color: #fff; |
||||||
|
} |
||||||
|
.texts { |
||||||
|
max-width: 620px; |
||||||
|
padding-left: 30px; |
||||||
|
} |
||||||
|
.type { |
||||||
|
font-size: 18px; |
||||||
|
color: #333; |
||||||
|
} |
||||||
|
h6 { |
||||||
|
margin: 15px 0; |
||||||
|
font-size: 24px; |
||||||
|
color: #000; |
||||||
|
line-height: 38px; |
||||||
|
@include mul-ellipsis(2); |
||||||
|
} |
||||||
|
.meta { |
||||||
|
font-size: 16px; |
||||||
|
color: #666; |
||||||
|
} |
||||||
|
img { |
||||||
|
width: 417px; |
||||||
|
height: 244px; |
||||||
|
} |
||||||
|
} |
||||||
|
.right { |
||||||
|
width: 324px; |
||||||
|
} |
||||||
|
.column { |
||||||
|
width: 100%; |
||||||
|
margin-bottom: 25px; |
||||||
|
} |
||||||
|
/deep/.el-tree-node__content { |
||||||
|
height: 60px; |
||||||
|
background-color: #E5EDF8; |
||||||
|
border-bottom: 2px solid #fff; |
||||||
|
} |
||||||
|
/deep/.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content { |
||||||
|
color: #fff; |
||||||
|
background-color: #0f5698; |
||||||
|
} |
||||||
|
.list { |
||||||
|
margin-bottom: 20px; |
||||||
|
li { |
||||||
|
padding: 16px 0; |
||||||
|
border-bottom: 1px solid #D8D8D8; |
||||||
|
} |
||||||
|
.text { |
||||||
|
margin-bottom: 5px; |
||||||
|
font-size: 14px; |
||||||
|
cursor: pointer; |
||||||
|
&:hover { |
||||||
|
color: $main-color; |
||||||
|
} |
||||||
|
} |
||||||
|
.date { |
||||||
|
font-size: 12px; |
||||||
|
color: #999; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,110 @@ |
|||||||
|
<template> |
||||||
|
<div class="wrap"> |
||||||
|
<el-carousel height="480px" :interval="6000" :arrow="(modules[0] && modules[0].list.length > 1) ? 'hover' : 'never'"> |
||||||
|
<template v-for="(item, i) in modules[0].list"> |
||||||
|
<el-carousel-item v-if="item.pic && item.isEnable" :key="i"> |
||||||
|
<div class="banner-item" @click="openLink(item)"> |
||||||
|
<img :src="item.pic" alt=""> |
||||||
|
<p class="banner-name">NEWS & EVENTS</p> |
||||||
|
</div> |
||||||
|
</el-carousel-item> |
||||||
|
</template> |
||||||
|
</el-carousel> |
||||||
|
|
||||||
|
<div class="block"> |
||||||
|
<div class="inner"> |
||||||
|
<ul class="list"> |
||||||
|
<template v-for="(item, i) in modules[1].list"> |
||||||
|
<li v-if="item.isEnable" :key="i"> |
||||||
|
<img class="pic" :src="item.pic" alt=""> |
||||||
|
<div class="texts"> |
||||||
|
<h6>{{ item.title }}</h6> |
||||||
|
<p class="sub">{{ item.subTitle }}</p> |
||||||
|
<div class="des">{{ item.des }}</div> |
||||||
|
<img class="arrow" src="@/assets/images/arrow.png" alt="" @click="openLink(item)"> |
||||||
|
</div> |
||||||
|
</li> |
||||||
|
</template> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import mixins from '@/mixins/page' |
||||||
|
import Setting from '@/setting' |
||||||
|
import Util from '@/libs/util' |
||||||
|
export default { |
||||||
|
mixins: [mixins], |
||||||
|
data() { |
||||||
|
return { |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
|
||||||
|
}, |
||||||
|
methods: { |
||||||
|
// 获取文章详情 |
||||||
|
getInfo() { |
||||||
|
// 预览/详情 |
||||||
|
this.$post(`${this.api[this.preview ? 'getRedisCache' : 'findPage']}?columnId=${this.id}`).then(({ data }) => { |
||||||
|
if (data.length) { |
||||||
|
// state:已发布(1)则取theEditedJson,草稿(0)则取jsonBeforeEditing |
||||||
|
const json = JSON.parse(this.preview ? |
||||||
|
data : |
||||||
|
data[0][data[0].state ? 'theEditedJson' : 'jsonBeforeEditing']) |
||||||
|
this.modules = json |
||||||
|
console.log("🚀 ~ file: index.vue ~ line 180 ~ this.$post ~ json", json) |
||||||
|
} |
||||||
|
}).catch(err => {}) |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" scoped> |
||||||
|
@import "../../styles/page/page.scss"; |
||||||
|
.list { |
||||||
|
li { |
||||||
|
position: relative; |
||||||
|
&:nth-child(even) { |
||||||
|
text-align: right; |
||||||
|
.texts { |
||||||
|
left: 0; |
||||||
|
text-align: left; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.pic { |
||||||
|
width: 650px; |
||||||
|
height: 730px; |
||||||
|
} |
||||||
|
.texts { |
||||||
|
position: absolute; |
||||||
|
top: 120px; |
||||||
|
left: 610px; |
||||||
|
width: 850px; |
||||||
|
height: 440px; |
||||||
|
padding: 60px 30px 30px 100px; |
||||||
|
background: rgba(247, 247, 247, .72); |
||||||
|
} |
||||||
|
h6 { |
||||||
|
font-size: 40px; |
||||||
|
color: #3C3C3C; |
||||||
|
} |
||||||
|
.sub { |
||||||
|
margin: 20px 0; |
||||||
|
font-size: 24px; |
||||||
|
color: #1C1C1C; |
||||||
|
line-height: 33px; |
||||||
|
} |
||||||
|
.des { |
||||||
|
margin-bottom: 20px; |
||||||
|
font-size: 20px; |
||||||
|
color: #3C3C3C; |
||||||
|
line-height: 32px; |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,14 @@ |
|||||||
|
import BasicLayout from '@/layouts/home' |
||||||
|
const name = 'column' |
||||||
|
export default { |
||||||
|
path: `/${name}`, |
||||||
|
component: BasicLayout, |
||||||
|
children: [ |
||||||
|
{ |
||||||
|
name, |
||||||
|
path: `/${name}`, |
||||||
|
component: () => import(`@/pages/${name}`), |
||||||
|
meta: { title: '' } |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
@ -0,0 +1,14 @@ |
|||||||
|
import BasicLayout from '@/layouts/home' |
||||||
|
const name = 'newsProcurement' |
||||||
|
export default { |
||||||
|
path: `/${name}`, |
||||||
|
component: BasicLayout, |
||||||
|
children: [ |
||||||
|
{ |
||||||
|
name, |
||||||
|
path: `/${name}`, |
||||||
|
component: () => import(`@/pages/${name}`), |
||||||
|
meta: { title: '' } |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
Loading…
Reference in new issue