yujialong 2 years ago
parent 5298d2feaf
commit e19b6b68c3
  1. 4
      src/api/index.js
  2. 8
      src/components/menuTree/index.vue
  3. 44
      src/layouts/header/index.vue
  4. 35
      src/layouts/navbar/index.vue
  5. 4
      src/pages/about/index.vue
  6. 2
      src/pages/application/index.vue
  7. 2
      src/pages/article/index.vue
  8. 164
      src/pages/column/index.vue
  9. 6
      src/pages/news/index.vue
  10. 16
      src/styles/common.scss

@ -13,4 +13,8 @@ export default {
queryLabel: `iasf/content/label/queryAllArticleSubjectTags`, queryLabel: `iasf/content/label/queryAllArticleSubjectTags`,
getsTheSubColumn: `iasf/sysColumn/getsTheSubColumn`, getsTheSubColumn: `iasf/sysColumn/getsTheSubColumn`,
articlePreview: `iasf/sysContent/articlePreview`, articlePreview: `iasf/sysContent/articlePreview`,
getsSublevelColumnsUnderALevel: `iasf/sysColumn/getsSublevelColumnsUnderALevel`,
hotContent: `iasf/sysContent/hotContent`,
siteSearchArticles: `iasf/sysContent/siteSearchArticles`,
oneLevelChecksThemAll: `iasf/sysColumn/oneLevelChecksThemAll`,
} }

@ -1,14 +1,14 @@
<template> <template>
<div class="menu-child"> <div class="menu-child">
<template v-for="item in this.menuList"> <template v-for="item in this.menuList">
<el-submenu :key="item.id" :index="String(item.id)" v-if="item.children && item.children.length"> <el-submenu :popper-class="$route.path === '/home' ? 'home-menu-popup' : ''" :class="{active: $route.query.id == item.id}" :key="item.id" :index="String(item.id)" :id="item.id" v-if="item.children && item.children.length">
<template slot="title"> <template slot="title">
<span slot="title">{{item.columnName}}</span> <span slot="title" :id="item.id">{{item.columnName}}</span>
</template> </template>
<menuTree :menuList="item.children"></menuTree> <menuTree :menuList="item.children"></menuTree>
</el-submenu> </el-submenu>
<el-menu-item :key="item.id" :index="String(item.id)" v-else> <el-menu-item :key="item.id" :id="item.id" :index="String(item.id)" v-else>
<span slot="title">{{item.columnName}}</span> <span slot="title" :id="item.id">{{item.columnName}}</span>
</el-menu-item> </el-menu-item>
</template> </template>
</div> </div>

