Jelajahi Sumber

Merge branch 'master' of http://git.cc-lotus.info/service-platform/web-website into master

wxy 4 tahun lalu
induk
melakukan
e128a28f59

+ 1 - 1
src/layout/government/news.vue

@@ -107,7 +107,7 @@ li {
 }
 .list ul {
   padding: 0 0 0 20px;
-  max-height: 280px;
+  max-height: 310px;
   overflow: hidden;
 }
 .chuangxinList {

+ 1 - 1
src/layout/government/notice.vue

@@ -87,7 +87,7 @@ li {
   overflow: hidden;
 }
 .zixunList {
-  padding: 0 0 5px 0;
+  padding: 0 0 6px 0;
 }
 .zixunList .title {
   font-size: 14px;

+ 3 - 3
src/layout/service/fenlei.vue

@@ -6,9 +6,9 @@
     </el-col>
     <el-col>
       <el-menu default-active="1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" text-color="#215299" active-text-color="#215299">
-        <el-menu-item index="1" v-for="(item, index) in liebiaoList" :key="index"
-          ><span slot="title" @click="clickUrl(item.id)">{{ item.name }}</span></el-menu-item
-        >
+        <el-menu-item index="1" v-for="(item, index) in liebiaoList" :key="index" @click="clickUrl(item.id)">
+          <span slot="title">{{ item.name }}</span>
+        </el-menu-item>
       </el-menu>
     </el-col>
   </div>

+ 21 - 7
src/layout/service/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: 20,
+    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

@@ -154,7 +154,7 @@ export default {
     async searchaffnews() {
       let column = this.affairsCol;
       for (const val of column) {
-        let res = await this.newsList({ skip: 0, limit: 8, column_id: val.id });
+        let res = await this.newsList({ skip: 0, limit: 11, column_id: val.id });
         if (this.$checkRes(res)) {
           this.$set(this, `${val.site}List`, res.data);
         }

+ 19 - 22
src/views/service/service.vue

@@ -25,7 +25,10 @@ export default {
     serviceDetail,
   },
   data: () => ({
+    // 站点信息
     info: {},
+    // 栏目列表
+    servicecolumn: [],
     // 视频会议中心
     sphyzxList: [],
     // 专题研讨
@@ -76,42 +79,36 @@ export default {
       },
     ],
   }),
-  created() {
-    this.searchSite();
-    this.searchColumn();
+  async created() {
+    await this.search();
   },
   computed: {},
   methods: {
     ...mapSite(['showInfo']),
     ...mapColumn({ columnList: 'query', columnInfo: 'fetch' }),
     ...mapNews({ newsList: 'query' }),
-    // 查询站点信息
-    async searchSite() {
+    // 查询站点信息+科技服务栏目
+    async search({ ...info } = {}) {
       let res = await this.showInfo();
       let object = JSON.parse(JSON.stringify(res.data));
       if (object) {
         this.$set(this, `info`, res.data);
-      } else {
-        this.$message.error(res.errmsg ? res.errmsg : 'error');
       }
-    },
-    // 查询科技服务栏目
-    async searchColumn({ ...info } = {}) {
-      const res = await this.columnList({ ...info });
-      for (const val of res.data) {
-        this.tpxwSearch({ column_id: val.id, site: val.site });
+      res = await this.columnList({ ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `servicecolumn`, res.data);
+        this.searchaffnews();
       }
     },
-    // 查询信息列表
-    async tpxwSearch({ skip = 0, limit = 10, column_id, site } = {}) {
-      console.log(column_id, site);
-      const res = await this.newsList({ skip, limit, column_id: column_id });
-      for (const val of res.data) {
-        const result = await this.columnInfo(val.column_id);
-        val.column_name = result.data.name;
+    // 查询信息
+    async searchaffnews({ skip = 0, limit = 6, column_id, site } = {}) {
+      let column = this.servicecolumn;
+      for (const val of column) {
+        let res = await this.newsList({ skip, limit, column_id: val.id });
+        if (this.$checkRes(res)) {
+          this.$set(this, `${val.site}List`, res.data);
+        }
       }
-      this.$set(this, `${site}List`, res.data);
-      console.log(res.data);
     },
   },
 };

+ 18 - 23
src/views/service/servicedetail.vue

@@ -27,7 +27,6 @@ export default {
   data: () => ({
     info: {},
     liebiaoList: [],
-
     columnName: '',
     contentList: [],
     total: 1,
@@ -35,41 +34,37 @@ export default {
     columnTitle: '',
     policyInfo: {},
   }),
-  created() {
-    this.searchSite();
-    this.searchColumn();
-    this.searchInfo();
+  async created() {
+    await this.search();
+    await this.searchInfo();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
   },
-  computed: {},
   methods: {
     ...mapSite(['showInfo']),
     ...mapColumn({ columnList: 'query', columnInfo: 'fetch' }),
     ...mapNews({ newsList: 'query', newsInfo: 'fetch' }),
-    // 查询站点信息
-    async searchSite() {
+    // 查询站点信息+科技服务栏目
+    async search({ ...info } = {}) {
       let res = await this.showInfo();
       let object = JSON.parse(JSON.stringify(res.data));
       if (object) {
         this.$set(this, `info`, res.data);
-      } else {
-        this.$message.error(res.errmsg ? res.errmsg : 'error');
       }
-    },
-    // 查询科技政务栏目
-    async searchColumn({ ...info } = {}) {
-      const res = await this.columnList({ ...info });
+      res = await this.columnList({ ...info });
       this.$set(this, `liebiaoList`, res.data);
-      console.log(res);
-      // for (const val of res.data) {
-      //   this.tpxwSearch({ column_id: val.id, site: val.site });
-      // }
     },
+    // 查询详情
     async searchInfo() {
-      let detailId = this.$route.query.id;
-      const res = await this.newsInfo(detailId);
-      const result = await this.columnInfo(res.data.column_id);
-      this.$set(this, `columnTitle`, result.data.name);
-      this.$set(this, `policyInfo`, res.data);
+      const res = await this.newsInfo(this.id);
+      let column = this.liebiaoList.find(i => i.id == res.data.column_id);
+      if (res) {
+        this.$set(this, `policyInfo`, res.data);
+        this.$set(this, `columnTitle`, column.name);
+      }
     },
   },
 };

+ 27 - 27
src/views/service/servicelist.vue

@@ -7,7 +7,7 @@
       :columnName="columnName"
       :contentList="contentList"
       :total="total"
-      :columnTitle="columnTitle"
+      :columnTitle="columnName"
       :policyInfo="policyInfo"
       @clickLists="submit"
       @fetch="fetchInfo"
@@ -28,19 +28,23 @@ export default {
   props: {},
   components: { servicelistDetail },
   data: () => ({
+    // 站点信息
     info: {},
+    // 栏目列表
     liebiaoList: [],
+    // 左侧栏目id
+    leftId: '',
+    // 显示列表+详情
     display: 'list',
     columnName: '',
     contentList: [],
-    total: 1,
-    leftId: '',
+    total: 0,
+
     columnTitle: '',
     policyInfo: {},
   }),
   async created() {
-    this.searchSite();
-    await this.policyColumn();
+    await this.search();
     await this.defaultColumn();
   },
   computed: {},
@@ -48,37 +52,32 @@ export default {
     ...mapSite(['showInfo']),
     ...mappolicyColumn({ policyColumns: 'query', policyfetch: 'fetch' }),
     ...mappolicyNews({ policyNew: 'query', newsFetch: 'fetch' }),
-    // 查询站点信息
-    async searchSite() {
+    //查询站点信息+科技服务栏目
+    async search({ ...info } = {}) {
       let res = await this.showInfo();
       let object = JSON.parse(JSON.stringify(res.data));
       if (object) {
         this.$set(this, `info`, res.data);
-      } else {
-        this.$message.error(res.errmsg ? res.errmsg : 'error');
       }
-    },
-    async policyColumn({ ...info } = {}) {
-      const res = await this.policyColumns({ ...info });
+      res = await this.policyColumns({ ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `liebiaoList`, res.data);
       }
     },
+    // 点击查询详情
     submit({ id }) {
       this.$set(this, `leftId`, id);
       this.display = 'list';
-      this.searchRight();
+      this.searchrightnews();
     },
-    async searchRight({ skip = 0, limit = 10, column_id } = {}) {
-      const res = await this.policyNew({ skip, limit, column_id: this.leftId });
-      for (const val of res.data) {
-        const result = await this.policyfetch(val.column_id);
-        val.column_name = result.data.name;
-      }
-      this.$set(this, `contentList`, res.data);
-      this.$set(this, `total`, res.data.length);
-      for (const val of res.data) {
-        this.$set(this, `columnName`, val.column_name);
+    // 查询详情
+    async searchrightnews({ skip = 0, limit = 10, column_id } = {}) {
+      const res = await this.policyNew({ column_id: this.leftId });
+      let columnName = this.liebiaoList.find(i => i.id == this.leftId);
+      if (this.$checkRes(res)) {
+        this.$set(this, `contentList`, res.data);
+        this.$set(this, `total`, res.total);
+        this.$set(this, `columnName`, columnName.name);
       }
     },
     async defaultColumn() {
@@ -90,10 +89,11 @@ export default {
     async fetchInfo(id) {
       this.display = 'detail';
       const res = await this.newsFetch(id);
-      const result = await this.policyfetch(res.data.column_id);
-      this.$set(this, `columnTitle`, result.data.name);
-      this.$set(this, `policyInfo`, res.data);
-      // 查询详情,赋值
+      let column = this.liebiaoList.find(i => i.id == res.data.column_id);
+      if (res) {
+        this.$set(this, `policyInfo`, res.data);
+        this.$set(this, `columnName`, column.name);
+      }
     },
   },
 };