|
|
|
@ -58,7 +58,7 @@ |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="contents"> |
|
|
|
|
<el-tree v-if="!isFilter && showNav" class="columns" ref="leftColumn" :data="columns" highlight-current :expand-on-click-node="false" default-expand-all :props="defaultProps" node-key="id" @node-click="columnClick"></el-tree> |
|
|
|
|
<el-tree v-if="!isFilter && showNav" class="columns" ref="leftColumn" :data="columns" highlight-current :expand-on-click-node="false" default-expand-all :props="defaultProps" node-key="id" icon-class="el-icon-arrow-down" @node-click="columnClick"></el-tree> |
|
|
|
|
|
|
|
|
|
<div style="width: 1113px"> |
|
|
|
|
<ul class="articles"> |
|
|
|
@ -92,23 +92,15 @@ |
|
|
|
|
|
|
|
|
|
<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 v-for="(item, i) in hots" :key="i" :title="item.title" @click="toArtice(item)"> |
|
|
|
|
<p class="text">{{ item.title }}</p> |
|
|
|
|
<span class="date">{{ item.createTime }}</span> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
|
|
|
|
|
<p class="l-title">最新资讯</p> |
|
|
|
|
<ul class="list"> |
|
|
|
|
<li v-for="(item, i) in news" :key="i"> |
|
|
|
|
<li v-for="(item, i) in news" :key="i" :title="item.title" @click="toArtice(item)"> |
|
|
|
|
<p class="text">{{ item.title }}</p> |
|
|
|
|
<span class="date">{{ item.createTime }}</span> |
|
|
|
|
</li> |
|
|
|
@ -125,7 +117,7 @@ import Util from '@/libs/util' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
id: this.$route.query.id, |
|
|
|
|
id: +this.$route.query.id, |
|
|
|
|
site: this.$store.state.content.site, |
|
|
|
|
columnId: '', |
|
|
|
|
info: {}, |
|
|
|
@ -167,7 +159,8 @@ export default { |
|
|
|
|
value: 'id', |
|
|
|
|
label: 'columnName' |
|
|
|
|
}, |
|
|
|
|
news: [] |
|
|
|
|
news: [], |
|
|
|
|
hots: [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -222,18 +215,13 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 左边栏目 |
|
|
|
|
getLeftColumn() { |
|
|
|
|
this.$post(`${this.api.getsTheSubColumn}?id=${this.id}`).then(({ data }) => { |
|
|
|
|
// if (data.length > 1 && !data.find(e => e.listStyleId !== data[0].listStyleId)) { |
|
|
|
|
// this.all = data[0] |
|
|
|
|
// this.getArticle(data.map(e => e.id)) |
|
|
|
|
// } else { |
|
|
|
|
// this.all = null |
|
|
|
|
// this.getArticle([data[data.length > 1 ? 1 : 0].id]) |
|
|
|
|
// // data = data.slice(1) |
|
|
|
|
// } |
|
|
|
|
data.length && this.getArticle([data[0].id]) |
|
|
|
|
this.$post(`${this.api.oneLevelChecksThemAll}?id=${this.id}`).then(({ data }) => { |
|
|
|
|
this.getArticle([+this.$route.query.id]) |
|
|
|
|
this.curColumn = 0 |
|
|
|
|
this.columns = data |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.leftColumn.setCurrentKey(this.id) |
|
|
|
|
}) |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
// 右边资讯 |
|
|
|
@ -247,6 +235,10 @@ export default { |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
this.infoColumns = data |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
|
|
|
|
|
this.$post(`${this.api.hotContent}?siteId=${this.$route.query.siteId || this.$store.state.content.site}`).then(({ data }) => { |
|
|
|
|
this.hots = data |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
// 最新资讯 |
|
|
|
|
getNews() { |
|
|
|
@ -264,9 +256,40 @@ export default { |
|
|
|
|
this.filter() |
|
|
|
|
}, |
|
|
|
|
// 点击栏目回调 |
|
|
|
|
columnClick(data) { |
|
|
|
|
columnClick(to) { |
|
|
|
|
console.log("🚀 ~ file: index.vue ~ line 268 ~ columnClick ~ data", to) |
|
|
|
|
const { typeId } = to |
|
|
|
|
// 跳转链接 |
|
|
|
|
if (typeId === 2) { |
|
|
|
|
let href = to.linkAddress |
|
|
|
|
const cType = to.connectionType |
|
|
|
|
if (cType !== 2) { // 非站外链接 |
|
|
|
|
const ids = href.split('-') // 栏目文章是用-分割的,栏目是必选,文章不是必选。选择了文章则跳转到文章页,否则跳转到栏目页 |
|
|
|
|
// 站点id:站内链接取当前站点,其他站点链接取siteSelection |
|
|
|
|
const site = cType === 1 ? |
|
|
|
|
(this.$route.query.siteId || this.site) : |
|
|
|
|
to.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 (to.isOpen) { |
|
|
|
|
window.open(href) |
|
|
|
|
} else { |
|
|
|
|
location.href = href |
|
|
|
|
} |
|
|
|
|
} else if (typeId === 3) { |
|
|
|
|
// 长页栏目直接获取path |
|
|
|
|
this.$router.push(`/${to.path}?id=${to.id}`).catch(err => {}) |
|
|
|
|
} else { |
|
|
|
|
this.page = 1 |
|
|
|
|
this.getArticle([data.id]) |
|
|
|
|
this.getArticle([to.id]) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 查询文章列表 |
|
|
|
|
getArticle(columnIds) { |
|
|
|
@ -276,7 +299,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
this.$post(this.api.newlyPublishedArticles, { |
|
|
|
|
siteId: this.$route.query.siteId || this.site, |
|
|
|
|
columnIds, |
|
|
|
|
columnIds: columnIds.length ? columnIds : [this.id], |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
labelName, |
|
|
|
@ -294,7 +317,7 @@ export default { |
|
|
|
|
getIds(data, ids) { |
|
|
|
|
data.map(e => { |
|
|
|
|
ids.push(e.id) |
|
|
|
|
this.getIds(e.children, ids) |
|
|
|
|
e.children && this.getIds(e.children, ids) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 筛选 |
|
|
|
@ -312,7 +335,14 @@ export default { |
|
|
|
|
}, |
|
|
|
|
currentChange(val) { |
|
|
|
|
this.page = val |
|
|
|
|
// this.getData() |
|
|
|
|
this.isFilter = !!(this.form.classificationId || this.form.title || this.form.convokeType || this.lableId.length) |
|
|
|
|
let id = [] |
|
|
|
|
if (this.isFilter || this.all) { |
|
|
|
|
this.getIds(this.columns, id) |
|
|
|
|
} else if (this.columns.length) { |
|
|
|
|
id = [this.$refs.leftColumn.getCurrentKey()] |
|
|
|
|
} |
|
|
|
|
this.getArticle(id) |
|
|
|
|
}, |
|
|
|
|
// 跳转文章页面 |
|
|
|
|
toArtice(item) { |
|
|
|
@ -332,6 +362,7 @@ export default { |
|
|
|
|
position: absolute; |
|
|
|
|
top: 123px; |
|
|
|
|
left: 243px; |
|
|
|
|
@include ellipsis; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.column-wrap { |
|
|
|
@ -417,37 +448,69 @@ export default { |
|
|
|
|
.contents { |
|
|
|
|
display: flex; |
|
|
|
|
} |
|
|
|
|
.columns { |
|
|
|
|
/deep/.columns { |
|
|
|
|
width: 174px; |
|
|
|
|
margin-right: 12px; |
|
|
|
|
overflow: auto; |
|
|
|
|
li { |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
&:after { |
|
|
|
|
content: ''; |
|
|
|
|
position: absolute; |
|
|
|
|
top: 0; |
|
|
|
|
right: 0; |
|
|
|
|
width: 2px; |
|
|
|
|
height: 100%; |
|
|
|
|
background-color: #E1E6F2; |
|
|
|
|
} |
|
|
|
|
.el-tree-node__content { |
|
|
|
|
// z-index: 1; |
|
|
|
|
position: relative; |
|
|
|
|
height: 48px; |
|
|
|
|
padding-left: 40px; |
|
|
|
|
margin-bottom: 1px; |
|
|
|
|
font-size: 16px; |
|
|
|
|
color: #666; |
|
|
|
|
background-color: #fff; |
|
|
|
|
border-right: 2px solid transparent; |
|
|
|
|
border-bottom: 1px solid #F8F9F9; |
|
|
|
|
cursor: pointer; |
|
|
|
|
&:before { |
|
|
|
|
content: ''; |
|
|
|
|
width: 2px; |
|
|
|
|
height: 2px; |
|
|
|
|
margin-right: 5px; |
|
|
|
|
margin: 0 10px 0 20px; |
|
|
|
|
background-color: #666; |
|
|
|
|
border-radius: 50%; |
|
|
|
|
} |
|
|
|
|
&:hover { |
|
|
|
|
color: #0c84eb; |
|
|
|
|
} |
|
|
|
|
&.active { |
|
|
|
|
border-right-color: #083A93; |
|
|
|
|
} |
|
|
|
|
&.all { |
|
|
|
|
padding-left: 24px; |
|
|
|
|
.el-tree-node__label { |
|
|
|
|
font-size: 16px; |
|
|
|
|
color: #666; |
|
|
|
|
line-height: 22px; |
|
|
|
|
} |
|
|
|
|
.el-tree-node__expand-icon.expanded { |
|
|
|
|
transform: rotate(180deg); |
|
|
|
|
} |
|
|
|
|
.el-tree-node__expand-icon { |
|
|
|
|
position: absolute; |
|
|
|
|
right: 10px; |
|
|
|
|
} |
|
|
|
|
.is-current > .el-tree-node__content { |
|
|
|
|
&:after { |
|
|
|
|
content: ''; |
|
|
|
|
z-index: 2; |
|
|
|
|
position: absolute; |
|
|
|
|
top: 0; |
|
|
|
|
right: 0; |
|
|
|
|
width: 2px; |
|
|
|
|
height: 100%; |
|
|
|
|
background-color: #083A93; |
|
|
|
|
} |
|
|
|
|
// border-right: 2px solid #083A93; |
|
|
|
|
.el-tree-node__label { |
|
|
|
|
font-weight: 600; |
|
|
|
|
color: #1150AC; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -495,7 +558,6 @@ export default { |
|
|
|
|
.column { |
|
|
|
|
width: 100%; |
|
|
|
|
margin-bottom: 25px; |
|
|
|
|
} |
|
|
|
|
/deep/.el-tree-node__content { |
|
|
|
|
height: 60px; |
|
|
|
|
background-color: #E5EDF8; |
|
|
|
@ -505,6 +567,7 @@ export default { |
|
|
|
|
color: #fff; |
|
|
|
|
background-color: #0f5698; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.list { |
|
|
|
|
margin-bottom: 20px; |
|
|
|
|
li { |
|
|
|
@ -515,6 +578,7 @@ export default { |
|
|
|
|
margin-bottom: 5px; |
|
|
|
|
font-size: 14px; |
|
|
|
|
cursor: pointer; |
|
|
|
|
@include ellipsis; |
|
|
|
|
&:hover { |
|
|
|
|
color: $main-color; |
|
|
|
|
} |
|
|
|
|