@ -1,7 +1,7 @@
<template> <template>
<div :class="['header', { channel: isChannel }]"> <div :class="['header', { channel: isHome }]">
<a class="logo" @click="toIndex"> <a class="logo" @click="toIndex">
<img v-if="isChannel" src="@/assets/images/logo.png" alt=""> <img v-if="isHome" src="@/assets/images/logo.png" alt="">
<template v-else> <template v-else>
<img src="@/assets/images/logo-black.png" alt=""> <img src="@/assets/images/logo-black.png" alt="">
<!-- <img src="@/assets/images/logo1.png" alt=""> <!-- <img src="@/assets/images/logo1.png" alt="">
@ -10,8 +10,12 @@
</a> </a>
<navbar ref="nav"></navbar> <navbar ref="nav"></navbar>
<div class="tools"> <div class="tools">
<img class="search" :src="require('@/assets/images/search' + (isChannel ? '-white' : '') + '.png')" alt=""> <img class="search" :src="require('@/assets/images/search' + (isHome ? '-white' : '') + '.png')" alt="" @click="showSearch = !showSearch">
<img :src="require('@/assets/images/cn' + (isChannel ? '-white' : '') + '.png')" alt=""> <img :src="require('@/assets/images/cn' + (isHome ? '-white' : '') + '.png')" alt="" @click="showSearch = !showSearch">
<div v-if="showSearch" class="search-wrap">
<i class="el-icon-search icon"></i>
<input type="text" placeholder="请输入文章标题" v-model="title">
</div>
</div> </div>
</div> </div>
</template> </template>
@ -23,7 +27,9 @@ import navbar from '../navbar'
export default { export default {
data() { data() {
return { return {
isChannel: this.$route.path === '/home' isHome: this.$route.path === '/home',
showSearch: false,
title: ''
}; };
}, },
components: { components: {
@ -31,7 +37,7 @@ export default {
}, },
watch: { watch: {
'$route'() { '$route'() {
this.isChannel = this.$route.path === '/home' this.isHome = this.$route.path === '/home'
} }
}, },
mounted() { mounted() {
@ -83,6 +89,32 @@ $height: 90px;
margin-right: 43px; margin-right: 43px;
} }
} }
.search-wrap {
position: absolute;
top: 67px;
right: 89px;
padding: 10px;
background-color: #fff;
.icon {
position: absolute;
top: 20px;
left: 22px;
font-size: 16px;
color: #959595;
}
input {
width: 300px;
height: 36px;
padding: 0 15px 0 40px;
font-size: 16px;
color: #333;
line-height: 36px;
background-color: #f5f5f5;
border: 0;
border-radius: 4px;
outline: none;
}
}
@media (max-width: 1500px) { @media (max-width: 1500px) {
.header { .header {
.logo { .logo {

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-menu :class="['nav', {home: isHome}]" ref="type" :key="menuRefresh" mode="horizontal" menu-trigger="click" :background-color="bgColor" :text-color="textColor" :active-text-color="activeTextColor" @open="jump" @select="jump" :default-active="String(active)"> <el-menu :class="['nav', {home: isHome}]" ref="elMenu" :key="menuRefresh" mode="horizontal" :background-color="bgColor" :text-color="textColor" :active-text-color="activeTextColor" @open="jump" @select="jump" :default-active="String(active)">
<menuTree :menuList="menus"/> <menuTree :menuList="menus"/>
</el-menu> </el-menu>
</div> </div>
@ -20,7 +20,8 @@ export default {
textColor: '#333', textColor: '#333',
activeTextColor: '#1583FF', activeTextColor: '#1583FF',
menuRefresh: 1, menuRefresh: 1,
toItem: {} toItem: {},
parentId: 0
}; };
}, },
components: { components: {
@ -47,7 +48,25 @@ export default {
isSort: 1 isSort: 1
}).then(({ data }) => { }).then(({ data }) => {
this.menus = data this.menus = data
if (!this.active && data.length) this.active = data[0].id if (data.length) {
if (!this.$route.query.id) this.$router.replace(`/column?id=${data[0].id}&siteId=${data[0].siteId}`)
if (!this.active) this.active = data[0].id
this.$nextTick(() => {
const menu = document.querySelectorAll('.el-submenu')
for (let i = 0; i < menu.length; i++) {
menu[i].onclick = e => {
console.log(33, e.target)
// id
let id = e.target.getAttribute('id')
if (!id) {
const span = e.target.querySelector('span')
if (span) id = span.getAttribute('id')
}
id && this.jump(id)
}
}
})
}
}).catch(err => {}) }).catch(err => {})
}, },
// //
@ -60,6 +79,7 @@ export default {
// //
getPath(data, id) { getPath(data, id) {
for (const e of data) { for (const e of data) {
if (e.level === 1) this.parentId = e.id
if (e.id == id) { if (e.id == id) {
this.toItem = e this.toItem = e
break break
@ -70,9 +90,9 @@ export default {
}, },
// //
jump(id) { jump(id) {
console.log("🚀 ~ file: index.vue ~ line 73 ~ jump ~ id", id)
this.getPath(this.menus ,id) this.getPath(this.menus ,id)
const to = this.toItem const to = this.toItem
console.log("🚀 ~ file: index.vue ~ line 73 ~ jump ~ id", to, this.parentId)
const { typeId } = to const { typeId } = to
// //
if (typeId === 2) { if (typeId === 2) {
@ -98,9 +118,12 @@ export default {
} else { } else {
location.href = href location.href = href
} }
} else if (typeId === 3) {
// path
this.$router.push(`/${to.path}?id=${id}`).catch(err => {})
} else if (typeId !== 4 || (typeId === 4 && !to.children.length)) { } else if (typeId !== 4 || (typeId === 4 && !to.children.length)) {
// columnpath // /column
this.$router.push(`/${typeId === 3 ? to.path : 'column'}?id=${id}`).catch(err => {}) this.$router.push(`/column?id=${id}`).catch(err => {})
} }
} }
} }

@ -103,8 +103,8 @@
<li v-if="item.isEnable" :key="i"> <li v-if="item.isEnable" :key="i">
<img class="pic" :src="item.pic" alt=""> <img class="pic" :src="item.pic" alt="">
<div class="texts"> <div class="texts">
<p class="sub">{{ item.title }}</p> <p class="sub">{{ item.subTitle }}</p>
<h6>{{ item.subTitle }}</h6> <h6>{{ item.title }}</h6>
<p class="des">{{ item.des }}</p> <p class="des">{{ item.des }}</p>
<img :class="{'arrow': item.link.linkName !== '无'}" src="@/assets/images/arrow.png" alt="" @click="openLink(item)"> <img :class="{'arrow': item.link.linkName !== '无'}" src="@/assets/images/arrow.png" alt="" @click="openLink(item)">
</div> </div>

@ -102,7 +102,7 @@ export default {
// //
const { column, site, articleNum } = json[7].form const { column, site, articleNum } = json[7].form
if (column.length) { if (column.length) {
this.$post(this.api.queryArticle, { this.$post(this.api.newlyPublishedArticles, {
siteId: site, siteId: site,
columnIds: [column[column.length - 1]], columnIds: [column[column.length - 1]],
pageNum: 1, pageNum: 1,

@ -186,7 +186,7 @@ export default {
padding-bottom: 30px; padding-bottom: 30px;
margin-bottom: 30px; margin-bottom: 30px;
font-size: 24px; font-size: 24px;
line-height: 20px; line-height: 40px;
color: #606060; color: #606060;
border-bottom: 1px solid #D8D8D8; border-bottom: 1px solid #D8D8D8;
} }

@ -58,7 +58,7 @@
</div> </div>
</div> </div>
<div class="contents"> <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"> <div style="width: 1113px">
<ul class="articles"> <ul class="articles">
@ -92,23 +92,15 @@
<p class="l-title">热点内容</p> <p class="l-title">热点内容</p>
<ul class="list"> <ul class="list">
<li> <li v-for="(item, i) in hots" :key="i" :title="item.title" @click="toArtice(item)">
<p class="text">喜报 | 深圳粒子研究院荣获全国科研</p> <p class="text">{{ item.title }}</p>
<span class="date">2022-08-09</span> <span class="date">{{ item.createTime }}</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> </li>
</ul> </ul>
<p class="l-title">最新资讯</p> <p class="l-title">最新资讯</p>
<ul class="list"> <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> <p class="text">{{ item.title }}</p>
<span class="date">{{ item.createTime }}</span> <span class="date">{{ item.createTime }}</span>
</li> </li>
@ -125,7 +117,7 @@ import Util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
id: this.$route.query.id, id: +this.$route.query.id,
site: this.$store.state.content.site, site: this.$store.state.content.site,
columnId: '', columnId: '',
info: {}, info: {},
@ -167,7 +159,8 @@ export default {
value: 'id', value: 'id',
label: 'columnName' label: 'columnName'
}, },
news: [] news: [],
hots: []
} }
}, },
watch: { watch: {
@ -222,18 +215,13 @@ export default {
}, },
// //
getLeftColumn() { getLeftColumn() {
this.$post(`${this.api.getsTheSubColumn}?id=${this.id}`).then(({ data }) => { this.$post(`${this.api.oneLevelChecksThemAll}?id=${this.id}`).then(({ data }) => {
// if (data.length > 1 && !data.find(e => e.listStyleId !== data[0].listStyleId)) { this.getArticle([+this.$route.query.id])
// 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.curColumn = 0 this.curColumn = 0
this.columns = data this.columns = data
this.$nextTick(() => {
this.$refs.leftColumn.setCurrentKey(this.id)
})
}).catch(err => {}) }).catch(err => {})
}, },
// //
@ -247,6 +235,10 @@ export default {
}).then(({ data }) => { }).then(({ data }) => {
this.infoColumns = data this.infoColumns = data
}).catch(err => {}) }).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() { getNews() {
@ -264,9 +256,40 @@ export default {
this.filter() this.filter()
}, },
// //
columnClick(data) { columnClick(to) {
this.page = 1 console.log("🚀 ~ file: index.vue ~ line 268 ~ columnClick ~ data", to)
this.getArticle([data.id]) const { typeId } = to
//
if (typeId === 2) {
let href = to.linkAddress
const cType = to.connectionType
if (cType !== 2) { //
const ids = href.split('-') // -
// idsiteSelection
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([to.id])
}
}, },
// //
getArticle(columnIds) { getArticle(columnIds) {
@ -276,7 +299,7 @@ export default {
}) })
this.$post(this.api.newlyPublishedArticles, { this.$post(this.api.newlyPublishedArticles, {
siteId: this.$route.query.siteId || this.site, siteId: this.$route.query.siteId || this.site,
columnIds, columnIds: columnIds.length ? columnIds : [this.id],
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
labelName, labelName,
@ -294,7 +317,7 @@ export default {
getIds(data, ids) { getIds(data, ids) {
data.map(e => { data.map(e => {
ids.push(e.id) ids.push(e.id)
this.getIds(e.children, ids) e.children && this.getIds(e.children, ids)
}) })
}, },
// //
@ -312,7 +335,14 @@ export default {
}, },
currentChange(val) { currentChange(val) {
this.page = 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) { toArtice(item) {
@ -332,6 +362,7 @@ export default {
position: absolute; position: absolute;
top: 123px; top: 123px;
left: 243px; left: 243px;
@include ellipsis;
} }
} }
.column-wrap { .column-wrap {
@ -417,37 +448,69 @@ export default {
.contents { .contents {
display: flex; display: flex;
} }
.columns { /deep/.columns {
width: 174px; width: 174px;
margin-right: 12px; margin-right: 12px;
overflow: auto; overflow: auto;
li { &:after {
display: flex; content: '';
align-items: center; position: absolute;
top: 0;
right: 0;
width: 2px;
height: 100%;
background-color: #E1E6F2;
}
.el-tree-node__content {
// z-index: 1;
position: relative;
height: 48px; height: 48px;
padding-left: 40px; padding-left: 40px;
margin-bottom: 1px; margin-bottom: 1px;
font-size: 16px; font-size: 16px;
color: #666; color: #666;
background-color: #fff; background-color: #fff;
border-right: 2px solid transparent; border-bottom: 1px solid #F8F9F9;
cursor: pointer; cursor: pointer;
&:before { &:before {
content: ''; content: '';
width: 2px; width: 2px;
height: 2px; height: 2px;
margin-right: 5px; margin: 0 10px 0 20px;
background-color: #666; background-color: #666;
border-radius: 50%; border-radius: 50%;
} }
&:hover { &:hover {
color: #0c84eb; color: #0c84eb;
} }
&.active { }
border-right-color: #083A93; .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;
} }
&.all { // border-right: 2px solid #083A93;
padding-left: 24px; .el-tree-node__label {
font-weight: 600;
color: #1150AC;
} }
} }
} }
@ -495,15 +558,15 @@ export default {
.column { .column {
width: 100%; width: 100%;
margin-bottom: 25px; margin-bottom: 25px;
} /deep/.el-tree-node__content {
/deep/.el-tree-node__content { height: 60px;
height: 60px; background-color: #E5EDF8;
background-color: #E5EDF8; border-bottom: 2px solid #fff;
border-bottom: 2px solid #fff; }
} /deep/.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
/deep/.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content { color: #fff;
color: #fff; background-color: #0f5698;
background-color: #0f5698; }
} }
.list { .list {
margin-bottom: 20px; margin-bottom: 20px;
@ -515,6 +578,7 @@ export default {
margin-bottom: 5px; margin-bottom: 5px;
font-size: 14px; font-size: 14px;
cursor: pointer; cursor: pointer;
@include ellipsis;
&:hover { &:hover {
color: $main-color; color: $main-color;
} }

@ -172,7 +172,7 @@ export default {
const id = e.column[e.column.length - 1] const id = e.column[e.column.length - 1]
e.id = id e.id = id
if (e.columnTitle === 2) e.columnName = e.columnTitleCustom if (e.columnTitle === 2) e.columnName = e.columnTitleCustom
this.$post(this.api.queryArticle, { this.$post(this.api.newlyPublishedArticles, {
siteId: e.site, siteId: e.site,
columnIds: [id], columnIds: [id],
pageNum: 1, pageNum: 1,
@ -188,7 +188,7 @@ export default {
if (json[3].form.column.length) { if (json[3].form.column.length) {
const { column, site, articleNum } = json[3].form const { column, site, articleNum } = json[3].form
this.$post(this.api.queryArticle, { this.$post(this.api.newlyPublishedArticles, {
siteId: site, siteId: site,
columnIds: [column[column.length - 1]], columnIds: [column[column.length - 1]],
pageNum: 1, pageNum: 1,
@ -199,7 +199,7 @@ export default {
} }
if (json[5].form.column.length) { if (json[5].form.column.length) {
const { column, site, articleNum } = json[5].form const { column, site, articleNum } = json[5].form
this.$post(this.api.queryArticle, { this.$post(this.api.newlyPublishedArticles, {
siteId: site, siteId: site,
columnIds: [column[column.length - 1]], columnIds: [column[column.length - 1]],
pageNum: 1, pageNum: 1,

@ -85,12 +85,22 @@
min-width: 128px; min-width: 128px;
margin-top: 0; margin-top: 0;
text-align: center; text-align: center;
.el-menu-item { .el-submenu__title, .el-menu-item, .menu-child {
height: 50px !important; width: 128px !important;
line-height: 50px !important; min-width: 0;
} }
span { span {
font-size: 18px; font-size: 18px;
color: #333; color: #333;
} }
.active > .el-submenu__title {
span {
color: #1583FF;
}
}
}
.home-menu-popup {
.el-menu {
background-color: #fff !important;
}
} }
Loading…
Cancel
Save