张延森 vor 4 Jahren
Ursprung
Commit
ed0d0ff2dc
4 geänderte Dateien mit 10670 neuen und 9 gelöschten Zeilen
  1. 2
    6
      config/index.js
  2. 1
    1
      src/util/Api.js
  3. 3
    2
      src/util/PublicMethod.js
  4. 10664
    0
      yarn.lock

+ 2
- 6
config/index.js Datei anzeigen

@@ -11,13 +11,9 @@ module.exports = {
11 11
     assetsSubDirectory: 'static',
12 12
     assetsPublicPath: '/',
13 13
     proxyTable: {
14
-      // '/api': {
15
-      //   target: 'http://123.57.65.31:9004',
16
-      //   changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
17
-      //   pathRewrite: { '^/api': '/api' }
18
-      // }
19 14
       '/api': {
20
-        target: 'https://app.xnsport.cn',
15
+        target: 'http://127.0.0.1:8080',
16
+        // target: 'https://app.xnsport.cn',
21 17
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
22 18
         pathRewrite: { '^/api': '/api' }
23 19
       }

+ 1
- 1
src/util/Api.js Datei anzeigen

@@ -1,5 +1,5 @@
1 1
 
2
-const prefix = process.env.NODE_ENV === 'production' ? '/api' : '/api'
2
+const prefix = '/api'
3 3
 
4 4
 const $api = {
5 5
   SendPrize: { // 派奖

+ 3
- 2
src/util/PublicMethod.js Datei anzeigen

@@ -36,10 +36,11 @@ const ToolClass = {
36 36
       method: target.method,
37 37
       url: Url,
38 38
       data: Data,
39
-      headers: { ...Header }
39
+      headers: { ...Header },
40
+      baseURL: process.env.NODE_ENV === 'production' ? 'http://api.xnsport.cn/' : '/'
40 41
     }
41 42
     Axios({ ...aParams }).then(res => {
42
-      const token = res.headers['x-authorization-jwt']
43
+      const token = res.headers['X-Authorization-JWT'] || res.headers['x-authorization-jwt'] || res.headers['X-AUTHORIZATION-JWT']
43 44
       if (token) { // 更新本地存储token
44 45
         window.localStorage.Jwt = token
45 46
         window.localStorage.JwtTime = Date.now()

+ 10664
- 0
yarn.lock
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen