wxy 4 tahun lalu
induk
melakukan
c44b53d144

+ 2 - 2
src/components/common/link1.vue

@@ -9,8 +9,8 @@
             </el-col>
             <el-col :span="21" class="linkImg">
               <el-col :span="6" v-for="(item, index) in links" :key="index" class="links">
-                <el-link :href="item.href1" :underline="false">
-                  <el-image :src="item.url"></el-image>
+                <el-link :href="item.url" :underline="false">
+                  <el-image :src="item.pic"></el-image>
                 </el-link>
               </el-col>
             </el-col>

+ 42 - 0
src/store/column.js

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

+ 10 - 1
src/store/index.js

@@ -1,5 +1,9 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
+import links from './links';
+import column from './column';
+import kjzxInfo from './kjzxInfo';
+import kjpxColumn from './kjpxColumn';
 
 Vue.use(Vuex);
 
@@ -7,5 +11,10 @@ export default new Vuex.Store({
   state: {},
   mutations: {},
   actions: {},
-  modules: {},
+  modules: {
+    links,
+    column,
+    kjzxInfo,
+    kjpxColumn,
+  },
 });

+ 42 - 0
src/store/kjpxColumn.js

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

+ 42 - 0
src/store/kjzxInfo.js

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

+ 42 - 0
src/store/links.js

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

+ 76 - 73
src/views/index.vue

@@ -10,9 +10,11 @@
         </el-col>
         <el-col :span="24" class="info">
           <div class="w_1200">
-            <el-col :span="6" class="one">
-              <img src="../assets/map.jpg" style="width: 100%; height: 100%" />
-              <p>创新地图提供科技企业的分布和位置信息</p>
+            <el-col :span="24" class="one">
+              <el-col :span="24" v-for="(item, index) in tpxw1" :key="index" style="width:100%; height:100%">
+                <el-image :src="item.picture" style="width:100%; height:100%"></el-image>
+                <p>{{ item.brief }}</p>
+              </el-col>
             </el-col>
             <el-col :span="18" class="two">
               <el-col :span="24" class="title">
@@ -28,10 +30,10 @@
                 <el-col :span="24" class="listInfo" v-for="(item, index) in zxzx" :key="index">
                   <el-col :span="20">
                     <span class="circle"></span>
-                    <span class="text">{{ item.text }}</span>
+                    <span class="text">{{ item.title }}</span>
                   </el-col>
                   <el-col :span="4" class="time">
-                    {{ item.time }}
+                    {{ item.create_time }}
                   </el-col>
                 </el-col>
               </el-col>
@@ -49,12 +51,12 @@
                 </el-col>
                 <el-col :span="24" class="list">
                   <el-col :span="24" class="listInfo" v-for="(item, index) in tzgg" :key="index">
-                    <el-col :span="20">
+                    <el-col :span="18">
                       <span class="circle"></span>
-                      <span class="text">{{ item.text }}</span>
+                      <span class="text">{{ item.title }}</span>
                     </el-col>
-                    <el-col :span="4" class="time">
-                      {{ item.time }}
+                    <el-col :span="6" class="time">
+                      {{ item.create_time }}
                     </el-col>
                   </el-col>
                 </el-col>
@@ -70,13 +72,13 @@
                   </el-col>
                 </el-col>
                 <el-col :span="24" class="list">
-                  <el-col :span="24" class="listInfo" v-for="(item, index) in tzgg" :key="index">
-                    <el-col :span="20">
+                  <el-col :span="24" class="listInfo" v-for="(item, index) in zcfg" :key="index">
+                    <el-col :span="18">
                       <span class="circle"></span>
-                      <span class="text">{{ item.text }}</span>
+                      <span class="text">{{ item.title }}</span>
                     </el-col>
-                    <el-col :span="4" class="time">
-                      {{ item.time }}
+                    <el-col :span="6" class="time">
+                      {{ item.create_time }}
                     </el-col>
                   </el-col>
                 </el-col>
@@ -119,6 +121,9 @@ import top from '../components/common/top.vue';
 import menus from '../components/common/menus.vue';
 import foot from '../components/common/foot1.vue';
 import link1 from '../components/common/link1.vue';
