ソースを参照

站点信息更新

guhongwei 5 年 前
コミット
5d0a8c6595
7 ファイル変更109 行追加31 行削除
  1. 1 2
      src/components/index.vue
  2. 5 14
      src/layout/index/foot.vue
  3. 9 2
      src/layout/index/logo.vue
  4. 4 1
      src/store/index.js
  5. 43 0
      src/store/site.js
  6. 18 12
      src/views/index.vue
  7. 29 0
      vue.config.js

+ 1 - 2
src/components/index.vue

@@ -188,7 +188,6 @@ export default {
 .foot {
   float: left;
   width: 100%;
-  height: 120px;
-  overflow: hidden;
+  min-height: 120px;
 }
 </style>

+ 5 - 14
src/layout/index/foot.vue

@@ -3,13 +3,7 @@
     <el-row>
       <el-col :span="24" class="foot">
         <div class="div">
-          <p>{{ info.banquan }}</p>
-          <p>{{ info.jishu }}</p>
-          <p>{{ info.youbian }}</p>
-          <p>{{ info.chuanzhen }}</p>
-          <p>{{ info.address }}</p>
-          <p>{{ info.phone }}</p>
-          <p>{{ info.email }}</p>
+          <p v-html="info.content"></p>
         </div>
       </el-col>
     </el-row>
@@ -31,28 +25,25 @@ export default {
 </script>
 
 <style lang="less" scoped>
-p {
+/deep/.foot p p {
   padding: 0;
   margin: 0;
 }
 .foot {
   width: 100%;
-  height: 120px;
+  min-height: 120px;
   background-color: rgba(0, 0, 0, 0.4);
   overflow: hidden;
 }
 .foot .div {
   width: 650px;
-  margin: 20px auto;
+  margin: 0 auto;
 }
 .foot p {
   float: left;
   color: #858f9b;
   font-size: 14px;
   margin-right: 24px;
-  line-height: 24px;
-}
-.foot p:first-child {
-  float: none;
+  line-height: 30px;
 }
 </style>

+ 9 - 2
src/layout/index/logo.vue

@@ -2,7 +2,12 @@
   <div id="logo">
     <el-row>
       <el-col :span="24" class="logo">
-        <el-image style="width:690px;height:66px;" :src="info.logo"></el-image>
+        <span v-if="info.logourl">
+          <el-image style="width:690px;height:66px;" :src="info.logourl"></el-image>
+        </span>
+        <span v-else>
+          <el-image style="width:690px;height:66px;" :src="logourl"></el-image>
+        </span>
       </el-col>
     </el-row>
   </div>
@@ -15,7 +20,9 @@ export default {
     info: null,
   },
   components: {},
-  data: () => ({}),
+  data: () => ({
+    logourl: require('@/assets/logo.png'),
+  }),
   created() {},
   computed: {},
   methods: {},

+ 4 - 1
src/store/index.js

@@ -1,11 +1,14 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
+import site from './site';
 
 Vue.use(Vuex);
 
 export default new Vuex.Store({
+  modules: {
+    site,
+  },
   state: {},
   mutations: {},
   actions: {},
-  modules: {},
 });

+ 43 - 0
src/store/site.js

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

+ 18 - 12
src/views/index.vue

@@ -15,6 +15,8 @@
 
 <script>
 import indexDetail from '@/components/index.vue';
+import { createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('site');
 export default {
   name: 'index',
   props: {},
@@ -22,16 +24,7 @@ export default {
     indexDetail,
   },
   data: () => ({
-    info: {
-      logo: require('@/assets/logo.png'),
-      banquan: '版权所有:吉林省计算中心',
-      jishu: '技术支持:长春市福瑞科技有限公司',
-      youbian: '邮编:130000',
-      chuanzhen: '传真:239823982',
-      address: '地址:吉林省长春市朝阳区前进大街1244号',
-      phone: '电话:0431-1234567',
-      email: '邮箱:123456@163.com',
-    },
+    info: {},
     map: require('@/assets/map.jpg'),
     zixunList: [
       {
@@ -102,9 +95,22 @@ export default {
       },
     ],
   }),
-  created() {},
+  created() {
+    this.search();
+  },
   computed: {},
-  methods: {},
+  methods: {
+    ...mapActions(['showInfo']),
+    async search() {
+      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');
+      }
+    },
+  },
 };
 </script>
 

+ 29 - 0
vue.config.js

@@ -22,6 +22,35 @@ module.exports = {
         changeOrigin: true,
         ws: true,
       },
+      '/files': {
+        target: 'http://smart.cc-lotus.info',
+      },
+      '/api/setting': {
+        target: 'http://10.16.9.108:9000',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api/affairs': {
+        target: 'http://10.16.9.108:9002',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api/policy': {
+        target: 'http://10.16.9.108:9003',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api/record': {
+        target: 'http://10.16.9.108:9005',
+        changeOrigin: true,
+        ws: true,
+      },
+      '/api/serve': {
+        target: 'http://10.16.9.108:9006',
+        changeOrigin: true,
+        ws: true,
+        // pathRewrite: { '^/api/affairs': '/api' },
+      },
     },
   },
 };