Parcourir la source

Merge branch 'master' of http://git.cc-lotus.info/Free-cysci/cysci-website

lrf402788946 il y a 4 ans
Parent
commit
624d63d6d4
2 fichiers modifiés avec 36 ajouts et 2 suppressions
  1. 2 0
      src/store/index.js
  2. 34 2
      src/views/news/index.vue

+ 2 - 0
src/store/index.js

@@ -3,6 +3,7 @@ import Vuex from 'vuex';
 import * as ustate from '@common/src/store/user/state';
 import * as umutations from '@common/src/store/user/mutations';
 import login from '@common/src/store/login';
+import news from '@common/src/store/news';
 
 Vue.use(Vuex);
 
@@ -12,5 +13,6 @@ export default new Vuex.Store({
   actions: {},
   modules: {
     login,
+    news,
   },
 });

+ 34 - 2
src/views/news/index.vue

@@ -39,6 +39,7 @@
 import top from './parts/top.vue';
 import list from './parts/list.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: news } = createNamespacedHelpers('news');
 export default {
   name: 'index',
   props: {},
@@ -116,10 +117,41 @@ export default {
           release_time: '2021-01-16',
         },
       ],
+      column: [
+        { name: '政务动态', site: 'one', limit: 11 },
+        { name: '通知通告', site: 'two', limit: 11 },
+        { name: '科技新闻', site: 'thr', limit: 4 },
+        { name: '媒体聚焦', site: 'four', limit: 11 },
+        { name: '信息公开', site: 'five', limit: 12 },
+      ],
     };
   },
-  created() {},
-  methods: {},
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...news(['query']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      for (const val of this.column) {
+        if (val.name == '政务动态') {
+          let res = await this.query({ skip, limit: val.limit, column_name: val.name, ...info });
+          if (this.$checkRes(res)) this.$set(this, `${val.site}List`, res.data);
+        } else if (val.name == '通知通告') {
+          let res = await this.query({ skip, limit: val.limit, column_name: val.name, ...info });
+          if (this.$checkRes(res)) this.$set(this, `${val.site}List`, res.data);
+        } else if (val.name == '科技新闻') {
+          let res = await this.query({ skip, limit: val.limit, column_name: val.name, ...info });
+          if (this.$checkRes(res)) this.$set(this, `${val.site}List`, res.data);
+        } else if (val.name == '媒体聚焦') {
+          let res = await this.query({ skip, limit: val.limit, column_name: val.name, ...info });
+          if (this.$checkRes(res)) this.$set(this, `${val.site}List`, res.data);
+        } else if (val.name == '信息公开') {
+          let res = await this.query({ skip, limit: val.limit, column_name: val.name, ...info });
+          if (this.$checkRes(res)) this.$set(this, `${val.site}List`, res.data);
+        }
+      }
+    },
+  },
   computed: {
     ...mapState(['user']),
   },