Browse Source

Merge branch 'master' of http://git.dashitech.com/seimin/zy-wechat

maotao 7 months ago
parent
commit
ce785d66d3
3 changed files with 10 additions and 4 deletions
  1. 4 2
      http/http.js
  2. 3 0
      manifest.json
  3. 3 2
      pages/bindUser/bindUser.vue

+ 4 - 2
http/http.js

@@ -6,10 +6,12 @@ let path = "";
6
 let appIp = "";
6
 let appIp = "";
7
 let dsHost = "";
7
 let dsHost = "";
8
 // #ifdef H5
8
 // #ifdef H5
9
-let domainName = location.host; //域名+端口
9
+let pathname = location.pathname.split('/')[1]; //二级目录
10
+pathname = pathname ? '/' + pathname : '';
10
 let protocolName = document.location.protocol; //http协议
11
 let protocolName = document.location.protocol; //http协议
11
 let wsName = protocolName === 'http:' ? 'ws' : 'wss'; //ws协议
12
 let wsName = protocolName === 'http:' ? 'ws' : 'wss'; //ws协议
12
-path = `${protocolName}//${domainName}/service`;
13
+export const baseUrl = `${location.origin}${pathname}`;
14
+path = `${baseUrl}/service`;
13
 dsHost = location.hostname;
15
 dsHost = location.hostname;
14
 // #endif
16
 // #endif
15
 uni.setStorageSync('path', path);
17
 uni.setStorageSync('path', path);

+ 3 - 0
manifest.json

@@ -71,7 +71,10 @@
71
         "title" : "",
71
         "title" : "",
72
         "domain" : "",
72
         "domain" : "",
73
         "router" : {
73
         "router" : {
74
+            // 正常打包目录
74
             "base" : "/app/"
75
             "base" : "/app/"
76
+            // 宜昌打包目录
77
+            // "base" : "/dstechbh/app/"
75
         },
78
         },
76
         "optimization" : {
79
         "optimization" : {
77
             "treeShaking" : {
80
             "treeShaking" : {

+ 3 - 2
pages/bindUser/bindUser.vue

@@ -22,6 +22,7 @@
22
     get,
22
     get,
23
     post,
23
     post,
24
     SM,
24
     SM,
25
+    baseUrl,
25
     webHandle
26
     webHandle
26
   } from "../../http/http.js";
27
   } from "../../http/http.js";
27
   export default {
28
   export default {
@@ -103,10 +104,10 @@
103
                 if (result.confirm) {
104
                 if (result.confirm) {
104
                   console.log('用户点击确定',_this.type);
105
                   console.log('用户点击确定',_this.type);
105
                   if (_this.type) {
106
                   if (_this.type) {
106
-                    location.assign(location.origin + location.pathname + '#/pages/homePage/homePage?type=' +
107
+                    location.assign(baseUrl + '/' + '#/pages/homePage/homePage?type=' +
107
                       _this.type);
108
                       _this.type);
108
                   } else {
109
                   } else {
109
-                    location.assign(location.origin + location.pathname + '#/pages/homePage/homePage');
110
+                    location.assign(baseUrl + '/' + '#/pages/homePage/homePage');
110
                   }
111
                   }
111
                 } else if (result.cancel) {
112
                 } else if (result.cancel) {
112
                   console.log('用户点击取消');
113
                   console.log('用户点击取消');