Browse Source

解决冲突

maotao 7 months ago
parent
commit
95e1bded2d
2 changed files with 12 additions and 5 deletions
  1. 10 3
      http/http.js
  2. 2 2
      manifest.json

+ 10 - 3
http/http.js

@@ -1,7 +1,12 @@
1
-export const path = `${location.origin}/service`
2 1
 // #ifdef H5
3 2
 import wx from 'weixin-jsapi'
4 3
 // #endif
4
+let dsHost = "";
5
+// #ifdef H5
6
+dsHost = location.hostname;
7
+// #endif
8
+
9
+export const path = `${location.origin}/service`
5 10
 // get方法
6 11
 export function get(url, data = {}) {
7 12
   url = path + url;
@@ -10,7 +15,8 @@ export function get(url, data = {}) {
10 15
       url,
11 16
       data,
12 17
       header: {
13
-        'Cache-Control': 'no-cache'
18
+        'Cache-Control': 'no-cache',
19
+        'Ds-Host': dsHost,
14 20
       },
15 21
       success(res) {
16 22
         if(res.statusCode === 200){
@@ -42,7 +48,8 @@ export function post(url, data = {}) {
42 48
       url,
43 49
       data,
44 50
       header: {
45
-        'Cache-Control': 'no-cache'
51
+        'Cache-Control': 'no-cache',
52
+        'Ds-Host': dsHost,
46 53
       },
47 54
       success(res) {
48 55
         if(res.statusCode === 200){

+ 2 - 2
manifest.json

@@ -62,13 +62,13 @@
62 62
         "devServer" : {
63 63
             "proxy" : {
64 64
                 "/service" : {
65
-                    "target" : "http://192.168.3.111", //请求的目标域名
65
+                    "target" : "http://192.168.3.108", //请求的目标域名
66 66
 										// "target" : "http://192.168.4.163", //宋程玉本地
67 67
                     "changeOrigin" : true, //是否跨域
68 68
                     "secure" : false
69 69
                 },
70 70
                 "/file" : {
71
-                    "target" : "http://192.168.3.111", //请求的目标域名
71
+                    "target" : "http://192.168.3.108", //请求的目标域名
72 72
                     "changeOrigin" : true, //是否跨域
73 73
                     "secure" : false
74 74
                 }