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.
508 lines
14 KiB
508 lines
14 KiB
<template> |
|
<div class="wrap"> |
|
<el-carousel height="480px" :interval="6000" :arrow="(modules[0] && modules[0].list.filter(e => e.isEnable).length > 1) ? 'hover' : 'never'" :indicator-position="modules[0].list.filter(e => e.isEnable).length > 1 ? '' : 'none'"> |
|
<template v-for="(item, i) in modules[0].list"> |
|
<el-carousel-item v-if="item.pic && item.isEnable" :key="i"> |
|
<div :class="['banner-item', {'cursor-pointer': item.link.linkName !== '无'}]" @click="openLink(item)"> |
|
<img :src="item.pic" alt=""> |
|
<p class="banner-name">{{ item.title }}</p> |
|
</div> |
|
</el-carousel-item> |
|
</template> |
|
</el-carousel> |
|
|
|
<ul class="tabs"> |
|
<template v-for="(item, i) in modules[1].list"> |
|
<li v-if="item.columnName" :class="{active: i == curColumn}" :key="i" @click="tabChange(i)">{{ item.columnName }}</li> |
|
</template> |
|
</ul> |
|
|
|
<div class="block"> |
|
<div class="inner" v-if="modules[1].list[this.curColumn].articles.length"> |
|
<div class="banner"> |
|
<img width="50%" height="480" :src="modules[1].list[this.curColumn].articles[0].titleImg" alt=""> |
|
<div class="right"> |
|
<h6>{{ modules[1].list[this.curColumn].articles[0].title }}</h6> |
|
<div class="des" v-html="modules[1].list[this.curColumn].articles[0].mainBody"></div> |
|
<p class="meta">{{ modules[1].list[this.curColumn].articles[0].createTime }} {{ modules[1].list[this.curColumn].articles[0].author && ' | ' + modules[1].list[this.curColumn].articles[0].author }}</p> |
|
</div> |
|
</div> |
|
<ul class="card"> |
|
<template v-for="(item, i) in modules[1].list[this.curColumn].articles"> |
|
<li v-if="i" :key="i"> |
|
<img class="pic" :src="item.titleImg" alt=""> |
|
<div class="texts"> |
|
<p class="meta">{{ item.createTime }} {{ item.author && ' | ' + item.author }}</p> |
|
<div class="des">{{ item.title }}</div> |
|
<img class="arrow" src="@/assets/images/arrow.png" alt="" @click="toArtice(item)"> |
|
</div> |
|
</li> |
|
</template> |
|
</ul> |
|
<div class="more">More news ></div> |
|
</div> |
|
</div> |
|
|
|
<div class="block gray"> |
|
<div class="inner lg"> |
|
<h2 class="b-title">{{ modules[2].form.title }}</h2> |
|
<p class="intro">{{ modules[2].form.des }}</p> |
|
<div class="shop-shows" v-if="articles.length"> |
|
<div class="left"> |
|
<img width="100%" height="400" :src="articles[0].titleImg" alt=""> |
|
<div class="texts"> |
|
<h6>{{ articles[0].title }}</h6> |
|
<div class="des" v-html="articles[0].mainBody"></div> |
|
</div> |
|
</div> |
|
<div class="right"> |
|
<ul class="show-card"> |
|
<li v-if="articles[1]" @click="toArtice(articles[1])"> |
|
<img class="pic" :src="articles[1].titleImg" alt=""> |
|
<div class="des">{{ articles[1].title }}</div> |
|
</li> |
|
<li v-if="articles[2]" @click="toArtice(articles[2])"> |
|
<img class="pic" :src="articles[2].titleImg" alt=""> |
|
<div class="des">{{ articles[2].title }}</div> |
|
</li> |
|
</ul> |
|
<ul class="card-list"> |
|
<template v-for="(item, i) in articles"> |
|
<li v-if="i > 2" :key="i"> |
|
<img class="pic" :src="item.titleImg" alt=""> |
|
<div class="texts"> |
|
<h6>{{ item.title }}</h6> |
|
<div class="des" v-html="item.mainBody"></div> |
|
</div> |
|
<img class="arrow" src="@/assets/images/arrow.png" alt="" @click="toArtice(item)"> |
|
</li> |
|
</template> |
|
</ul> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="block conference"> |
|
<div class="inner lg"> |
|
<h2 class="b-title">{{ modules[4].form.title }}</h2> |
|
<p class="intro">{{ modules[4].form.des }}</p> |
|
<div class="shows" v-if="articles1.length"> |
|
<div class="left"> |
|
<img width="100%" height="558" :src="articles1[0].titleImg" alt=""> |
|
<div class="texts"> |
|
<div class="meta"> |
|
<p class="date">09</p> |
|
<p class="year">2022-03</p> |
|
</div> |
|
<div> |
|
<h6>{{ articles1[0].title }}</h6> |
|
<div class="des" v-html="articles1[0].mainBody"></div> |
|
</div> |
|
</div> |
|
</div> |
|
<ul class="card-list"> |
|
<template v-for="(item, i) in articles1"> |
|
<li v-if="i" :key="i" @click="toArtice(item)"> |
|
<img class="pic" :src="item.titleImg" alt=""> |
|
<div class="texts"> |
|
<h6>{{ item.title }}</h6> |
|
<p v-if="item.author" class="text"> |
|
<i class="el-icon-user icon"></i> |
|
{{ item.author }} |
|
</p> |
|
<p class="text"> |
|
<i class="el-icon-alarm-clock icon"></i> |
|
Time: {{ item.createTime }} |
|
</p> |
|
<!-- <p class="text"> |
|
<i class="el-icon-user icon"></i> |
|
Address: Big conference room on the fourth floor of headquarters |
|
</p> --> |
|
</div> |
|
</li> |
|
</template> |
|
</ul> |
|
</div> |
|
</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 { |
|
curColumn: 0, |
|
articles: [], |
|
articles1: [] |
|
} |
|
}, |
|
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[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing']) |
|
console.log("🚀 ~ file: index.vue ~ line 138 ~ this.$post ~ this.modules", json) |
|
|
|
// 获取文章列表 |
|
const { list } = json[1] |
|
if (list.length) { |
|
list.map(e => { |
|
if (e.site && e.column.length) { |
|
const id = e.column[e.column.length - 1] |
|
e.id = id |
|
if (e.columnTitle === 2) e.columnName = e.columnTitleCustom |
|
this.$post(this.api.queryArticle, { |
|
siteId: e.site, |
|
columnIds: [id], |
|
pageNum: 1, |
|
pageSize: e.articleNum || 4 |
|
}).then(({ data }) => { |
|
this.$set(e, 'articles', data.records) |
|
}).catch(err => {}) |
|
} else { |
|
this.$set(e, 'articles', []) |
|
} |
|
}) |
|
} |
|
|
|
if (json[3].form.column.length) { |
|
const { column, site, articleNum } = json[3].form |
|
this.$post(this.api.queryArticle, { |
|
siteId: site, |
|
columnIds: [column[column.length - 1]], |
|
pageNum: 1, |
|
pageSize: articleNum || 6 |
|
}).then(({ data }) => { |
|
this.articles = data.records |
|
}).catch(err => {}) |
|
} |
|
if (json[5].form.column.length) { |
|
const { column, site, articleNum } = json[5].form |
|
this.$post(this.api.queryArticle, { |
|
siteId: site, |
|
columnIds: [column[column.length - 1]], |
|
pageNum: 1, |
|
pageSize: articleNum || 5 |
|
}).then(({ data }) => { |
|
this.articles1 = data.records |
|
}).catch(err => {}) |
|
} |
|
|
|
this.modules = json |
|
} |
|
}).catch(err => {}) |
|
}, |
|
// tab回调 |
|
tabChange(i) { |
|
const { column } = this.modules[1].list[i] |
|
if (column && column.length) { |
|
const id = column[column.length - 1] |
|
// 查询栏目详情 |
|
this.$post(`${this.api.findColumn}?id=${id}`).then(({ data }) => { |
|
const { typeId } = data |
|
// 跳转链接 |
|
if (typeId === 2) { |
|
let href = data.linkAddress |
|
const cType = data.connectionType |
|
if (cType !== 2) { // 非站外链接 |
|
const ids = href.split('-') // 栏目文章是用-分割的,栏目是必选,文章不是必选。选择了文章则跳转到文章页,否则跳转到栏目页 |
|
// 站点id:站内链接取当前站点,其他站点链接取siteSelection |
|
const site = cType === 1 ? |
|
(this.$route.query.siteId || this.site) : |
|
data.siteSelection |
|
if (ids[1]) { // 文章 |
|
href = '/article?id=' + ids[1] |
|
} else { // 栏目 |
|
const columnIds = ids[0].split(',') |
|
href = '/column?id=' + columnIds[columnIds.length - 1] |
|
} |
|
href = this.$router.resolve(href + '&siteId=' + site).href |
|
} |
|
// 是否新窗口打开 |
|
if (data.isOpen) { |
|
window.open(href) |
|
} else { |
|
location.href = href |
|
} |
|
} else if (typeId === 3) { |
|
// 长页栏目直接获取path |
|
this.$router.push(`/${data.path}?id=${id}`).catch(err => {}) |
|
} else { |
|
this.curColumn = i |
|
} |
|
}).catch(err => {}) |
|
} else { |
|
this.curColumn = i |
|
} |
|
} |
|
} |
|
}; |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
@import "../../styles/page/page.scss"; |
|
.tabs { |
|
display: flex; |
|
justify-content: center; |
|
box-shadow: 0px 2px 14px 0px rgba(167,167,167,0.26); |
|
li { |
|
padding: 25px 19px; |
|
margin: 0 10px; |
|
font-size: 22px; |
|
color: #333; |
|
border-bottom: 4px solid transparent; |
|
text-shadow: 0px 2px 14px rgba(167,167,167,0.26); |
|
cursor: pointer; |
|
&.active { |
|
color: #1583FF; |
|
border-bottom-color: #1583FF; |
|
} |
|
} |
|
} |
|
.banner { |
|
display: flex; |
|
cursor: pointer; |
|
.pic { |
|
width: 700px; |
|
height: 380px; |
|
} |
|
.right { |
|
width: 50%; |
|
padding: 50px 50px 30px; |
|
background: #1583FF; |
|
color: #fff; |
|
} |
|
h6 { |
|
font-size: 24px; |
|
} |
|
.des { |
|
margin: 30px 0; |
|
font-size: 16px; |
|
line-height: 24px; |
|
} |
|
.meta { |
|
font-size: 16px; |
|
} |
|
} |
|
.card { |
|
display: flex; |
|
flex-wrap: wrap; |
|
margin-top: 40px; |
|
li { |
|
width: 438px; |
|
margin-right: 28px; |
|
box-shadow: 0px 0px 20px 0px rgba(176,176,176,0.21); |
|
border-radius: 6px; |
|
&:last-child { |
|
margin-right: 0; |
|
} |
|
} |
|
.pic { |
|
width: 100%; |
|
height: 240px; |
|
} |
|
.texts { |
|
padding: 40px 30px; |
|
} |
|
.meta { |
|
font-size: 16px; |
|
color: #666; |
|
} |
|
.des { |
|
margin: 10px 0; |
|
font-size: 20px; |
|
color: #333; |
|
line-height: 28px; |
|
} |
|
.arrow { |
|
width: 36px; |
|
} |
|
} |
|
.more { |
|
width: 374px; |
|
margin: 58px auto 0; |
|
line-height: 64px; |
|
font-size: 30px; |
|
text-align: center; |
|
color: #1583FF; |
|
border-radius: 35px; |
|
border: 2px solid #2B6CEF; |
|
cursor: pointer; |
|
} |
|
.shop-shows { |
|
display: flex; |
|
.left { |
|
width: 660px; |
|
margin-right: 20px; |
|
background-color: #fff; |
|
.texts { |
|
padding: 40px 30px; |
|
} |
|
h6 { |
|
font-size: 24px; |
|
color: #272727; |
|
} |
|
.des { |
|
margin-top: 10px; |
|
font-size: 16px; |
|
color: #666; |
|
line-height: 30px; |
|
} |
|
} |
|
.right { |
|
width: 824px; |
|
} |
|
.show-card { |
|
display: flex; |
|
margin-bottom: 20px; |
|
li { |
|
position: relative; |
|
&:first-child { |
|
margin-right: 22px; |
|
} |
|
} |
|
.pic { |
|
width: 401px; |
|
height: 197px; |
|
} |
|
.des { |
|
position: absolute; |
|
bottom: 0; |
|
left: 0; |
|
width: 100%; |
|
font-size: 16px; |
|
color: #fff; |
|
line-height: 48px; |
|
text-align: center; |
|
background: rgba(0,0,0,0.49); |
|
box-shadow: 0px 0px 30px 0px rgba(48,48,48,0.08); |
|
} |
|
} |
|
.card-list { |
|
padding: 34px 26px; |
|
background-color: #fff; |
|
li { |
|
display: inline-flex; |
|
align-items: center; |
|
padding-right: 124px; |
|
margin-bottom: 38px; |
|
cursor: pointer; |
|
&:last-child { |
|
margin-bottom: 0; |
|
} |
|
} |
|
.pic { |
|
width: 116px; |
|
height: 85px; |
|
margin-right: 28px; |
|
} |
|
.texts { |
|
width: 504px; |
|
margin-right: 60px; |
|
} |
|
h6 { |
|
font-size: 20px; |
|
color: #272727; |
|
} |
|
.des { |
|
margin-top: 15px; |
|
font-size: 14px; |
|
color: #666; |
|
line-height: 24px; |
|
} |
|
.arrow { |
|
width: 36px; |
|
} |
|
} |
|
} |
|
.conference { |
|
background: #072947; |
|
.b-title, .intro { |
|
color: #fff; |
|
} |
|
.shows { |
|
display: flex; |
|
} |
|
.left { |
|
width: 688px; |
|
margin-right: 20px; |
|
background-color: #fff; |
|
.texts { |
|
display: flex; |
|
padding: 40px 30px; |
|
} |
|
.meta { |
|
padding: 10px 23px 10px 0; |
|
margin-right: 32px; |
|
text-align: center; |
|
border-right: 1px solid #ddd; |
|
} |
|
.date { |
|
font-size: 45px; |
|
font-family: DINAlternate-Bold, DINAlternate; |
|
font-weight: bold; |
|
color: #1F1F1F; |
|
line-height: 52px; |
|
} |
|
.year { |
|
font-size: 16px; |
|
white-space: nowrap; |
|
color: #666; |
|
} |
|
h6 { |
|
font-size: 20px; |
|
color: #272727; |
|
} |
|
.des { |
|
margin-top: 10px; |
|
font-size: 14px; |
|
color: #666; |
|
line-height: 24px; |
|
} |
|
} |
|
.card-list { |
|
width: 784px; |
|
li { |
|
display: flex; |
|
padding: 24px; |
|
margin-bottom: 13px; |
|
background-color: #fff; |
|
cursor: pointer; |
|
} |
|
.pic { |
|
width: 188px; |
|
height: 130px; |
|
margin-right: 28px; |
|
} |
|
h6 { |
|
margin-bottom: 10px; |
|
font-size: 20px; |
|
color: #333; |
|
} |
|
.text { |
|
display: flex; |
|
align-items: center; |
|
margin: 10px 0; |
|
} |
|
.icon { |
|
width: 15px; |
|
margin-right: 5px; |
|
color: #1583FF; |
|
} |
|
} |
|
} |
|
</style> |