+const { mapActions: link } = createNamespacedHelpers('links');
+const { mapActions: column } = createNamespacedHelpers('column');
+const { mapActions: kjzxInfo } = createNamespacedHelpers('kjzxInfo');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -133,63 +138,7 @@ export default {
   },
   data: function() {
     return {
-      zxzx: [
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-      ],
-      tzgg: [
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-      ],
-      links: [
-        {
-          url: require('../assets/link2.jpg'),
-          href1: '',
-        },
-        {
-          url: require('../assets/link.jpg'),
-          href1: '',
-        },
-        {
-          url: require('../assets/link3.jpg'),
-          href1: '',
-        },
-        {
-          url: require('../assets/link3.jpg'),
-          href1: '',
-        },
-      ],
+      links: [],
       imgs: [
         {
           url: require('../assets/service1.jpg'),
@@ -224,10 +173,64 @@ export default {
           href1: '',
         },
       ],
+      //科技资讯下栏目
+      kjdtColumn: [],
+      //图片新闻信息
+      tpxw1: [],
+      //最新资讯信息
+      zxzx: [],
+      //通知公告
+      tzgg: [],
+      //政策法规
+      zcfg: [],
     };
   },
-  created() {},
+  created() {
+    this.search();
+    this.searchColumn();
+  },
   methods: {
+    ...link({ linkquery: 'query', linkcreate: 'create', linkfetch: 'fetch', linkupdate: 'update', linkdelete: 'delete' }),
+    ...column({ columnquery: 'query', columncreate: 'create', columnfetch: 'fetch', columnupdate: 'update', columndelete: 'delete' }),
+    ...kjzxInfo({ kjzxquery: 'query', kjzxcreate: 'create', kjzxfetch: 'fetch', kjzxupdate: 'update', kjzxdelete: 'delete' }),
+    //查询列表
+    async search() {
+      const res = await this.linkquery();
+      if (this.$checkRes(res)) {
+        this.$set(this, `links`, res.data);
+      }
+    },
+    //查询栏目
+    async searchColumn() {
+      const res = await this.columnquery();
+      if (res.errcode === 0) {
+        this.$set(this, `kjdtColumn`, res.data);
+        this.search1();
+      }
+    },
+    async search1() {
+      let col = this.kjdtColumn;
+      let tpxw = col.find(i => i.site == 'tpxw');
+      const res = await this.kjzxquery({ column_id: tpxw.id });
+      if (res.errcode === 0) {
+        this.$set(this, `tpxw1`, res.data);
+      }
+      let zxzx = col.find(i => i.site == 'zxzx');
+      const res2 = await this.kjzxquery({ column_id: zxzx.id, limit: 8 });
+      if (res2.errcode === 0) {
+        this.$set(this, `zxzx`, res2.data);
+      }
+      let tzgg = col.find(i => i.site == 'tztg');
+      const res3 = await this.kjzxquery({ column_id: tzgg.id, limit: 8 });
+      if (res3.errcode === 0) {
+        this.$set(this, `tzgg`, res3.data);
+      }
+      let zcfg = col.find(i => i.site == 'zcfg');
+      const res4 = await this.kjzxquery({ column_id: zcfg.id, limit: 8 });
+      if (res4.errcode === 0) {
+        this.$set(this, `zcfg`, res4.data);
+      }
+    },
     to() {
       this.$router.push({ path: '/list' });
     },
@@ -286,7 +289,7 @@ export default {
         overflow: hidden;
         .listInfo {
           .text {
-            width: 280px;
+            width: 250px;
           }
           .time {
             font-size: 13px;

+ 58 - 46
src/views/kjzx/index.vue

@@ -12,8 +12,10 @@
           <div class="w_1200">
             <el-col :span="6" class="con">
               <el-col :span="24" class="one">
-                <img src="../../assets/news.jpg" style="width: 100%; height: 100%" />
-                <p>提示信息</p>
+                <el-col :span="24" v-for="(item, index) in tpxw1" :key="index" style="width:100%; height:100%">
+                  <el-image :src="item.picture" style="width:100%; height:100%"></el-image>
+                  <p>{{ item.brief }}</p>
+                </el-col>
               </el-col>
               <el-col :span="24" class="two">
                 <el-col :span="24" class="title">
@@ -27,12 +29,12 @@
                 </el-col>
                 <el-col :span="24" class="list">
                   <el-col :span="24" class="listInfo" v-for="(item, index) in zxzx" :key="index">
-                    <el-col :span="20">
+                    <el-col :span="18">
                       <span class="circle"></span>
-                      <span class="text">{{ item.text }}</span>
+                      <span class="text">{{ item.title }}</span>
                     </el-col>
-                    <el-col :span="4" class="time">
-                      {{ item.time }}
+                    <el-col :span="6" class="time">
+                      {{ item.create_time }}
                     </el-col>
                   </el-col>
                 </el-col>
@@ -52,10 +54,10 @@
                 <el-col :span="24" class="listInfo" v-for="(item, index) in kjdt" :key="index">
                   <el-col :span="20">
                     <span class="circle"></span>
-                    <span class="text">{{ item.text }}</span>
+                    <span class="text">{{ item.title }}</span>
                   </el-col>
                   <el-col :span="4" class="time">
-                    {{ item.time }}
+                    {{ item.create_time }}
                   </el-col>
                 </el-col>
               </el-col>
@@ -75,6 +77,8 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 import top from '../../components/common/top.vue';
 import menus from '../../components/common/menus.vue';
 import foot from '../../components/common/foot1.vue';
+const { mapActions: column } = createNamespacedHelpers('column');
+const { mapActions: kjzxInfo } = createNamespacedHelpers('kjzxInfo');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -89,46 +93,49 @@ export default {
 
   data: function() {
     return {
-      zxzx: [
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '12-05' },
-      ],
-      kjdt: [
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-        { text: '2019年中国科学院、中国工程院新增两名吉林省院士', time: '2019-12-05' },
-      ],
+      //科技资讯下所有栏目
+      kjdtColumn: [],
+      //图片新闻信息
+      tpxw1: [],
+      //科技动态信息
+      kjdt: [],
+      //最新资讯信息
+      zxzx: [],
     };
   },
-  created() {},
-  methods: {},
+  created() {
+    this.searchColumn();
+  },
+  methods: {
+    ...column({ columnquery: 'query', columncreate: 'create', columnfetch: 'fetch', columnupdate: 'update', columndelete: 'delete' }),
+    ...kjzxInfo({ kjzxquery: 'query', kjzxcreate: 'create', kjzxfetch: 'fetch', kjzxupdate: 'update', kjzxdelete: 'delete' }),
+    //查询栏目
+    async searchColumn() {
+      const res = await this.columnquery();
+      if (res.errcode === 0) {
+        this.$set(this, `kjdtColumn`, res.data);
+        this.search();
+      }
+    },
+    async search() {
+      let col = this.kjdtColumn;
+      let tpxw = col.find(i => i.site == 'tpxw');
+      const res = await this.kjzxquery({ column_id: tpxw.id });
+      if (res.errcode === 0) {
+        this.$set(this, `tpxw1`, res.data);
+      }
+      let kjdt = col.find(i => i.site == 'kjdt');
+      const res1 = await this.kjzxquery({ column_id: kjdt.id, limit: 16 });
+      if (res1.errcode === 0) {
+        this.$set(this, `kjdt`, res1.data);
+      }
+      let zxzx = col.find(i => i.site == 'zxzx');
+      const res2 = await this.kjzxquery({ column_id: zxzx.id, limit: 7 });
+      if (res2.errcode === 0) {
+        this.$set(this, `zxzx`, res2.data);
+      }
+    },
+  },
   computed: {
     ...mapState(['user']),
   },
@@ -172,6 +179,11 @@ export default {
       .list {
         height: 235px;
         overflow: hidden;
+        .listInfo {
+          .text {
+            width: 340px;
+          }
+        }
       }
     }
   }

+ 1 - 1
vue.config.js

@@ -22,7 +22,7 @@ module.exports = {
         target: 'http://free.liaoningdoupo.com',
       },
       '/api': {
-        target: 'http://free.liaoningdoupo.com',
+        target: 'http://192.168.1.91:8090',
         changeOrigin: true,
         ws: true,
       },