张延森 4 年之前
父節點
當前提交
ed0d0ff2dc
共有 4 個文件被更改,包括 10670 次插入9 次删除
  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 查看文件

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

+ 1
- 1
src/util/Api.js 查看文件

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

+ 3
- 2
src/util/PublicMethod.js 查看文件

36
       method: target.method,
36
       method: target.method,
37
       url: Url,
37
       url: Url,
38
       data: Data,
38
       data: Data,
39
-      headers: { ...Header }
39
+      headers: { ...Header },
40
+      baseURL: process.env.NODE_ENV === 'production' ? 'http://api.xnsport.cn/' : '/'
40
     }
41
     }
41
     Axios({ ...aParams }).then(res => {
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
       if (token) { // 更新本地存储token
44
       if (token) { // 更新本地存储token
44
         window.localStorage.Jwt = token
45
         window.localStorage.Jwt = token
45
         window.localStorage.JwtTime = Date.now()
46
         window.localStorage.JwtTime = Date.now()

+ 10664
- 0
yarn.lock
文件差異過大導致無法顯示
查看文件