Bladeren bron

money&time

HuaJingwen 6 jaren geleden
bovenliggende
commit
f9570c958d

+ 4 - 1
app.js

@@ -5,6 +5,7 @@ App({
5 5
   data:{
6 6
   },
7 7
   globalData: {
8
+    common: {},
8 9
     userInfo: null,
9 10
     HOST: 'https://chaoshi.henhaojie.com',
10 11
     platform: 0,
@@ -62,6 +63,7 @@ App({
62 63
                   if (resLogin.data.errno == 0) {
63 64
                     user = resLogin.data.rst;
64 65
                     wx.setStorageSync("user", user)
66
+                    app.globalData.common['token'] = user.token
65 67
                     if (func) {
66 68
                       func();
67 69
                     }
@@ -90,8 +92,8 @@ App({
90 92
                                     success: function (resLogin) {
91 93
                                       if (resLogin.data.errno == 0) {
92 94
                                         user = resLogin.data.rst;
93
-                                        // user_id = resLogin.data.rst.user_id;
94 95
                                         wx.setStorageSync("user", user)
96
+                                        app.globalData.common['token'] = user.token
95 97
                                         if (func) {
96 98
                                           func();
97 99
                                         }
@@ -119,6 +121,7 @@ App({
119 121
     wx.request({
120 122
       url: app.globalData.HOST + '/user/wx/share',
121 123
       method: 'POST',
124
+      data: app.globalData.common,
122 125
       success: function (res) {
123 126
         if (res.data.errno == '0'){
124 127
           title = res.data.rst.title;

+ 9 - 7
pages/application/application.js

@@ -31,7 +31,7 @@ Page({
31 31
       wx.request({
32 32
         url: app.globalData.HOST + '/user/wx/myapply',
33 33
         method: "POST",
34
-        data: {token: token, pageId: ++that.data.page},
34
+        data: Object.assign({}, app.globalData.common, {pageId: ++that.data.page}),
35 35
         success: function (res) {
36 36
           var data = res.data;
37 37
             // console.log(data);
@@ -69,7 +69,7 @@ Page({
69 69
     wx.request({
70 70
       url: app.globalData.HOST + '/user/wx/xykMyapply',
71 71
       method: "POST",
72
-      data: {token: token, pageId: ++that.data.page},
72
+      data: Object.assign({}, app.globalData.common, {pageId: ++that.data.page}),
73 73
       success: function (res) {
74 74
         var data = res.data;
75 75
           // console.log(data);
@@ -108,11 +108,13 @@ Page({
108 108
   onPullDownRefresh: function () {
109 109
     //下拉
110 110
     this.data.page = 0;
111
-    if (this.data.activeIndex == 0) {
112
-      this.initApplication();
113
-    }else{
114
-      this.initCardList();
115
-    }
111
+    setTimeout(() => {
112
+        if (this.data.activeIndex == 0) {
113
+          this.initApplication();
114
+        }else{
115
+          this.initCardList();
116
+        }
117
+    }, 600)
116 118
   },
117 119
   onReachBottom: function () {
118 120
     //上拉

+ 2 - 1
pages/card/card.js

@@ -51,7 +51,7 @@ Page({
51 51
     wx.request({
52 52
       url: app.globalData.HOST + '/user/CreditCard/list',
53 53
       method: "POST",
54
-      data: {pageId: ++this.data.page},
54
+      data: Object.assign({}, app.globalData.common, {pageId: ++this.data.page}),
55 55
       success: function (res) {
56 56
         if (res.data.errno == '0') {
57 57
           // data = res.data.rst.list;
@@ -71,6 +71,7 @@ Page({
71 71
     wx.request({
72 72
       url: app.globalData.HOST + '/user/CreditCard/bannerlist',
73 73
       method: "POST",
74
+      data: app.globalData.common,
74 75
       success: function (res) {
75 76
         if (res.data.errno == '0') {
76 77
           data = res.data.rst.data;

+ 3 - 3
pages/details/details.js

@@ -40,7 +40,7 @@ Page({
40 40
       wx.request({
41 41
         url: app.globalData.HOST + '/user/product/detail',
42 42
         method: "POST",
43
-        data: {id: that.data.id},
43
+        data: Object.assign({}, app.globalData.common, {id: that.data.id}),
44 44
         success: function (res) {
45 45
           if (res.data.errno == '0') {
46 46
             data = res.data.rst;
@@ -59,7 +59,7 @@ Page({
59 59
       wx.request({
60 60
         url: app.globalData.HOST + '/user/product/getSameAmountByProductId',
61 61
         method: "POST",
62
-        data: {id: that.data.id, platform: app.globalData.platform},
62
+        data: Object.assign({}, app.globalData.common, {id: that.data.id, platform: app.globalData.platform}),
63 63
         success: function (res) {
64 64
           if (res.data.errno == '0') {
65 65
             list = res.data.rst.data;
@@ -115,7 +115,7 @@ Page({
115 115
       wx.request({
116 116
         url: app.globalData.HOST + '/user/wx/known',
117 117
         method: "POST",
118
-        data: {id: id, },
118
+        data: Object.assign({}, app.globalData.common, {id: id}),
119 119
         success: function (res) {
120 120
         },
121 121
         complete: function () {

+ 2 - 2
pages/feedback/feedback.js

@@ -23,10 +23,10 @@ Page({
23 23
         wx.request({
24 24
           url: app.globalData.HOST + '/user/wx/addMessage',
25 25
           method: 'POST',
26
-          data: {
26
+          data: Object.assign({}, app.globalData.common, {
27 27
             token: token,
28 28
             content: value
29
-          },
29
+          }),
30 30
           success: function (res) {
31 31
             if (res.data.errno == 0) {
32 32
                 app.noticeModal('我们会及时处理,感谢您的反馈~', that.goMine)

+ 5 - 3
pages/find/find.js

@@ -37,6 +37,7 @@ Page({
37 37
     wx.request({
38 38
       url: app.globalData.HOST + '/user/wx/filter',
39 39
       method: "POST",
40
+      data: app.globalData.common,
40 41
       success: function (res) {
41 42
         var data = res.data.rst;
42 43
         if (res.data.errno == '0') {
@@ -103,14 +104,15 @@ Page({
103 104
     //下拉
104 105
     var that = this;
105 106
     that.data.page = 1;
106
-    utils.initList(that, that.data.obj, 'top', that.data.page);
107
-    // utils.initList(that, that.data.obj, that.data.page);
107
+    setTimeout(() => {
108
+        utils.initList(that, that.data.obj, that.data.page);
109
+    }, 500)
108 110
   },
109 111
   onReachBottom: function () {
110 112
     //上拉
111 113
     var that = this;
112 114
     if (that.data.hasNext) {
113
-      utils.initList(that, that.data.obj, 'bottom', ++that.data.page);
115
+      utils.initList(that, that.data.obj, ++that.data.page);
114 116
     }
115 117
   },
116 118
   onReady: function () {

+ 1 - 1
pages/getIt/getIt.js

@@ -22,7 +22,7 @@ Page({
22 22
       wx.request({
23 23
         url: app.globalData.HOST + '/user/wx/known',
24 24
         method: "POST",
25
-        data: {id: id, },
25
+        data: Object.assign({}, app.globalData.common, {id: id}),
26 26
         success: function (res) {
27 27
         },
28 28
         complete: function () {

+ 9 - 3
pages/index/index.js

@@ -21,10 +21,11 @@ Page({
21 21
       that.setData({source: options.source})
22 22
     }
23 23
     app.login(that);
24
+    const dataParam =  Object.assign({}, app.globalData.common, {version: 2, platform: app.globalData.platform});
24 25
     wx.request({
25 26
       url: app.globalData.HOST + '/user/product/homeact',
26 27
       method: 'POST',
27
-      data: {version: 2, platform: app.globalData.platform},
28
+      data: dataParam,
28 29
       success: function (res) {
29 30
         if (res.data.errno == '0'){
30 31
           that.setData({ imgUrls: res.data.rst.homeact});
@@ -44,12 +45,17 @@ Page({
44 45
   onPullDownRefresh: function () {
45 46
     //下拉
46 47
       var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
47
-      utils.initList(that, obj, 'top', ++that.data.page);
48
+      that.data.page = 1;
49
+      setTimeout(()=>{
50
+        utils.initList(that, obj, that.data.page);
51
+      }, 800)
48 52
   },
49 53
   onReachBottom: function () {
50 54
     //上拉
51 55
     var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
52
-    utils.initList(that, obj, 'bottom', ++that.data.page);
56
+    if (that.data.hasNext) {
57
+      utils.initList(that, obj, ++that.data.page);
58
+    }
53 59
   },
54 60
   onShareAppMessage: function () {
55 61
     return {

+ 9 - 9
pages/signup/signup.js

@@ -96,13 +96,13 @@ Page({
96 96
       } else {
97 97
           if (codeNotice == '获取验证码') {
98 98
             that.countDown(60);
99
+            const dataParam = Object.assign({}, app.globalData.common, {
100
+                phone: phone
101
+              })
99 102
             wx.request({
100 103
               url: app.globalData.HOST + '/user/wx/sendCode',
101 104
               method: 'POST',
102
-              data: {
103
-                token: token,
104
-                phone: phone
105
-              },
105
+              data: dataParam,
106 106
               success: function (errno) {
107 107
                 if (errno.data.errno == '0') {
108 108
                 }
@@ -135,14 +135,14 @@ Page({
135 135
               errorMsg: '手机号格式不正确'
136 136
             })
137 137
         }else{
138
+            const dataParam = Object.assign({}, app.globalData.common, {
139
+                phone: phone,
140
+                code: code
141
+              })
138 142
             wx.request({
139 143
               url: app.globalData.HOST + '/user/wx/bindMobile',
140 144
               method: 'POST',
141
-              data: {
142
-                token: token,
143
-                phone: phone,
144
-                code: code
145
-              },
145
+              data: dataParam,
146 146
               success: function (res) {
147 147
                 if (res.data.errno == '0') {
148 148
                   wx.setStorage({key:"tel", data: phone})

+ 3 - 3
utils/util.js

@@ -1,8 +1,7 @@
1 1
 // 请求列表数据
2 2
 var app = getApp();
3
-var initList = function (that, obj, orient, page) {
3
+var initList = function (that, obj, page) {
4 4
   that.setData({hidden: false});
5
-  orient = orient || '';
6 5
   var obj = obj || { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
7 6
   obj['page'] = page || 1;
8 7
   obj['platform'] = app.globalData.platform
@@ -12,10 +11,11 @@ var initList = function (that, obj, orient, page) {
12 11
   }else{
13 12
     list = that.data.dataList
14 13
   }
14
+  const dataParam = Object.assign({}, obj, app.globalData.common)
15 15
   wx.request({
16 16
     url: app.globalData.HOST + '/user/product/searchSecond',
17 17
     method: "POST",
18
-    data: obj,
18
+    data: dataParam,
19 19
     success: function (res) {
20 20
       var data = res.data.rst.data;
21 21
       if (res.data.errno == '0') {