linan 4 vuotta sitten
vanhempi
commit
0743c51d72

+ 1 - 0
package.json

@@ -32,6 +32,7 @@
     "eslint-plugin-vue": "^5.0.0",
     "node-sass": "^4.14.1",
     "prettier": "^1.18.2",
+    "qs": "^6.9.4",
     "sass-loader": "^9.0.0",
     "sass-resources-loader": "^2.0.3",
     "stylus": "^0.54.7",

+ 1 - 1
src/api/fileInfo.js

@@ -4,7 +4,7 @@ import { ajax } from "../sdk/ajax";
 /* 企业信息 */
 export const reqFirminfo = () => ajax("get", "/publics/sysconf/get", {code: 'huyang_company'})
 
-export const reqUpdateFirm = (data) => ajax("get", "/publics/sysconf/update", data)
+export const reqUpdateFirm = (data) => ajax("post", "/publics/sysconf/update", data)
 
 
 /* 牧场信息 */

+ 2 - 2
src/main.js

@@ -1,7 +1,7 @@
 import Vue from 'vue'
 import ElementUI from 'element-ui';
-import '../theme/index.css'
-// import 'element-ui/lib/theme-chalk/index.css';
+// import '../theme/index.css'
+import 'element-ui/lib/theme-chalk/index.css';
 import App from './App.vue'
 import router from './router'
 import store from './store'

+ 49 - 20
src/sdk/ajax.js

@@ -2,6 +2,7 @@ import Vue from 'vue';
 import axios from 'axios';
 import VueAxios from 'vue-axios';
 import config from './config'
+import Qs from 'qs';
 
 const { serverAddress } = config
 
