张延森 4 years ago
parent
commit
4e0d6bf877
3 changed files with 4 additions and 2 deletions
  1. 1
    0
      config/dev.js
  2. 1
    0
      config/prod.js
  3. 2
    2
      src/util/PublicMethod/index.js

+ 1
- 0
config/dev.js View File

@@ -3,6 +3,7 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
+    SERVER_API: '"https://dev.fangdeal.cn/liyuanhui/api/wx"'
6 7
   },
7 8
   mini: {},
8 9
   h5: {}

+ 1
- 0
config/prod.js View File

@@ -3,6 +3,7 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
+    SERVER_API: '"https://dev.fangdeal.cn/liyuanhui/api/wx"'
6 7
   },
7 8
   mini: {},
8 9
   h5: {

+ 2
- 2
src/util/PublicMethod/index.js View File

@@ -39,7 +39,7 @@ const ToolClass = {
39 39
       Header['X-Authorization-Jwt'] = wx.getStorageSync('token')
40 40
     }
41 41
     wx.request({
42
-      url: `https://dev.fangdeal.cn/liyuanhui/wx${config.url}`,
42
+      url: `${SERVER_API}${config.url}`,
43 43
       method: config.method,
44 44
       ...(config.data || {}),
45 45
       header: { ...Header },
@@ -51,7 +51,7 @@ const ToolClass = {
51 51
           wx.login({ // 微信获取code
52 52
             success (subRes) {
53 53
               wx.request({ // 登录获取token
54
-                url: `https://dev.fangdeal.cn/liyuanhui/wx/login?code=${subRes.code}`,
54
+                url: `${SERVER_API}/login?code=${subRes.code}`,
55 55
                 method: `post`,
56 56
                 success: (cRes) => {
57 57
                   if (cRes.header['X-Authorization-Jwt'] !== undefined) { // 更新本地存储token