chengjie 6 years ago
parent
commit
5face51e59
7 changed files with 100 additions and 38 deletions
  1. 5 6
      app.js
  2. 5 2
      pages/index/index.js
  3. 16 1
      pages/main/default.js
  4. 70 26
      pages/other/binding.js
  5. 1 0
      pages/other/userbook.js
  6. 1 1
      pages/other/userbook.wxml
  7. 2 2
      project.config.json

+ 5 - 6
app.js

@@ -2,12 +2,11 @@
2
 App({
2
 App({
3
   onLaunch: function (options) {
3
   onLaunch: function (options) {
4
     this.getSystemInfo();
4
     this.getSystemInfo();
5
+  },
6
+  onShow: function(options) {
5
     if (options && options.scene) {
7
     if (options && options.scene) {
6
       this.globalData.userSource = options.scene;
8
       this.globalData.userSource = options.scene;
7
-      console.log("options.scene:" + options.scene);
8
-    }
9
-    if (options && options.shareTicket) {
10
-      this.globalData.shareTicket = options.shareTicket;
9
+      console.log("options.scene2:" + options.scene);
11
     }
10
     }
12
   },
11
   },
13
   getSystemInfo: function () {
12
   getSystemInfo: function () {
@@ -32,8 +31,8 @@ App({
32
     }
31
     }
33
   },
32
   },
34
   globalData: {
33
   globalData: {
35
-    Version: "1.5.3",
36
-    IsProduction: false,
34
+    Version: "1.5.4",
35
+    IsProduction: true,
37
     ShareTitle: "高效学习从秒过开始",
36
     ShareTitle: "高效学习从秒过开始",
38
     SharePath: "pages/index/index",
37
     SharePath: "pages/index/index",
39
     ShareImage: '../images/program_screenshot_main.png',
38
     ShareImage: '../images/program_screenshot_main.png',

+ 5 - 2
pages/index/index.js

@@ -64,7 +64,7 @@ Page({
64
       else if (options.type == "bebound") {
64
       else if (options.type == "bebound") {
65
         this.setData({
65
         this.setData({
66
           gotoType: "bebound",
66
           gotoType: "bebound",
67
-          gotoUrl: "../other/binding?type=bebound&ParentUserID=" + options.ParentUserID + "&NickName=" + options.NickName + "&AvatarUrl=" + options.AvatarUrl,
67
+          gotoUrl: "../other/binding?type=bebound&ParentUserID=" + options.ParentUserID + "&NickName=" + options.NickName + "&AvatarUrl=" + options.AvatarUrl + "&BindTime=" + options.BindTime,
68
         });
68
         });
69
       }
69
       }
70
       else if (options.type == "lesson") {
70
       else if (options.type == "lesson") {
@@ -200,6 +200,9 @@ Page({
200
 
200
 
201
   login: function (param) {
201
   login: function (param) {
202
     var that = this;
202
     var that = this;
203
+    //var userSource = wx.getLaunchOptionsSync();
204
+    //console.log("userSource1:" + userSource.scene);
205
+    //console.log("userSource2:" + app.globalData.userSource);
203
 
206
 
204
     main.getLocalHost(function () {
207
     main.getLocalHost(function () {
205
       main.postData('MiaoguoLogin', {
208
       main.postData('MiaoguoLogin', {
@@ -345,7 +348,7 @@ Page({
345
 
348
 
346
     });
349
     });
347
   },
350
   },
348
-
351
+  
349
   onShareAppMessage: function () {
352
   onShareAppMessage: function () {
350
     return {
353
     return {
351
       title: app.globalData.ShareTitle,
354
       title: app.globalData.ShareTitle,

+ 16 - 1
pages/main/default.js

@@ -37,7 +37,9 @@ Page({
37
         });
37
         });
38
       }
38
       }
39
     }
39
     }
40
-    
40
+
41
+    this.checkMemory();
42
+
41
   },
43
   },
42
   onHide:function(){
44
   onHide:function(){
43
     wx.hideLoading();
45
     wx.hideLoading();
@@ -263,6 +265,19 @@ Page({
263
     wx.setStorageSync("IsShowMarketingTime", common.formatTime(common.addDate("d",7,new Date())));
265
     wx.setStorageSync("IsShowMarketingTime", common.formatTime(common.addDate("d",7,new Date())));
264
 
266
 
265
   },
267
   },
268
+  checkMemory: function () {
269
+    wx.onMemoryWarning(function () {
270
+      wx.showModal({
271
+        title: '手机内存不足',
272
+        content: '请先清理内存再用秒过。内存不足会导致小程序异常或被迫退出。',
273
+        showCancel: false,
274
+        confirmText: '知道了',
275
+        success: function (res) {
276
+
277
+        }
278
+      });
279
+    });
280
+  },
266
   onShareAppMessage: function () {
281
   onShareAppMessage: function () {
267
     return {
282
     return {
268
       title: app.globalData.ShareTitle,
283
       title: app.globalData.ShareTitle,

+ 70 - 26
pages/other/binding.js

@@ -8,22 +8,37 @@ Page({
8
   },
8
   },
9
   onLoad: function (options) {
9
   onLoad: function (options) {
10
     var that = this;
10
     var that = this;
11
+
11
     if (options && options.type && options.type == "bebound") {
12
     if (options && options.type && options.type == "bebound") {
13
+      var bBind = 0;
14
+      //console.log("userSource3:" + app.globalData.userSource);
12
       
15
       
13
-      if (app.globalData.userSource == "1044" || app.globalData.userSource == "1008"){
14
-        wx.showModal({
15
-          title: '抱歉',
16
-          content: '绑定功能只能用于朋友单聊',
17
-          showCancel: false,
18
-          confirmText: "知道了",
19
-          success: function () {
20
-            wx.reLaunch({
21
-              url: '../index/index',
22
-            })
16
+
17
+      var arrUserSource = [1007, 1037, 1089, 1006, 1001, 1005, 1048, 1012, 1024, 1042, 1011, 1106, 1035, 1047, 1020, 1013, 1053];
18
+      for (var i = 0; i < arrUserSource.length; i++) {
19
+        if (app.globalData.userSource == arrUserSource[i]) {
20
+          bBind = 1;
21
+          break;
22
+        }
23
+      }
24
+      if (options && options.BindTime) {
25
+        var time = new Date(options.BindTime);
26
+        var timeNow = new Date();
27
+        var sub = common.diffDate("s", time, timeNow);
28
+
29
+        if (app.globalData.userSource==1006) {
30
+          if (sub > 86400) {
31
+            bBind = -1;
23
           }
32
           }
24
-        });
33
+        }
34
+        else{
35
+          if (sub > 180) {
36
+            bBind = -1;
37
+          }
38
+        }
25
       }
39
       }
26
-      else{
40
+
41
+      if (bBind == 1) {
27
         that.setData({
42
         that.setData({
28
           ShowPanel: "bebound",
43
           ShowPanel: "bebound",
29
           ParentUserID: options.ParentUserID,
44
           ParentUserID: options.ParentUserID,
@@ -31,16 +46,44 @@ Page({
31
         });
46
         });
32
         that.download(options.AvatarUrl);
47
         that.download(options.AvatarUrl);
33
       }
48
       }
49
+      else {
50
+        if (bBind == -1) {
51
+          wx.showModal({
52
+            title: '请求时间过期',
53
+            content: '请联系邀请人,再次私聊发给您。',
54
+            showCancel: false,
55
+            confirmText: "知道了",
56
+            success: function () {
57
+              wx.reLaunch({
58
+                url: '../index/index',
59
+              });
60
+            }
61
+          });
62
+        }
63
+        else {
64
+          wx.showModal({
65
+            title: '无效邀请',
66
+            content: '发群无效。请联系邀请人,单独私聊发给您。',
67
+            showCancel: false,
68
+            confirmText: "知道了",
69
+            success: function () {
70
+              wx.reLaunch({
71
+                url: '../index/index',
72
+              });
73
+            }
74
+          });
75
+        }
76
+      }
34
     }
77
     }
35
     else {
78
     else {
36
       main.getData("GetUserBindingList?UserID=" + app.globalData.userInfo.UserID, function (data) {
79
       main.getData("GetUserBindingList?UserID=" + app.globalData.userInfo.UserID, function (data) {
37
-        if (data && data.length>0){
80
+        if (data && data.length > 0) {
38
           that.setData({
81
           that.setData({
39
-            List:data,
82
+            List: data,
40
             ShowPanel: "unbinding",
83
             ShowPanel: "unbinding",
41
           });
84
           });
42
         }
85
         }
43
-        else{
86
+        else {
44
           that.setData({
87
           that.setData({
45
             ShowPanel: "binding",
88
             ShowPanel: "binding",
46
           });
89
           });
@@ -52,10 +95,10 @@ Page({
52
       Containnerheight: main.getWindowHeight(),
95
       Containnerheight: main.getWindowHeight(),
53
     });
96
     });
54
   },
97
   },
55
-  download: function (avatarUrl){
56
-    var that=this;
98
+  download: function (avatarUrl) {
99
+    var that = this;
57
     wx.downloadFile({
100
     wx.downloadFile({
58
-      url: avatarUrl, 
101
+      url: avatarUrl,
59
       success(res) {
102
       success(res) {
60
         if (res.statusCode === 200) {
103
         if (res.statusCode === 200) {
61
           that.setData({
104
           that.setData({
@@ -65,9 +108,9 @@ Page({
65
       }
108
       }
66
     });
109
     });
67
   },
110
   },
68
-  onShow: function () {
111
+  onShow: function (options) {
69
     var that = this;
112
     var that = this;
70
-    if (app.globalData.userInfo.IsShow==1){
113
+    if (app.globalData.userInfo.IsShow == 1) {
71
       wx.getSetting({
114
       wx.getSetting({
72
         success(res) {
115
         success(res) {
73
           if (res.authSetting['scope.userInfo']) {
116
           if (res.authSetting['scope.userInfo']) {
@@ -83,14 +126,14 @@ Page({
83
     }
126
     }
84
   },
127
   },
85
   shareFinished: function () {
128
   shareFinished: function () {
86
-    setTimeout(function(){
129
+    setTimeout(function () {
87
       wx.showModal({
130
       wx.showModal({
88
         title: '等待对方接受邀请',
131
         title: '等待对方接受邀请',
89
         content: '请尽快与对方联系确认邀请',
132
         content: '请尽快与对方联系确认邀请',
90
         showCancel: false,
133
         showCancel: false,
91
         confirmText: "知道了",
134
         confirmText: "知道了",
92
       });
135
       });
93
-    },3000);
136
+    }, 3000);
94
   },
137
   },
95
   gotoBinding: function () {
138
   gotoBinding: function () {
96
     var that = this;
139
     var that = this;
@@ -110,14 +153,15 @@ Page({
110
   },
153
   },
111
   onShareAppMessage: function () {
154
   onShareAppMessage: function () {
112
     if (this.data.ShowPanel == "binding") {
155
     if (this.data.ShowPanel == "binding") {
113
-      var path = '/pages/index/index?type=bebound&ParentUserID=' + app.globalData.userInfo.UserID;
156
+      var time = common.formatTime(new Date());
157
+      var path = '/pages/index/index?type=bebound&ParentUserID=' + app.globalData.userInfo.UserID + '&BindTime=' + time;
114
       path += "&NickName=" + app.globalData.userInfo.NickName;
158
       path += "&NickName=" + app.globalData.userInfo.NickName;
115
       path += "&AvatarUrl=" + app.globalData.userInfo.AvatarUrl;
159
       path += "&AvatarUrl=" + app.globalData.userInfo.AvatarUrl;
116
-      var time = common.formatTime(new Date());
160
+      //console.log(path);
117
       return {
161
       return {
118
-        title: "帐号绑定 "+time,
162
+        title: "帐号绑定 " + time,
119
         path: path,
163
         path: path,
120
-        imageUrl: app.globalData.uploadImageUrl +"web/program_screenshot_bindaccount.png",
164
+        imageUrl: app.globalData.uploadImageUrl + "web/program_screenshot_bindaccount.png",
121
       }
165
       }
122
     }
166
     }
123
   },
167
   },

+ 1 - 0
pages/other/userbook.js

@@ -73,6 +73,7 @@ Page({
73
       IsPay: app.globalData.userInfo.IsPay,
73
       IsPay: app.globalData.userInfo.IsPay,
74
       IsLoseEfficacy: app.globalData.userInfo.IsLoseEfficacy,
74
       IsLoseEfficacy: app.globalData.userInfo.IsLoseEfficacy,
75
       ClassTotalDayNumber: app.globalData.userInfo.ClassTotalDayNumber,
75
       ClassTotalDayNumber: app.globalData.userInfo.ClassTotalDayNumber,
76
+      ChildUserID: app.globalData.userInfo.ChildUserID,
76
     });
77
     });
77
 
78
 
78
     that.init();
79
     that.init();

+ 1 - 1
pages/other/userbook.wxml

@@ -50,7 +50,7 @@
50
         <view>推广计划</view>
50
         <view>推广计划</view>
51
       </view>
51
       </view>
52
 
52
 
53
-      <view class="panel21 FlexColumn" bindtap="goto" data-url="./binding">
53
+      <view class="panel21 FlexColumn" bindtap="goto" data-url="./binding"  wx:if="{{!ChildUserID}}">
54
         <image class="usermanual_index_handshake" src='../images/usermanual_index_link.png' />
54
         <image class="usermanual_index_handshake" src='../images/usermanual_index_link.png' />
55
         <view>帐号绑定</view>
55
         <view>帐号绑定</view>
56
       </view>
56
       </view>

+ 2 - 2
project.config.json

@@ -115,9 +115,9 @@
115
 				},
115
 				},
116
 				{
116
 				{
117
 					"id": 8,
117
 					"id": 8,
118
-					"name": "绑定",
118
+					"name": "pages/index/index",
119
 					"pathName": "pages/index/index",
119
 					"pathName": "pages/index/index",
120
-					"query": "type=bebound&ParentUserID=2&NickName=一二",
120
+					"query": "type=bebound&ParentUserID=1&BindTime=2019/12/10 17:20:54&NickName=程杰&AvatarUrl=https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83epkAJy0WEvyOEzLtHQ6BPV39ubS692yN5Qq30hic8hKTl0FmbuYGeaib1Uiaypic7GYfL15iczyWaUSK1Q/132",
121
 					"scene": 1007
121
 					"scene": 1007
122
 				}
122
 				}
123
 			]
123
 			]