@@ -14,25 +15,53 @@ Vue.use(VueAxios, axios)
 /* 常用ajax封装 (固定URL) */
 export const ajax = function (type = "post", url, params) {
     let token = localStorage.getItem("token")
-    return new Promise((resole, reject) => {
-        axios({
-            method: type,
-            url: serverAddress + url,
-            params,
-            headers: {
-                'Content-Type': 'application/x-www-form-urlencoded',
-				'x-auth-token': token
-            }
-        }).then((res) => {
-            switch(res.data.errCode) {
-                case 'request_not_authorize': // 登录过期
-                    let url = window.location.protocol + "//" + window.location.host + "/#/login"
-                    window.location.replace(url)
-                    break;
-            }
-            resole(res.data);
-        }).catch((err) => {
-            reject(err);
+    if(type.toLowerCase() == 'get'){
+        return new Promise((resole, reject) => {
+            axios({
+                method: type,
+                url: serverAddress + url,
+                params,
+                headers: {
+                    'Content-Type': 'application/x-www-form-urlencoded',
+                    'x-auth-token': token
+                }
+            }).then((res) => {
+                switch (res.data.errCode) {
+                    case 'request_not_authorize': // 登录过期
+                        let url = window.location.protocol + "//" + window.location.host + "/#/login"
+                        window.location.replace(url)
+                        break;
+                }
+                resole(res.data);
+            }).catch((err) => {
+                reject(err);
+            });
         });
-    });
+    } else {
+        return new Promise((resole, reject) => {
+            axios({
+                method: type,
+                url: serverAddress + url,
+                params,
+                paramsSerializer: function(params) {
+                    return Qs.stringify(params, {arrayFormat: 'brackets'})
+                },
+                headers: {
+                    'Content-Type': 'application/x-www-form-urlencoded',
+                    'x-auth-token': token
+                }
+            }).then((res) => {
+                switch (res.data.errCode) {
+                    case 'request_not_authorize': // 登录过期
+                        let url = window.location.protocol + "//" + window.location.host + "/#/login"
+                        window.location.replace(url)
+                        break;
+                }
+                resole(res.data);
+            }).catch((err) => {
+                reject(err);
+            });
+        });
+    }
+    
 }

+ 1 - 1
src/store/index.js

@@ -37,7 +37,7 @@ export default new Vuex.Store({
 				commit('setWorkerList', res.content)
 			})
 		},
-		/* 获取栋舍列表 登录后再 home、workerInfo时调用了*/
+		/* 获取栋舍列表 登录后再 home、areaInfo时调用了*/
 		getAreaList({ commit }) {
 			reqBuildList({
 				searchStr: '',

+ 7 - 7
src/views/Home/mencCofig.js

@@ -9,7 +9,7 @@ export const menuData = [
     // },
     {
         optionName: "档案信息",
-        iconClassName: "el-icon-setting",
+        iconClassName: "el-icon-files",
         index: '0',
         disabled: false, // 是否禁用
         childList: [
@@ -37,7 +37,7 @@ export const menuData = [
     },
     {
         optionName: "繁殖管理",
-        iconClassName: "el-icon-setting",
+        iconClassName: "el-icon-magic-stick",
         index: '1',
         disabled: false, // 是否禁用
         childList: [
@@ -125,7 +125,7 @@ export const menuData = [
 
     {
         optionName: "生产管理",
-        iconClassName: "el-icon-s-flag",
+        iconClassName: "el-icon-first-aid-kit",
         index: '3',
         disabled: false,
         childList: [
@@ -169,7 +169,7 @@ export const menuData = [
     },
     {
         optionName: "无害化管理",
-        iconClassName: "el-icon-s-flag",
+        iconClassName: "el-icon-set-up",
         index: '4',
         disabled: false,
         childList: [
@@ -187,7 +187,7 @@ export const menuData = [
     },
     {
         optionName: "物料管理",
-        iconClassName: "el-icon-s-flag",
+        iconClassName: "el-icon-news",
         index: '5',
         disabled: false,
         childList: [
@@ -215,7 +215,7 @@ export const menuData = [
     },
     {
         optionName: "育种管理",
-        iconClassName: "el-icon-s-flag",
+        iconClassName: "el-icon-bank-card",
         index: '6',
         disabled: false,
         childList: [
@@ -228,7 +228,7 @@ export const menuData = [
     },
     {
         optionName: "设备管理",
-        iconClassName: "el-icon-s-flag",
+        iconClassName: "el-icon-setting",
         index: '7',
         disabled: false,
         childList: [

+ 3 - 3
src/views/fileInfo/firmInfo.vue

@@ -53,8 +53,8 @@ export default {
                 name: "长兴湖羊",
                 email: "antdesign@alipay.com",
                 decription: "一个养殖平台",
-                province: "",
-                country: "",
+                province: "中国",
+                country: "浙江省",
                 city: "杭州市",
                 address: "西溪海创园",
                 tel: "0752-88888888"
@@ -74,7 +74,6 @@ export default {
             this.reqInfo.conf = JSON.stringify({data: JSON.stringify(tempArr)})
             reqUpdateFirm(this.reqInfo)
                 .then(res => {
-                    console.log(res);
                     this.$message.success("更新企业信息成功!")
                 })
                 .catch(err => {
@@ -88,6 +87,7 @@ export default {
                 .then(res => {
                     // 保留接口结构
                     this.reqInfo = res
+                    console.log(res)
                     let obj = {}
                     JSON.parse(res.conf.data).forEach(item => {
                         obj[item.key] = item.val

+ 1 - 2
src/views/fileInfo/pastureInfo.vue

@@ -56,7 +56,7 @@ export default {
                 email: "antdesign@alipay.com",
                 description: "一个养殖平台",
                 manager: "沈厂长",
-                managerPhone: '"18202780511"',
+                managerPhone: "18202780511",
                 province: "浙江省",
                 city: "杭州市",
                 address: "西湖区工专路 77 号"
@@ -76,7 +76,6 @@ export default {
             this.reqInfo.conf = JSON.stringify({data: JSON.stringify(tempArr)})
             reqUpdatePasture(this.reqInfo)
                 .then(res => {
-                    console.log(res);
                     this.$message.success("更新企业信息成功!")
                 })
                 .catch(err => {