粒子研究院前台前端
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.
 
 
 
 

811 lines
22 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': isLink(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 wow fadeInLeft" ref="tabs">
<template v-for="(item, i) in modules[1].list">
<li v-if="item.columnName" :class="{active: i == curColumn}" :key="i" @click="tabChange($event,i)">{{ item.columnName }}</li>
</template>
</ul>
<div class="block">
<div class="inner" v-if="modules[1].list[curColumn].articles && modules[1].list[curColumn].articles.length">
<div class="news-banner wow fadeInDown" data-wow-delay="0.5s" @click="toArtice(curArticle, modules[1].list[curColumn])">
<img width="50%" height="410" :src="curArticle.titleImg" alt="" onerror="javascript:this.src='./images/3.png';">
<div class="right">
<h6>{{ curArticle.title }}</h6>
<div class="des" v-html="curArticle.mainBody"></div>
<p class="meta">{{ curArticle.releaseTime }} {{ curArticle.author && ' | ' + curArticle.author }}</p>
<ul class="inds">
<li v-for="i in modules[1].list[curColumn].articles.length > 2 ? 3 : modules[1].list[curColumn].articles.length" :key="i" :class="{active: curInd == i - 1}" @click.stop="switchCarousel(i - 1)"></li>
</ul>
</div>
</div>
<ul class="card">
<template v-for="(item, i) in modules[1].list[curColumn].articles">
<li v-if="i > 2" :key="i" class="wow fadeInDown" :data-wow-delay="(0.1 * i).toFixed(1) + 's'">
<img class="pic" :src="item.titleImg" alt="">
<div class="texts">
<p class="meta">{{ item.releaseTime }} {{ item.author && ' | ' + item.author }}</p>
<div class="des">{{ item.title }}</div>
<img class="arrow" src="@/assets/images/arrow.png" alt="" @click="toArtice(item, modules[1].list[curColumn])">
</div>
</li>
</template>
</ul>
<div class="more wow fadeInDown" data-wow-delay="0.5s" @click="toMore">More news ></div>
</div>
</div>
<div class="block gray">
<div class="inner lg">
<h2 class="b-title wow fadeInUp">{{ modules[2].form.title }}</h2>
<p class="intro wow fadeInUp" data-wow-delay="0.5s">{{ modules[2].form.des }}</p>
<div class="shop-shows" v-if="articles.length">
<div class="left wow fadeInLeft" data-wow-delay="0.5s" @click="toArtice(articles[0], modules[3].form)">
<img class="pic" width="100%" height="400" :src="articles[0].titleImg" alt="" onerror="javascript:this.src='./images/2.png';">
<div class="texts">
<h6>{{ articles[0].title }}</h6>
<div class="des" v-html="articles[0].mainBody"></div>
</div>
</div>
<div v-if="articles.length > 1" class="right wow fadeInRight" data-wow-delay="0.5s">
<ul class="show-card">
<li v-if="articles[1]" @click="toArtice(articles[1], modules[3].form)">
<img class="pic" :src="articles[1].titleImg" alt="">
<div class="text">{{ articles[1].title }}</div>
</li>
<li v-if="articles[2]" @click="toArtice(articles[2], modules[3].form)">
<img class="pic" :src="articles[2].titleImg" alt="">
<div class="text">{{ 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, modules[3].form)">
</li>
</template>
</ul>
</div>
</div>
<div class="all-link m-t-10" @click="toAll(modules[3].form)">
<span>{{$t('column.all')}} <img class="icon" src="@/assets/images/arrow.png" alt=""></span>
</div>
</div>
</div>
<div class="block conference">
<div class="inner lg">
<h2 class="b-title wow fadeInUp">{{ modules[4].form.title }}</h2>
<p class="intro wow fadeInUp" data-wow-delay="0.5s">{{ modules[4].form.des }}</p>
<div class="shows" v-if="articles1.length">
<div class="left wow fadeInLeft" data-wow-delay="0.5s" @click="toArtice(articles1[0], modules[5].form)">
<img class="pic" width="100%" height="558" :src="articles1[0].titleImg" alt="" onerror="javascript:this.src='./images/1.png';">
<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 wow fadeInRight" data-wow-delay="0.5s">
<template v-for="(item, i) in articles1">
<li v-if="i" :key="i" @click="toArtice(item, modules[5].form)">
<img class="pic" :src="item.titleImg" alt="">
<div class="texts">
<h6>{{ item.title }}</h6>
<p v-if="item.keynoteSpeaker" class="text">
<img class="icon" src="@/assets/images/mine.png" alt="">
{{ item.keynoteSpeaker }}
</p>
<p v-if="item.activityStartTime" class="text">
<img class="icon" src="@/assets/images/time.png" alt="">
Time: {{ item.activityStartTime + ' ~ ' + item.activityEndTime }}
</p>
<p v-if="item.onlineLocation" class="text">
<img class="icon" src="@/assets/images/online.png" alt="">
Onlone: {{ item.onlineLocation }}
</p>
<p v-if="item.offlineLocation" class="text">
<img class="icon" src="@/assets/images/location.png" alt="">
Address: {{ item.offlineLocation }}
</p>
</div>
</li>
</template>
</ul>
</div>
<div class="all-link m-t-10" @click="toAll(modules[5].form)">
<span style="color: #fff">{{$t('column.all')}} <img class="icon" src="@/assets/images/arrow.png" alt=""></span>
</div>
</div>
</div>
</div>
</template>
<script>
import mixins from '@/mixins/page'
import Setting from '@/setting'
import Util from '@/libs/util'
import WOW from 'wow.js'
export default {
mixins: [mixins],
data() {
return {
curColumn: 0,
articles: [],
articles1: [],
curInd: 0,
curArticle: {},
timer: null
}
},
mounted() {
new WOW().init()
},
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, i) => {
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.queryArticlesByColumnType}?columnId=${id}`).then(({ data }) => {
const list = Util.removeTag(data.slice(0, e.articleNum || 6))
this.$set(e, 'articles', list)
if (list.length && !i) this.curArticle = list[0]
}).catch(err => {})
} else {
this.$set(e, 'articles', [])
}
})
}
if (json[3].form.column.length) {
const { column, site, articleNum } = json[3].form
this.$post(`${this.api.queryArticlesByColumnType}?columnId=${column[column.length - 1]}`).then(({ data }) => {
this.articles = Util.removeTag(data.slice(0, articleNum || 6))
}).catch(err => {})
}
if (json[5].form.column.length) {
const { column, site, articleNum } = json[5].form
this.$post(`${this.api.queryArticlesByColumnType}?columnId=${column[column.length - 1]}`).then(({ data }) => {
this.articles1 = Util.removeTag(data.slice(0, articleNum || 5))
}).catch(err => {})
}
this.modules = json
console.log(this.modules)
this.carouselInterval()
}
}).catch(err => {})
},
// 自动轮播
carouselInterval() {
clearInterval(this.timer)
this.timer = setInterval(() => {
this.curInd++
if (this.curInd > 2) this.curInd = 0
this.curArticle = this.modules[1].list[this.curColumn].articles[this.curInd] || {}
}, 5000)
},
// 手动轮播切换
switchCarousel(i) {
if (this.curInd !== i) {
this.curInd = i
this.curArticle = this.modules[1].list[this.curColumn].articles[i] || {}
}
},
// tab回调
tabChange(e,i) {
const tabs = this.$refs.tabs
tabs.scrollLeft = e.target.offsetLeft
// e.target.offsetLeft
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.curInd = 0
this.curColumn = i
this.curArticle = this.modules[1].list[i].articles[0] || {}
this.carouselInterval()
}
}).catch(err => {})
} else {
this.curColumn = i
}
},
// 跳转more
toMore() {
const { column } = this.modules[1].list[this.curColumn]
column.length && this.$router.push(`/column?id=${column[column.length - 1]}`)
}
}
};
</script>
<style lang="scss" scoped>
@import url(../../plugins/wow/animate.css);
@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;
}
}
}
.lg {
width: 1505px;
}
/deep/.articles {
width: 50%;
.el-carousel__indicators--horizontal {
bottom: 20px;
left: 804px;
}
}
.news-banner {
display: flex;
cursor: pointer;
.pic {
width: 700px;
height: 380px;
}
.right {
position: relative;
width: 50%;
padding: 50px 50px 30px;
background: #1583FF;
color: #fff;
&:hover {
background: #465f85;
h6, .des, .meta {
color: #fff;
transform: translateY(15px);
}
}
}
.inds {
position: absolute;
bottom: 40px;
left: 60px;
display: flex;
li {
width: 10px;
height: 10px;
margin-right: 12px;
background: #FFFFFF;
border-radius: 50%;
transition: .2s;
&.active {
width: 30px;
background: rgba(255,255,255,0.3);
border-radius: 5px;
}
}
}
h6 {
font-size: 24px;
transition: .3s;
}
.des {
margin: 30px 0;
font-size: 16px;
line-height: 24px;
transition: .3s;
}
.meta {
font-size: 16px;
transition: .3s;
}
}
.card {
display: flex;
flex-wrap: wrap;
margin-top: 40px;
li {
width: calc((100% - 56px) / 3);
margin-right: 28px;
box-shadow: 0px 0px 20px 0px rgba(176,176,176,0.21);
border-radius: 6px;
transition: .3s;
&:hover {
transform: scale(1.05);
}
&:last-child {
margin-right: 0;
}
}
.pic {
width: 100%;
height: 240px;
}
.texts {
padding: 40px 30px;
}
.meta {
font-size: 16px;
color: #666;
}
.des {
height: 60px;
margin: 10px 0;
font-size: 20px;
font-family: SFProDisplay;
font-weight: 500;
color: #333;
line-height: 28px;
-webkit-line-clamp: 2;
}
.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;
cursor: pointer;
overflow: hidden;
.pic {
transition: .3s;
&:hover {
transform: scale(1.05);
}
}
.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;
overflow: hidden;
}
.show-card {
display: flex;
margin-bottom: 20px;
li {
position: relative;
height: 197px;
overflow: hidden;
cursor: pointer;
&:first-child {
margin-right: 22px;
}
}
.pic {
width: 401px;
height: 197px;
transition: .3s;
&:hover {
transform: scale(1.05);
}
}
.text {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
font-size: 16px;
color: #fff;
line-height: 48px;
text-align: center;
@include ellipsis;
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;
margin-bottom: 38px;
transition: .3s;
&:hover {
transform: scale(1.05);
}
&:last-child {
margin-bottom: 0;
}
}
.pic {
width: 116px;
height: 85px;
margin-right: 28px;
}
.texts {
width: 504px;
margin-right: 60px;
}
h6 {
margin-bottom: 10px;
font-size: 20px;
color: #272727;
}
.des {
font-size: 14px;
color: #666;
line-height: 24px;
text-shadow: 0px 0px 30px rgba(48,48,48,0.08);
-webkit-line-clamp: 2;
}
.arrow {
width: 36px;
}
}
}
.conference {
background: #072947;
.b-title, .intro {
color: #fff;
}
.shows {
display: flex;
}
.left {
width: 718px;
margin-right: 20px;
background-color: #fff;
overflow: hidden;
cursor: pointer;
.pic {
transition: .3s;
&:hover {
transform: scale(1.05);
}
}
.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: 754px;
li {
display: flex;
padding: 15px;
margin-bottom: 13px;
background-color: #fff;
cursor: pointer;
transition: .3s;
&:last-child {
margin-bottom: 0;
}
&:hover {
transform: translateX(20px);
}
}
.pic {
width: 188px;
height: 147px;
margin-right: 28px;
}
h6 {
margin-bottom: 10px;
font-size: 20px;
color: #333;
}
.text {
display: flex;
align-items: center;
margin: 10px 0;
&:last-child {
margin-bottom: 0;
}
}
.icon {
margin-right: 5px;
}
}
}
@media (max-width: 1520px) {
.lg {
width: 98%;
}
}
@media (max-width: 1200px) {
.tabs {
overflow-x: scroll;
display: -webkit-box;
}
.block {
padding: 50px 0 ;
.inner{
.more {
width: 100%;
margin: 20px auto 0;
}
.news-banner{
flex-direction: column;
img{
width: 100%;
}
.right {
margin-top: 10px;
width: 100%;
.inds{
left: 50%;
margin-left: -43px;
}
}
}
.card{
flex-direction: column;
.wow {
width: 95%;
margin: 20px auto;
}
}
.b-title{
font-size: 20px;
}
.intro {
font-size: 15px;
margin-bottom: 50px;
}
.shop-shows{
flex-direction: column;
.left {
width: 95%;margin: 0 auto;
}
.right {
width: 93%;
margin: 20px auto;
.show-card{
flex-direction: column;
li {
width: 100%;
.pic{
width: 100%;
}
}
}
.card-list{
li {
.texts{
margin-right: 30px;
}
}
}
}
}
}
}
}
@media (min-width: 280px) and (max-width: 750px) {
.tabs {
li {
padding: 15px 10px;
font-size: 15px;
margin: 0;
}
}
.block{
padding: 20px 0;
.inner {
width: 90%;
.news-banner{
img{
height: 350px;
}
}
.b-title{
margin-bottom: 20px;
}
.intro {
margin-bottom: 20px;
}
.shop-shows{
.left {
img{
height: 350px;
}
}
}
.show-card{
.text{
font-size: 13px;
line-height: 20px;
white-space: inherit
}
}
.card-list{
padding: 20px 10px ;
li {
width: 100%;
img{
margin-right: 10px;
}
.texts{
margin-right: 10px;
h6{
font-size: 15px;
font-weight: bold;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
text-overflow: ellipsis;
overflow: hidden;
margin-bottom: 5px;
}
}
.des {
line-height: 15px;
}
.arrow{
margin-right: 0;
}
}
}
.shows{
flex-direction: column;
.left {
width: 100%;
.pic {
height: 450px;
}
}
.card-list{
width: 100%;
padding: 20px 0;
li {
.pic {
width: 100px;
height: 120px;
}
.texts{
h6{
font-size: 15px;font-weight: bold;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
overflow: hidden;
}
.text{
margin: 2px 0;
font-size: 12px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
overflow: hidden;
}
}
}
}
}
}
}
}
</style>