ソースを参照

'代码优化'

simple 4 年 前
コミット
a5f2cd4f02
2 ファイル変更12 行追加7 行削除
  1. 5 3
      config/download.js
  2. 7 4
      config/fetch.js

+ 5 - 3
config/download.js

@@ -9,6 +9,8 @@ export default (url = '', baseUrl = '', data = {}, dataType = 'JSON', type = 'GE
     baseUrl = baseUrl;
   } else if (process.env.NODE_ENV === 'production') {
     if (baseUrl) {
+      let buildUrl = "https://pms.hajwy.com/"
+      // let buildUrl = "https://test.hajwy.com/"
       switch (baseUrl) {
         case '/landcrm':
           baseUrl = prodServer("landcrm");
@@ -54,15 +56,15 @@ export default (url = '', baseUrl = '', data = {}, dataType = 'JSON', type = 'GE
           baseUrl = prodServer("apartment");
           break;
         case '/purchase': //
-          baseUrl = "https://pms.hajwy.com/purchase";
+          baseUrl = buildUrl + "purchase";
           // baseUrl = "https://test.hajwy.com/purchase";
           break;
         case '/hajwy': //
-          baseUrl = "https://pms.hajwy.com/qpi/rest";
+          baseUrl = buildUrl + "qpi/rest";
           // baseUrl = "https://test.hajwy.com/qpi/rest";
           break;
         case '/mkf': //
-          baseUrl = "https://pms.hajwy.com/landcrm";
+          baseUrl = buildUrl + "landcrm";
           // baseUrl = "https://test.hajwy.com/landcrm";
           break;
         default:

+ 7 - 4
config/fetch.js

@@ -21,28 +21,31 @@ function initData(params) {
 
 let project = host.PROJECT;
 
+
 export default async (url = '', baseUrl = '', data = {}, dataType = 'JSON', type = 'GET', pathArr = [], method = 'fetch') => {
   type = type.toUpperCase();
   if (process.env.NODE_ENV === 'development') {
     baseUrl = baseUrl;
   } else if (process.env.NODE_ENV === 'production') {
     if (baseUrl) {
+      let buildUrl = "https://pms.hajwy.com/"
+      // let buildUrl = "https://test.hajwy.com/"
       switch (baseUrl) {
         case '/landcrm':
           // baseUrl = 'https://test.hajwy.com/landcrm';
-          baseUrl = 'https://pms.hajwy.com/landcrm';
+          baseUrl = buildUrl + 'landcrm';
           break;
         case '/purchase': //
           // baseUrl = "https://test.hajwy.com/purchase";
-          baseUrl = 'https://pms.hajwy.com/purchase';
+          baseUrl = buildUrl + 'purchase';
           break;
         case '/hajwy': //
           // baseUrl = "https://test.hajwy.com/qpi/rest";
-          baseUrl = 'https://pms.hajwy.com/qpi/rest';
+          baseUrl = buildUrl + 'qpi/rest';
           break;
         case '/mkf': //
           // baseUrl = "https://test.hajwy.com/landcrm";
-          baseUrl = 'https://pms.hajwy.com/landcrm';
+          baseUrl = buildUrl + 'landcrm';
           break;
         default:
           baseUrl = "";