فهرست منبع

添加章程页

asd123a20 2 سال پیش
والد
کامیت
668ff43df6
5فایلهای تغییر یافته به همراه123 افزوده شده و 2 حذف شده
  1. 5 0
      src/components/heads/nav/index.vue
  2. 5 0
      src/components/leftmenu/index.vue
  3. 5 0
      src/router/index.js
  4. 106 0
      src/views/constitution.vue
  5. 2 2
      vue.config.js

+ 5 - 0
src/components/heads/nav/index.vue

@@ -53,6 +53,11 @@ export default {
         this.$router.push('/leader');
         return;
       }
+      // 如果编码 = 013(章程)进入章程页
+      if (env.code == '013') {
+        this.$router.push(`/constitution/${this.activeIndex}?parentCode=${parentCode}`);
+        return;
+      }
       // 如果编码 = 014(机构)进入机构页
       if (env.code == '014') {
         this.$router.push(`/org/${this.activeIndex}?parentCode=${parentCode}`);

+ 5 - 0
src/components/leftmenu/index.vue

@@ -30,6 +30,11 @@ export default {
   async mounted() {},
   methods: {
     handleSelect(item) {
+      // 如果不是菜单点击
+      if (!item.type) {
+        this.$emit('leftClick', item);
+        return false;
+      }
       // 获取当前一例的顶级菜单编码
       const parentCode = item.code.substring(0, 2);
       // 类型为1(栏目)进入列表页

+ 5 - 0
src/router/index.js

@@ -19,6 +19,11 @@ const routes = [
     name: 'org',
     component: () => import('../views/org.vue')
   },
+  {
+    path: '/constitution/:code',
+    name: 'constitution',
+    component: () => import('../views/constitution.vue')
+  },
   {
     path: '/details/:id',
     name: 'details',

+ 106 - 0
src/views/constitution.vue

@@ -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>

+ 2 - 2
vue.config.js

@@ -5,8 +5,8 @@ module.exports = {
     port: 18080,
     proxy: {
       '/api/': {
-        // target: 'http://192.168.0.45:18090'
-        target: 'http://127.0.0.1:18090'
+        target: 'http://skl.cc-lotus.info'
+        // target: 'http://127.0.0.1:18090'
       },
       '/upload/': {
         target: 'http://127.0.0.1:9002'