guhongwei 4 tahun lalu
induk
melakukan
49407eaa59

+ 21 - 7
src/layout/government/rightcont.vue

@@ -7,7 +7,7 @@
         </el-col>
         <el-col :span="24" class="info">
           <ul>
-            <li v-for="(item, index) in contentList" :key="index" @click="$emit('fetch', item.id)">
+            <li v-for="(item, index) in list" :key="index" @click="$emit('fetch', item.id)">
               <el-col :span="21" class="title textOver">{{ item.title }}</el-col>
               <el-col :span="3" class="date">
                 {{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}
@@ -16,11 +16,11 @@
           </ul>
           <el-col class="page" :span="24">
             <el-pagination
-              @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
               :current-page="currentPage"
-              layout="total,  prev, pager, next, jumper"
+              layout="total, prev, pager, next, jumper"
               :total="total"
+              :page-size="pageSize"
             >
             </el-pagination>
           </el-col>
@@ -38,6 +38,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'rightcont',
   props: {
@@ -48,6 +49,9 @@ export default {
   components: {},
   data: () => ({
     currentPage: 1,
+    pageSize: 15,
+    origin: [],
+    list: [],
     linkList: [
       {
         url: '',
@@ -78,11 +82,21 @@ export default {
   created() {},
   computed: {},
   methods: {
-    handleSizeChange(val) {
-      console.log(`每页 ${val} 条`);
+    search(page = 1) {
+      this.$set(this, `list`, this.origin[page - 1]);
     },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`);
+    handleCurrentChange(currentPage) {
+      this.search(currentPage);
+    },
+  },
+  watch: {
+    contentList: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
+        this.search();
+      },
     },
   },
 };

+ 1 - 1
src/layout/index/menuInfo.vue

@@ -71,7 +71,7 @@ export default {
   font-size: 22px;
 }
 /deep/.el-menu--horizontal > .el-menu-item:last-child {
-  padding: 0 34px;
+  padding: 0 34px 0 33px;
 }
 /deep/.el-menu--horizontal > .el-menu-item.is-active {
   border-bottom: none;

+ 21 - 7
src/layout/policy/rightcont.vue

@@ -6,7 +6,7 @@
       </el-col>
       <el-col :span="24" class="info">
         <ul>
-          <li v-for="(item, index) in contentList" :key="index" @click="$emit('fetch', item.id)">
+          <li v-for="(item, index) in list" :key="index" @click="$emit('fetch', item.id)">
             <el-col :span="21" class="title textOver">{{ item.title }}</el-col>
             <el-col :span="3" class="date">
               {{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}
@@ -15,11 +15,11 @@
         </ul>
         <el-col class="page" :span="24">
           <el-pagination
-            @size-change="handleSizeChange"
             @current-change="handleCurrentChange"
             :current-page="currentPage"
-            layout="total,  prev, pager, next, jumper"
+            layout="total, prev, pager, next, jumper"
             :total="total"
+            :page-size="pageSize"
           >
           </el-pagination>
         </el-col>
@@ -29,6 +29,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'rightcont',
   props: {
@@ -39,15 +40,28 @@ export default {
   components: {},
   data: () => ({
     currentPage: 1,
+    pageSize: 15,
+    origin: [],
+    list: [],
   }),
   created() {},
   computed: {},
   methods: {
-    handleSizeChange(val) {
-      console.log(`每页 ${val} 条`);
+    search(page = 1) {
+      this.$set(this, `list`, this.origin[page - 1]);
     },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`);
+    handleCurrentChange(currentPage) {
+      this.search(currentPage);
+    },
+  },
+  watch: {
+    contentList: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
+        this.search();
+      },
     },
   },
 };

+ 1 - 1
src/layout/shuju/gonggao.vue

@@ -99,7 +99,7 @@ li {
 .gonggaoList ul li {
   float: left;
   width: 100%;
-  padding: 0 0 6px 0;
+  padding: 0 0 7px 0;
 }
 .gonggaoList ul li .title {
   font-size: 16px;

+ 21 - 7
src/layout/shuju/rightcont.vue

@@ -6,7 +6,7 @@
       </el-col>
       <el-col :span="24" class="info">
         <ul>
-          <li v-for="(item, index) in contentList" :key="index" @click="$emit('fetch', item.id)">
+          <li v-for="(item, index) in list" :key="index" @click="$emit('fetch', item.id)">
             <el-col :span="21" class="title textOver">{{ item.title }}</el-col>
             <el-col :span="3" class="date">
               {{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}
@@ -15,11 +15,11 @@
         </ul>
         <el-col class="page" :span="24">
           <el-pagination
-            @size-change="handleSizeChange"
             @current-change="handleCurrentChange"
             :current-page="currentPage"
-            layout="total,  prev, pager, next, jumper"
+            layout="total, prev, pager, next, jumper"
             :total="total"
+            :page-size="pageSize"
           >
           </el-pagination>
         </el-col>
@@ -29,6 +29,7 @@
 </template>
 
 <script>
+import _ from 'lodash';
 export default {
   name: 'rightcont',
   props: {
@@ -39,15 +40,28 @@ export default {
   components: {},
   data: () => ({
     currentPage: 1,
+    pageSize: 15,
+    origin: [],
+    list: [],
   }),
   created() {},
   computed: {},
   methods: {
-    handleSizeChange(val) {
-      console.log(`每页 ${val} 条`);
+    search(page = 1) {
+      this.$set(this, `list`, this.origin[page - 1]);
     },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`);
+    handleCurrentChange(currentPage) {
+      this.search(currentPage);
+    },
+  },
+  watch: {
+    contentList: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
+        this.search();
+      },
     },
   },
 };

+ 1 - 1
src/views/government/government.vue

@@ -159,7 +159,7 @@ export default {
     },
     // 查询信息列表
     async tpxwSearch({ skip = 0, limit = 10, column_id, site } = {}) {
-      const res = await this.newsList({ skip, limit, column_id: column_id });
+      const res = await this.newsList({ column_id: column_id });
       for (const val of res.data) {
         const result = await this.columnInfo(val.column_id);
         val.column_name = result.data.name;

+ 3 - 3
src/views/government/governmentList.vue

@@ -35,7 +35,7 @@ export default {
     display: 'list',
     columnName: '',
     contentList: [],
-    total: 1,
+    total: 0,
     leftId: '',
     columnTitle: '',
     policyInfo: {},
@@ -73,13 +73,13 @@ export default {
       this.searchRight();
     },
     async searchRight({ skip = 0, limit = 10, column_id } = {}) {
-      const res = await this.policyNew({ skip, limit, column_id: this.leftId });
+      const res = await this.policyNew({ column_id: this.leftId });
       for (const val of res.data) {
         const result = await this.columnInfo(val.column_id);
         val.column_name = result.data.name;
       }
       this.$set(this, `contentList`, res.data);
-      this.$set(this, `total`, res.data.length);
+      this.$set(this, `total`, res.total);
       for (const val of res.data) {
         this.$set(this, `columnName`, val.column_name);
       }

+ 1 - 1
src/views/policy/policy.vue

@@ -71,7 +71,7 @@ export default {
       this.searchRight();
     },
     async searchRight({ skip = 0, limit = 10, column_id } = {}) {
-      const res = await this.policyNew({ skip, limit, column_id: this.leftId });
+      const res = await this.policyNew({ column_id: this.leftId });
       for (const val of res.data) {
         const result = await this.policyfetch(val.column_id);
         val.column_name = result.data.name;

+ 1 - 1
src/views/shuju/shujulist.vue

@@ -70,7 +70,7 @@ export default {
       this.searchRight();
     },
     async searchRight({ skip = 0, limit = 10, column_id } = {}) {
-      const res = await this.policyNew({ skip, limit, column_id: this.leftId });
+      const res = await this.policyNew({ column_id: this.leftId });
       for (const val of res.data) {
         const result = await this.policyfetch(val.column_id);
         val.column_name = result.data.name;