23 changed files with 656 additions and 109 deletions
After Width: | Height: | Size: 22 KiB |
@ -0,0 +1,38 @@ |
|||
<template> |
|||
<div> |
|||
<div style="color:#AE0002;font-size:22px"> |
|||
相关新闻 |
|||
</div> |
|||
<div v-for="item in data.relations" :key="item.introId" class="d-flex justify-space-between article-box my-4"> |
|||
<div class="article-title one-text" @click="openPages(item.introId)"><span class="mr-4">>></span>{{ item.title }}</div> |
|||
<div class="ml-4">[{{ $moment(item.publishTime - 0).format('YYYY - MM - DD') }}]</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
export default { |
|||
props: { |
|||
data: { |
|||
default: {}, |
|||
type: Object, |
|||
}, |
|||
}, |
|||
data() { |
|||
return {}; |
|||
}, |
|||
methods: { |
|||
openPages(id) { |
|||
window.open(`http://${window.location.host}${this.$route.path}?code=${this.$route.query.code}&introId=${id}`); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
.article-box { |
|||
width: 892px; |
|||
cursor: pointer; |
|||
} |
|||
.article-title { |
|||
width: 750px; |
|||
} |
|||
</style> |
@ -0,0 +1,133 @@ |
|||
<template> |
|||
<div class="bg-bottom"> |
|||
<div class="bg-top"> |
|||
<div class="content-1180"> |
|||
<div class="d-flex pt-4"> |
|||
<LeftNav :code="code" :list="list" class="mr-4" @chanegCode="chanegCode" /> |
|||
<div class="flex-1 flex-column"> |
|||
<Location :title="defaultTitle" /> |
|||
<div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }"> |
|||
<ListPage v-if="!introId" :code="code" @changeYear="changeYear" :content="content" @getData="getData" /> |
|||
<RichText v-else :rich-obj="introContent" /> |
|||
</div> |
|||
<div v-if="introContent.relations && introContent.relations.length" class="content-detail p-4"> |
|||
<Relevant :data="introContent" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { mapActions } from 'vuex'; |
|||
import LeftNav from '@/components/LeftNav/LeftNav.vue'; |
|||
import ListPage from '@/components/ListPage/ListPage.vue'; |
|||
import RichText from '@/components/RichText/RichText.vue'; |
|||
import Location from '@/components/Location/Location.vue'; |
|||
import Relevant from '@/components/RichText/Relevant.vue'; |
|||
|
|||
export default { |
|||
components: { LeftNav, ListPage, Location, RichText, Relevant }, |
|||
data() { |
|||
return { |
|||
code: '9902', |
|||
defaultTitle: '光荣榜', |
|||
list: { |
|||
title: '其它', |
|||
url: '/pile', |
|||
children: [ |
|||
{ |
|||
title: '光荣榜', |
|||
code: '9902', |
|||
}, |
|||
{ |
|||
title: '今天我出镜', |
|||
code: '9903', |
|||
}, |
|||
], |
|||
}, |
|||
year: '2022', |
|||
content: {}, |
|||
pageNum: 1, |
|||
introId: '', |
|||
introContent: {}, |
|||
}; |
|||
}, |
|||
watch: { |
|||
'$route.query.code'(val) { |
|||
if (this.$route.path === this.list.url) { |
|||
this.code = val; |
|||
this.getDetault(val); |
|||
this.getContentData(); |
|||
this.introContent = {}; |
|||
} |
|||
}, |
|||
}, |
|||
created() { |
|||
this.code = this.$route.query.code; |
|||
this.getDetault(this.code); |
|||
if (this.$route.query.introId) { |
|||
this.introId = this.$route.query.introId; |
|||
this.getIntroContent(); |
|||
} |
|||
this.getContentData(); |
|||
}, |
|||
methods: { |
|||
...mapActions('home', ['getContent', 'getDetail']), |
|||
// 获取默认显示标题 |
|||
getDetault(val) { |
|||
for (let i = 0; i < this.list.children.length; i++) { |
|||
if (val === this.list.children[i].code) { |
|||
this.defaultTitle = this.list.children[i].title; |
|||
} |
|||
} |
|||
}, |
|||
async getContentData() { |
|||
try { |
|||
const param = { |
|||
showPage: this.code, |
|||
year: this.year, |
|||
showType: '0', |
|||
pageNum: this.pageNum, |
|||
pageSize: 10, |
|||
}; |
|||
const data = await this.getContent(param); |
|||
console.log('data: ', data); |
|||
this.content = data; |
|||
} catch (error) {} |
|||
}, |
|||
// 获取文章信息 |
|||
async getIntroContent() { |
|||
try { |
|||
const param = { |
|||
showPage: '', |
|||
introId: this.introId, |
|||
}; |
|||
const data = await this.getDetail(param); |
|||
this.introContent = data; |
|||
} catch (error) { |
|||
console.error('error: ', error); |
|||
} |
|||
}, |
|||
chanegCode(code) { |
|||
this.code = code; |
|||
this.introId = ''; |
|||
}, |
|||
changeYear(year) { |
|||
this.year = year; |
|||
this.getContentData(); |
|||
}, |
|||
getData(pageNum) { |
|||
console.log('pageNum: ', pageNum); |
|||
this.pageNum = pageNum; |
|||
this.getContentData(); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
.content-detail { |
|||
background: #fff; |
|||
} |
|||
</style> |
@ -0,0 +1,141 @@ |
|||
<template> |
|||
<div class="bg-bottom"> |
|||
<div class="bg-top"> |
|||
<div class="content-1180"> |
|||
<div class="d-flex pt-4"> |
|||
<LeftNav :list="tabList" class="mr-4" /> |
|||
<div class="flex-1 flex-column"> |
|||
<Location :title="defaultTitle" /> |
|||
<div class="content-detail p-4" :style="{ 'min-height': tabList.children.length * 56 + 'px' }"> |
|||
<ListPage v-if="!introId" code="search" :content="content" @getData="getData" /> |
|||
<RichText v-else :rich-obj="introContent" /> |
|||
</div> |
|||
<div v-if="introContent.relations && introContent.relations.length" class="content-detail p-4"> |
|||
<Relevant :data="introContent" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
<script> |
|||
import { mapActions } from 'vuex'; |
|||
import LeftNav from 'components/LeftNav/LeftNav.vue'; |
|||
import Location from 'components/Location/Location.vue'; |
|||
import ListPage from 'components/ListPage/ListPage.vue'; |
|||
|
|||
export default { |
|||
components: { LeftNav, Location, ListPage }, |
|||
data() { |
|||
return { |
|||
tabList: { |
|||
title: '搜索关联', |
|||
children: [ |
|||
{ |
|||
title: '首页', |
|||
url: '/', |
|||
}, |
|||
{ |
|||
title: '公司概况', |
|||
url: '/profile', |
|||
code: '0101', |
|||
}, |
|||
{ |
|||
title: '新闻中心', |
|||
url: '/news', |
|||
code: '0201', |
|||
}, |
|||
{ |
|||
title: '党的建设', |
|||
url: '/building', |
|||
code: '0301', |
|||
}, |
|||
{ |
|||
title: '安全生产', |
|||
url: '/production', |
|||
code: '0401', |
|||
}, |
|||
{ |
|||
title: '通知公告', |
|||
url: '/notice', |
|||
code: '0501', |
|||
}, |
|||
{ |
|||
title: '信息公开', |
|||
url: '/information', |
|||
code: '0601', |
|||
}, |
|||
{ title: '审批事项' }, |
|||
{ |
|||
title: '制度资料', |
|||
url: '/system', |
|||
code: '0801', |
|||
}, |
|||
{ |
|||
title: '部门首页', |
|||
url: '/department', |
|||
code: '0901', |
|||
}, |
|||
], |
|||
}, |
|||
content: {}, |
|||
defaultTitle: '关键词', |
|||
text: '', |
|||
pageNum: 1, |
|||
pageSize: 10, |
|||
introId: '', |
|||
introContent: {}, |
|||
}; |
|||
}, |
|||
created() { |
|||
this.title = this.$route.query.text; |
|||
if (this.$route.query.introId) { |
|||
this.introId = this.$route.query.introId; |
|||
this.getIntroContent(); |
|||
} |
|||
this.getSearchData(); |
|||
}, |
|||
methods: { |
|||
...mapActions('home', ['getContent', 'getDetail']), |
|||
async getSearchData() { |
|||
try { |
|||
const param = { |
|||
showPage: '', |
|||
year: '', |
|||
showType: '', |
|||
pageNum: this.pageNum, |
|||
pageSize: this.pageSize, |
|||
title: this.title, |
|||
}; |
|||
console.log('param: ', param); |
|||
const res = await this.getContent(param); |
|||
this.content = res; |
|||
} catch (error) {} |
|||
}, |
|||
// 获取文章信息 |
|||
async getIntroContent() { |
|||
try { |
|||
const param = { |
|||
showPage: '', |
|||
introId: this.introId, |
|||
}; |
|||
const data = await this.getDetail(param); |
|||
this.introContent = data; |
|||
} catch (error) { |
|||
console.error('error: ', error); |
|||
} |
|||
}, |
|||
getData(pageNum) { |
|||
console.log('pageNum: ', pageNum); |
|||
this.pageNum = pageNum; |
|||
this.getSearchData(); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style scoped> |
|||
.content-detail { |
|||
background: #fff; |
|||
} |
|||
</style> |
Loading…
Reference in new issue