|
@@ -0,0 +1,112 @@
|
|
|
|
+<template>
|
|
|
|
+ <div>
|
|
|
|
+ <breadcrumb ref="breadcrumb"></breadcrumb>
|
|
|
|
+ <div class="listHome">
|
|
|
|
+ <div class="listBoxLeft">
|
|
|
|
+ <letnav ref="letnav" :menuTree="menu"></letnav>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="listBoxRight" v-if="listTotal > 0">
|
|
|
|
+ <el-button v-for="(item, index) in contentList" :key="index" @click="newClick(item)" class="btn">
|
|
|
|
+ {{ item.title }}
|
|
|
|
+ <i class="xian"></i>
|
|
|
|
+ </el-button>
|
|
|
|
+ </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', 'menusall'])
|
|
|
|
+ },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ code: null,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ parentCode: null,
|
|
|
|
+ menu: {}
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ async mounted() {
|
|
|
|
+ // 当前菜单参数
|
|
|
|
+ this.code = this.$route.params.code;
|
|
|
|
+ // 顶级菜单参数
|
|
|
|
+ this.parentCode = this.$route.query.parentCode;
|
|
|
|
+ console.log(this.code, 'this.code');
|
|
|
|
+ await this.filterQuery();
|
|
|
|
+ // 获取一例菜单
|
|
|
|
+ this.menu = this.$setChildrenSession({ menus: this.menusall, iscode: this.parentCode });
|
|
|
|
+ // 控制左侧菜单当前选项
|
|
|
|
+ this.$refs.letnav.setIndex();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ ...mapActions(['contentsList']),
|
|
|
|
+ // 查询函数
|
|
|
|
+ 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 });
|
|
|
|
+ },
|
|
|
|
+ // 列表点击
|
|
|
|
+ newClick(e) {
|
|
|
|
+ this.$router.push(`/details/${e._id}`);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ filters: {
|
|
|
|
+ dates(e) {
|
|
|
|
+ return moment(e).format('YYYY-MM-DD');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+<style lang="scss">
|
|
|
|
+.divider {
|
|
|
|
+ width: 70%;
|
|
|
|
+ margin: 5% auto;
|
|
|
|
+}
|
|
|
|
+.listHome {
|
|
|
|
+ width: 70%;
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ display: flex;
|
|
|
|
+ .listBoxLeft {
|
|
|
|
+ width: 25%;
|
|
|
|
+ margin-top: 5%;
|
|
|
|
+ margin-right: 5%;
|
|
|
|
+ }
|
|
|
|
+ .listBoxRight {
|
|
|
|
+ width: 70%;
|
|
|
|
+ margin-top: 5%;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
+ .btn {
|
|
|
|
+ height: 3em;
|
|
|
|
+ line-height: 1em;
|
|
|
|
+ padding: 0 8%;
|
|
|
|
+ margin-right: 2%;
|
|
|
|
+ position: relative;
|
|
|
|
+ .xian {
|
|
|
|
+ position: absolute;
|
|
|
|
+ width: 5%;
|
|
|
|
+ height: 2px;
|
|
|
|
+ background: #19a33a;
|
|
|
|
+ top: 10%;
|
|
|
|
+ right: 5%;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .pagination {
|
|
|
|
+ margin-bottom: 5%;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</style>
|