|
@@ -0,0 +1,106 @@
|
|
|
+<template>
|
|
|
+ <div class="list">
|
|
|
+ <breadcrumb ref="breadcrumb"></breadcrumb>
|
|
|
+ <div class="listHome">
|
|
|
+ <div class="listBoxLeft">
|
|
|
+ <letnav ref="letnav" :menuTree="menu" @leftClick="leftClick"></letnav>
|
|
|
+ </div>
|
|
|
+ <div class="listBoxRight" v-if="listTotal > 0">
|
|
|
+ <div class="constitutionBox" v-for="(item, index) in list" :key="index" >
|
|
|
+ <h2 :id="item._id">{{ item.title }}</h2>
|
|
|
+ <span v-html="item.content"></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-divider class="divider" v-else>暂无数据</el-divider>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+// import moment from 'moment';
|
|
|
+import letnav from '../components/leftmenu/index.vue';
|
|
|
+import breadcrumb from '../components/breadcrumb/index.vue';
|
|
|
+import { mapState, mapActions } from 'vuex';
|
|
|
+export default {
|
|
|
+ name: 'listHome',
|
|
|
+ components: {
|
|
|
+ letnav,
|
|
|
+ breadcrumb
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['contentList', 'listTotal'])
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ code: null,
|
|
|
+ pageSize: 10,
|
|
|
+ parentCode: null,
|
|
|
+ menu: {},
|
|
|
+ list: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async mounted() {
|
|
|
+ // 当前菜单参数
|
|
|
+ this.code = this.$route.params.code;
|
|
|
+ // 顶级菜单参数
|
|
|
+ this.parentCode = this.$route.query.parentCode;
|
|
|
+ await this.filterQuery();
|
|
|
+ this.menu = {
|
|
|
+ name: '社科章程'
|
|
|
+ };
|
|
|
+ const children = [...this.contentList];
|
|
|
+ this.menu.children = children.map(e => ({ ...e, name: e.title, code: e._id }));
|
|
|
+ this.conents();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['contentsList', 'contentsFetch']),
|
|
|
+ // 查询函数
|
|
|
+ async filterQuery ({ filter = {}, paging = { page: 0, size: 10 } } = {}) {
|
|
|
+ filter.bind = this.code;
|
|
|
+ if (this.code.length == 2) filter.parentCode = this.code;
|
|
|
+ await this.contentsList({ filter, paging });
|
|
|
+ },
|
|
|
+ async conents() {
|
|
|
+ this.list = await Promise.all(this.contentList.map(async e => {
|
|
|
+ const res = await this.contentsFetch({ id: e._id });
|
|
|
+ return { ...e, content: res.data.content };
|
|
|
+ }));
|
|
|
+ },
|
|
|
+ // 列表点击
|
|
|
+ leftClick(e) {
|
|
|
+ document.getElementById(e._id).scrollIntoView();
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.divider {
|
|
|
+ width: 70%;
|
|
|
+ margin: 5% auto;
|
|
|
+}
|
|
|
+.list{
|
|
|
+ width: 70%;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-bottom: 5%;
|
|
|
+ .listHome {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ .listBoxLeft {
|
|
|
+ width: 25%;
|
|
|
+ margin-top: 5%;
|
|
|
+ margin-right: 5%;
|
|
|
+ }
|
|
|
+ .listBoxRight {
|
|
|
+ width: 70%;
|
|
|
+ margin-top: 5%;
|
|
|
+ h2 {
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .pagination {
|
|
|
+ margin-bottom: 5%;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|