Browse Source

科技数据更新+后续更新详情

guhongwei 5 years ago
parent
commit
1e117908c3

+ 2 - 1
src/components/shuju/shuju.vue

@@ -17,7 +17,7 @@
       <el-col :span="24" class="main">
         <div class="w_1200">
           <el-col :span="16" class="leftcont">
-            <el-col :span="5" class="fenlei"> <fenlei></fenlei></el-col>
+            <el-col :span="5" class="fenlei"> <fenlei :liebiaoList="liebiaoList"></fenlei></el-col>
             <el-col :span="19" class="between"><zhanshi :imageList="imageList"></zhanshi></el-col>
             <el-col :span="24" class="gonggao">
               <gonggao :gonggaoList="gonggaoList"></gonggao>
@@ -57,6 +57,7 @@ export default {
   name: 'shuju',
   props: {
     info: null, //站点信息
+    liebiaoList: null, //分类导航
     imageList: null, //数据展示
     gonggaoList: null, //底部通知公告
     shangbaoList: null, //上报通知

+ 0 - 9
src/layout/policy/fenlei.vue

@@ -9,15 +9,6 @@
         <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="2"><span slot="title"></span></el-menu-item>
-        <el-menu-item index="3"><span slot="title"></span></el-menu-item>
-        <el-menu-item index="4"><span slot="title"></span></el-menu-item>
-        <el-menu-item index="5"><span slot="title"></span></el-menu-item>
-        <el-menu-item index="6"><span slot="title"></span></el-menu-item>
-        <el-menu-item index="7"><span slot="title"></span></el-menu-item>
-        <el-menu-item index="8"><span slot="title"></span></el-menu-item>
-        <el-menu-item index="9"><span slot="title"></span></el-menu-item>
-        <el-menu-item index="10"><span slot="title"></span></el-menu-item> -->
       </el-menu>
     </el-col>
   </div>

+ 9 - 7
src/layout/shuju/fenlei.vue

@@ -6,12 +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"><span slot="title">科技文献</span></el-menu-item>
-        <el-menu-item index="2"><span slot="title">科技报告</span></el-menu-item>
-        <el-menu-item index="3"><span slot="title">科技期刊</span></el-menu-item>
-        <el-menu-item index="4"><span slot="title">科技智库</span></el-menu-item>
-        <el-menu-item index="5"><span slot="title">科技成果</span></el-menu-item>
-        <el-menu-item index="6"><span slot="title">科技交易</span></el-menu-item>
+        <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>
     </el-col>
   </div>
@@ -20,7 +17,9 @@
 <script>
 export default {
   name: 'fenlei',
-  props: {},
+  props: {
+    liebiaoList: null,
+  },
   components: {},
   data: () => ({
     src: require('@/assets/swfl.png'),
@@ -28,6 +27,9 @@ export default {
   created() {},
   computed: {},
   methods: {
+    clickUrl(id) {
+      this.$emit('clickLists', { id });
+    },
     handleOpen(key, keyPath) {
       console.log(key, keyPath);
     },

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

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="info">
         <el-col :span="24" class="topInfo">
-          <el-col :span="20" class="left">{{ title }}</el-col>
+          <el-col :span="20" class="left">通知公告</el-col>
+          <!-- {{ gonggaoList[0].column_name }} -->
           <el-col :span="4" class="more">
             <el-link :underline="false"><el-image :src="more"></el-image></el-link>
           </el-col>

+ 3 - 2
src/layout/shuju/tongzhi.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="info">
         <el-col :span="24" class="topInfo">
-          <el-col :span="20" class="left">{{ title }}</el-col>
+          <el-col :span="20" class="left">通知公告</el-col>
+          <!-- {{ tongzhiList[0].column_name }} -->
           <el-col :span="4" class="more">
             <el-link :underline="false"><el-image :src="more"></el-image></el-link>
           </el-col>
@@ -13,7 +14,7 @@
             <li class="zixunList" v-for="(item, index) in tongzhiList" :key="index">
               <el-link :underline="false">
                 <span class="title textOver">{{ item.title }}</span>
-                <span class="date textOver">{{ item.date }}</span>
+                <span class="date textOver">{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
               </el-link>
             </li>
           </ul>

+ 4 - 1
src/store/index.js

@@ -6,7 +6,8 @@ import policyColumn from './policyColumn';
 import policyNews from './policyNews';
 import affairsColumn from './affairsColumn';
 import affairsNews from './affairsNews';
-
+import recordColumn from './recordColumn';
+import recordNews from './recordNews';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -17,6 +18,8 @@ export default new Vuex.Store({
     policyNews,
     affairsColumn,
     affairsNews,
+    recordColumn,
+    recordNews,
   },
   state: {},
   mutations: {},

+ 38 - 0
src/store/recordColumn.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  columnInfo: `/api/record/column`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.columnInfo}`, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.columnInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.columnInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.columnInfo}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.columnInfo}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 38 - 0
src/store/recordNews.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  newsInfo: `/api/record/news`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, column_id, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.newsInfo}`, { skip, limit, column_id, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.newsInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.newsInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.newsInfo}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.newsInfo}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 65 - 33
src/views/shuju/shuju.vue

@@ -1,11 +1,24 @@
 <template>
   <div id="shuju">
-    <shuju-detail :info="info" :imageList="imageList" :gonggaoList="gonggaoList" :shangbaoList="shangbaoList" :tongzhiList="tongzhiList"></shuju-detail>
+    <shuju-detail
+      :info="info"
+      :liebiaoList="liebiaoList"
+      :imageList="imageList"
+      :gonggaoList="tzggList"
+      :shangbaoList="shangbaoList"
+      :tongzhiList="tzggList"
+    ></shuju-detail>
   </div>
 </template>
 
 <script>
 import shujuDetail from '@/components/shuju/shuju.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+import _ from 'loadsh';
+const { mapActions: mapSite } = createNamespacedHelpers('site');
+const { mapActions: mappolicyColumn } = createNamespacedHelpers('recordColumn');
+const { mapActions: mapAffairsColumn } = createNamespacedHelpers('affairsColumn');
+const { mapActions: mapAffairsNews } = createNamespacedHelpers('affairsNews');
 export default {
   name: 'shuju',
   props: {},
@@ -13,16 +26,10 @@ export default {
     shujuDetail,
   },
   data: () => ({
-    info: {
-      logo: require('@/assets/logo.png'),
-      banquan: '版权所有:吉林省计算中心',
-      jishu: '技术支持:长春市福瑞科技有限公司',
-      youbian: '邮编:130000',
-      chuanzhen: '传真:239823982',
-      address: '地址:吉林省长春市朝阳区前进大街1244号',
-      phone: '电话:0431-1234567',
-      email: '邮箱:123456@163.com',
-    },
+    info: {},
+    // 分类导航
+    liebiaoList: {},
+    // 数据展示
     imageList: [
       {
         pic: require('@/assets/biao1.png'),
@@ -30,7 +37,6 @@ export default {
       {
         pic: require('@/assets/biao2.png'),
       },
-
       {
         pic: require('@/assets/biao3.png'),
       },
@@ -41,15 +47,9 @@ export default {
         pic: require('@/assets/biao5.png'),
       },
     ],
-
-    gonggaoList: [
-      {
-        title: '标题',
-      },
-      {
-        title: '六条数据',
-      },
-    ],
+    // 通知公告
+    tzggList: [],
+    // 上报通知
     shangbaoList: [
       {
         title: '标题',
@@ -60,20 +60,52 @@ export default {
         date: '2019-01-02',
       },
     ],
-    tongzhiList: [
-      {
-        title: '标题',
-        date: '2019-01-02',
-      },
-      {
-        title: '十条数据',
-        date: '2019-01-02',
-      },
-    ],
   }),
-  created() {},
+  async created() {
+    this.searchSite();
+    await this.policyColumn();
+    await this.affairsColumn();
+  },
   computed: {},
-  methods: {},
+  methods: {
+    ...mapSite(['showInfo']),
+    ...mappolicyColumn({ policyColumns: 'query', policyfetch: 'fetch' }),
+    ...mapAffairsColumn({ affairsColumns: 'query', affairsInfo: 'fetch' }),
+    ...mapAffairsNews({ affairsList: 'query' }),
+    // 查询站点信息
+    async searchSite() {
+      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 });
+      if (this.$checkRes(res)) {
+        this.$set(this, `liebiaoList`, res.data);
+      }
+    },
+    // 查询科技政务栏目
+    async affairsColumn({ ...info } = {}) {
+      const res = await this.affairsColumns({ ...info });
+      for (const val of res.data) {
+        this.kjzwSearch({ column_id: val.id, site: val.site });
+      }
+    },
+    async kjzwSearch({ skip = 0, limit = 10, column_id, site } = {}) {
+      console.log(column_id, site);
+      const res = await this.affairsList({ skip, limit, column_id: column_id });
+      for (const val of res.data) {
+        const result = await this.affairsInfo(val.column_id);
+        val.column_name = result.data.name;
+      }
+      this.$set(this, `${site}List`, res.data);
+      console.log(res.data);
+    },
+  },
 };
 </script>