chengjie 6 年之前
父节点
当前提交
db82498f26

+ 3 - 1
app.js

@@ -14,12 +14,13 @@ App({
14 14
     this.globalData.systemInfo = wx.getSystemInfoSync();
15 15
   },
16 16
   globalData: {
17
-    version: "1.1.0",
17
+    version: "1.1.1",
18 18
     IsProduction: true,
19 19
     ProgramID: 105,
20 20
     AppID: "wx1fef080f74481cbd",
21 21
     ProgramName: "数学计算题",
22 22
     ShareTitle: "认真练习,告别粗心",
23
+    SharePath: "pages/index/index",
23 24
     ShareImageUrl: '../../pages/images/programsystem_screenshot_pic01.png',
24 25
 
25 26
     fileUrl: "https://math-1253256735.file.myqcloud.com/",
@@ -38,5 +39,6 @@ App({
38 39
     IsShow: 0,
39 40
     NewUserNumberMax: 6,//邀请新用户最大值
40 41
     IsSaveCustom: false,//是否保存了定制
42
+    IsRefresh: false,
41 43
   }
42 44
 })

+ 23 - 0
app.wxss

@@ -33,6 +33,29 @@
33 33
   width:100%;
34 34
 }
35 35
 
36
+
37
+
38
+.button0 {
39
+  width:132rpx;
40
+  height:122rpx;
41
+  background-color: rgba(73,188,255,0.3);
42
+  /* border: 6rpx solid rgba(73,188,255,0.7); */
43
+  border-radius: 10rpx;
44
+  box-shadow: 0 14rpx 5rpx #213454,
45
+  0 24rpx 1rpx rgba(0,0,0,0.14);
46
+}
47
+
48
+
49
+.button1 {
50
+  width:120rpx;
51
+  height:100rpx;
52
+  color:#fff;
53
+  background-color: #B3443B;
54
+  border-radius: 10rpx;
55
+  box-shadow: 0 10rpx 1rpx #7D2B25;
56
+}
57
+
58
+
36 59
 /* 灰度去色 */
37 60
 .desaturate {
38 61
     filter: grayscale(100%);

+ 39 - 16
package4/main/activate.js

@@ -2,7 +2,7 @@ import common from '../../utils/util';
2 2
 import server from '../../utils/main';
3 3
 
4 4
 const app = getApp();
5
-var productList=[];
5
+var productList = [];
6 6
 
7 7
 Page({
8 8
   data: {
@@ -16,6 +16,9 @@ Page({
16 16
 
17 17
     this.init();
18 18
   },
19
+  onUnload:function(){
20
+    productList=[];
21
+  },
19 22
   init: function (e, isRemind) {
20 23
     var that = this;
21 24
     wx.showLoading({
@@ -31,21 +34,25 @@ Page({
31 34
               data[j].ImageUrl = programList[i].ImageUrl;
32 35
               data[j].appId = programList[i].appId;
33 36
               data[j].path = programList[i].path;
37
+              //不是当前小程序不解锁
38
+              if (app.globalData.ProgramID == data[j].ProductID)
39
+                app.globalData.userInfo.IsMember = 1;
34 40
             }
35 41
           }
36 42
         }
37 43
 
38
-        if (productList.length>0){
39
-          for(var i=0;i<productList.length;i++){
40
-            var b=false;
41
-            for(var j=0;j<data.length;j++){
42
-              if (productList[i].ProductID == data[j].ProductID){
43
-                b=true;
44
+        if (productList.length > 0) {
45
+          for (var i = 0; i < productList.length; i++) {
46
+            var b = false;
47
+            for (var j = 0; j < data.length; j++) {
48
+              if (productList[i].ProductID == data[j].ProductID) {
49
+                b = true;
50
+                
44 51
                 break;
45 52
               }
46 53
             }
47
-            if (!b){
48
-              productList[i].IsActivate=1;
54
+            if (!b) {
55
+              productList[i].IsActivate = 1;
49 56
               data.push(productList[i]);
50 57
             }
51 58
           }
@@ -55,9 +62,7 @@ Page({
55 62
           List: data,
56 63
         });
57 64
 
58
-        productList=data;
59
-
60
-        wx.hideLoading();
65
+        productList = data;
61 66
 
62 67
         if (isRemind) {
63 68
           wx.showModal({
@@ -69,13 +74,31 @@ Page({
69 74
         }
70 75
 
71 76
         wx.setStorageSync("HasActivate", 1);
77
+        wx.hideLoading();
72 78
       }
73 79
       else {
74
-        wx.redirectTo({
75
-          url: "./activateFinish",
76
-        });
77
-        wx.removeStorageSync("HasActivate");
80
+        if (isRemind) {
81
+          var arr = [];
82
+          for (var i = 0; i < productList.length; i++) {
83
+            arr.push(productList[i].ProductID);
84
+          }
85
+          wx.redirectTo({
86
+            url: "./activateFinish?idarr="+arr.join(","),
87
+          });
88
+          productList = [];
89
+          wx.removeStorageSync("HasActivate");
90
+        }
91
+        else{
92
+          for (var i = 0; i < productList.length; i++) {
93
+            productList[i].IsActivate = 1;
94
+          }
95
+          that.setData({
96
+            List: productList,
97
+          });
98
+        }
78 99
       }
100
+      wx.hideLoading();
101
+
79 102
     });
80 103
   },
81 104
   gotoFeedback: function () {

+ 16 - 1
package4/main/activateFinish.js

@@ -7,10 +7,20 @@ Page({
7 7
   data: {
8 8
   },
9 9
   onLoad: function (options) {
10
+    var idarr=options.idarr.split(",");
11
+    var list = server.getProgramList();
12
+    var arr=[];
13
+    for(var i=0;i<list.length;i++){
14
+      for(var j=0;j<idarr.length;j++){
15
+        if (idarr[j]==list[i].ID){
16
+          arr.push(list[i]);
17
+        }
18
+      }
19
+    }
10 20
 
11 21
     this.setData({
12 22
       Containnerheight: common.getSystemHeight(),
13
-      ProgramList: server.getProgramList(),
23
+      ProgramList: arr,
14 24
       ProgramID:app.globalData.ProgramID,
15 25
     });
16 26
   },
@@ -25,6 +35,11 @@ Page({
25 35
       }
26 36
     });
27 37
   },
38
+  gotoFinish: function () {
39
+    wx.reLaunch({
40
+      url: '../../pages/index/index',
41
+    });
42
+  },
28 43
   onShareAppMessage: function () {
29 44
     return {
30 45
       title: app.globalData.ShareTitle,

+ 4 - 2
package4/main/activateFinish.wxml

@@ -23,6 +23,8 @@
23 23
       <view class='btnRefresh' wx:if="{{ProgramID!=item.ID}}">去使用</view>
24 24
     </view>
25 25
   </view>
26
-<view class='lineFooter'></view>
27
-
26
+  <view class='lineFooter'></view>
27
+  <view class='footer FlexRow' bindtap="gotoFinish">
28
+    前往首页
29
+  </view>
28 30
 </view>

+ 13 - 1
package4/main/activateFinish.wxss

@@ -63,4 +63,16 @@
63 63
   font-size:24rpx;
64 64
   text-align: center;
65 65
   line-height: 50rpx;
66
-}
66
+}
67
+
68
+.footer{
69
+  width: 100%;
70
+  height: 140rpx;
71
+  position: fixed;
72
+  bottom: 0;
73
+  line-height: 140rpx;
74
+  font-size:48rpx;
75
+  color:#fff;
76
+  text-align: center;
77
+  background-color: #03AF69;
78
+}

+ 6 - 0
package4/main/activateOK.js

@@ -5,6 +5,7 @@ const app = getApp();
5 5
 
6 6
 Page({
7 7
   data: {
8
+    ShowNumber:0,
8 9
   },
9 10
   onLoad: function (options) {
10 11
 
@@ -13,6 +14,11 @@ Page({
13 14
     });
14 15
     this.updateData(options);
15 16
   },
17
+  onShow: function(){
18
+    this.setData({
19
+      ShowNumber:this.data.ShowNumber,
20
+    })
21
+  },
16 22
   updateData: function (param) {
17 23
     var that = this;
18 24
     server.getData('UpdateWXUsersAll500?ProductID=' + param.ProductID

+ 4 - 4
package4/main/buyad.js

@@ -24,17 +24,17 @@ Page({
24 24
     }
25 25
   },
26 26
   gotoOrder: function () {
27
-    wx.navigateTo({
28
-      url: "./order?id="+app.globalData.ProgramID+"&paytype=3",
27
+    wx.redirectTo({
28
+      url: "./order?id=" + app.globalData.ProgramID + "&paytype=3",
29 29
     });
30 30
   },
31 31
   gotoPackList: function () {
32
-    wx.navigateTo({
32
+    wx.redirectTo({
33 33
       url: "./list?IsGift=0",
34 34
     });
35 35
   },
36 36
   gotoGiftList: function () {
37
-    wx.navigateTo({
37
+    wx.redirectTo({
38 38
       url: "./list?IsGift=1",
39 39
     });
40 40
   },

+ 1 - 1
package4/main/giftinfo.js

@@ -36,7 +36,7 @@ Page({
36 36
       success(res) {
37 37
         if (!res.authSetting['scope.userInfo']) {
38 38
           wx.navigateTo({
39
-            url: '../../pages/index/userlogin?url=giftinfo'
39
+            url: '../../pages/main/accredit?url=giftinfo'
40 40
           });
41 41
         }
42 42
         else {

+ 13 - 1
package4/main/limited.js

@@ -6,14 +6,21 @@ const app = getApp();
6 6
 Page({
7 7
   data: {
8 8
     FileUrl: app.globalData.imageUrl,
9
+    IsShowButton:0,
9 10
   },
10 11
   onLoad: function (options) {
11
-
12
+    var IsShowButton = 0;
13
+    if (options.IsShowButton)
14
+      IsShowButton=options.IsShowButton;
12 15
     this.setData({
13 16
       Containnerheight: common.getSystemHeight(),
17
+      IsShowButton: IsShowButton
14 18
     });
15 19
     this.init();
16 20
   },
21
+  onUnload: function () {
22
+    app.globalData.IsRefresh=true;
23
+  },
17 24
   init: function () {
18 25
     var that = this;
19 26
     server.getData('GetWXUsersAllTime?ProductID=' + app.globalData.ProgramID + '&UserID=' + app.globalData.userInfo.UserID, function (data) {
@@ -34,6 +41,11 @@ Page({
34 41
   gotoFeedback: function () {
35 42
     server.gotoFeedback();
36 43
   },
44
+  gotoFinish:function(){
45
+    wx.reLaunch({
46
+      url: '../../pages/index/index',
47
+    });
48
+  },
37 49
   onShareAppMessage: function () {
38 50
     return {
39 51
       title: app.globalData.ShareTitle,

+ 3 - 1
package4/main/limited.wxml

@@ -15,7 +15,9 @@
15 15
     </view>
16 16
   </view>
17 17
   <view class='lineFooter'></view>
18
-
18
+  <view class='footer FlexRow' bindtap="gotoFinish" wx:if="{{IsShowButton==1}}">
19
+    前往首页
20
+  </view>
19 21
 
20 22
   <view class='panelFooter FlexRow' bindtap='gotoFeedback'>
21 23
     <view>如遇问题,请切换到“唱意教育家长助手”中</view>

+ 14 - 1
package4/main/limited.wxss

@@ -72,4 +72,17 @@
72 72
   color:#B3443B;
73 73
   text-decoration: underline;
74 74
   font-weight: 500;
75
-}
75
+}
76
+
77
+
78
+.footer{
79
+  width: 100%;
80
+  height: 140rpx;
81
+  position: fixed;
82
+  bottom: 0;
83
+  line-height: 140rpx;
84
+  font-size:48rpx;
85
+  color:#fff;
86
+  text-align: center;
87
+  background-color: #03AF69;
88
+}

+ 5 - 6
package4/main/order.js

@@ -50,9 +50,9 @@ Page({
50 50
         if (this.data.Coupon){
51 51
           price=price-Number(this.data.Coupon.Price);
52 52
         }
53
-        if (price.toString().indexOf(".") < 0) {
54
-          price = price + ".00";
55
-        }
53
+        
54
+        price = common.FormatMoney(price*100);
55
+
56 56
         detail = list[i].Detail;
57 57
         if (i==0)
58 58
           buytype=110;
@@ -104,9 +104,8 @@ Page({
104 104
         if (this.data.Coupon)
105 105
           price+=Number(this.data.Coupon.Price);
106 106
 
107
-        if (price.toString().indexOf(".")<0){
108
-          price=price+".00";
109
-        }
107
+        price = common.FormatMoney(price * 100);
108
+
110 109
         this.setData({
111 110
           IsDiscount: false,
112 111
           Coupon: list[i],

+ 5 - 4
package4/main/payfinish.js

@@ -22,14 +22,15 @@ Page({
22 22
 
23 23
     if (paytype == "4") {
24 24
       wx.setStorageSync("HasActivate", 1);
25
-      app.globalData.userInfo.IsMember = 1;
26
-      app.globalData.IsLocked = 0;
27 25
     }
28 26
     else if (paytype=="3"){
29 27
       app.globalData.userInfo.IsMember = 1;
30
-      app.globalData.IsLocked = 0;
31 28
     }
32 29
   }, 
30
+  onUnload: function () {
31
+    if (this.data.Paytype == "4") 
32
+      app.globalData.IsRefresh = true;
33
+  },
33 34
   gotoDefault: function() {
34 35
     wx.redirectTo({
35 36
       url: "../../pages/main/default",
@@ -38,7 +39,7 @@ Page({
38 39
   goto: function () {
39 40
     if (this.data.Paytype == "3") {
40 41
       wx.redirectTo({
41
-        url: "./limited",
42
+        url: "./limited?IsShowButton=1",
42 43
       });
43 44
     }
44 45
     if (this.data.Paytype == "4") {

+ 12 - 1
pages/index/index.js

@@ -35,6 +35,11 @@ Page({
35 35
           ProductUserID: options.ProductUserID,
36 36
         });
37 37
       }
38
+      if (options.GiftID) {
39
+        this.setData({
40
+          GiftID: options.GiftID,
41
+        });
42
+      }
38 43
     }
39 44
     this.setData({
40 45
       Containnerheight: server.getWindowHeight(),
@@ -154,7 +159,13 @@ Page({
154 159
           //app.globalData.userInfo.AvatarUrl = param.avatarUrl;
155 160
           that.getQuestionType(function () {
156 161
 
157
-            if (that.data.ProductID) {
162
+            if (that.data.GiftID) {
163
+              var url = "../../package4/main/giftcard?GiftID=" + that.data.GiftID + "&UserID=" + app.globalData.introducer
164
+              wx.redirectTo({
165
+                url: url
166
+              });
167
+            }
168
+            else if (that.data.ProductID) {
158 169
               var url = "../../package4/main/activateOK?ProductID=" + that.data.ProductID
159 170
                 + "&ProductUserID=" + that.data.ProductUserID
160 171
                 + "&CurrentUserID=" + app.globalData.userInfo.UserID

+ 17 - 41
pages/main/accredit.js

@@ -35,16 +35,6 @@ Page({
35 35
     }
36 36
 
37 37
   },
38
-  onUnload: function () {
39
-    wx.reLaunch({
40
-      url: '../main/default'
41
-    });
42
-  },
43
-  deblocking: function () {
44
-    wx.reLaunch({
45
-      url: '../index/index'
46
-    });
47
-  },
48 38
   goto: function (e) {
49 39
     var that = this;
50 40
     wx.getSetting({
@@ -80,40 +70,26 @@ Page({
80 70
         wx.getUserInfo({
81 71
           withCredentials: true,
82 72
           success: function (res) {
83
-            var userID = app.globalData.userInfo.UserID;
84
-            app.globalData.userInfo = res.userInfo;
85
-            app.globalData.userInfo.UserID = userID;
86
-
87
-            app.globalData.userInfo.NickName = app.globalData.userInfo.nickName;
88
-            app.globalData.userInfo.AvatarUrl = app.globalData.userInfo.avatarUrl;
89
-
90
-            // that.hasGetShareInfo(app.globalData.userInfo);
91
-            that.setData({
92
-              IsAccredit: true,
93
-              NickName: app.globalData.userInfo.NickName,
94
-              AvatarUrl: app.globalData.userInfo.AvatarUrl
95
-            });
96
-
97 73
             app.globalData.userInfo.Code = res0.code;
98 74
             app.globalData.userInfo.iv = res.iv;
99 75
             app.globalData.userInfo.encryptedData = res.encryptedData;
100
-            that.login(app.globalData.userInfo);
76
+
77
+            app.globalData.userInfo.NickName = res.userInfo.nickName;
78
+            app.globalData.userInfo.AvatarUrl = res.userInfo.avatarUrl;
79
+
80
+            that.login(app.globalData.userInfo, res.userInfo);
101 81
           },
102 82
           fail: function (res) {
103
-            wx.reLaunch({
104
-              url: '../index/index'
105
-            });
83
+
106 84
           }
107 85
         });
108 86
       },
109 87
       fail: function () {
110
-        wx.reLaunch({
111
-          url: '../index/index'
112
-        });
88
+
113 89
       }
114 90
     });
115 91
   },
116
-  login: function (param) {
92
+  login: function (param, param2) {
117 93
     var that = this;
118 94
     var url = "Login";
119 95
     switch (app.globalData.ProgramID) {
@@ -135,13 +111,13 @@ Page({
135 111
     }
136 112
     server.postData(url, {
137 113
       Code: param.Code,
138
-      NickName: param.nickName,
139
-      Language: param.language,
140
-      Gender: param.gender,
141
-      City: param.city,
142
-      Province: param.province,
143
-      Country: param.country,
144
-      AvatarUrl: param.avatarUrl,
114
+      NickName: param2.nickName,
115
+      AvatarUrl: param2.avatarUrl,
116
+      Language: param2.language,
117
+      Gender: param2.gender,
118
+      City: param2.city,
119
+      Province: param2.province,
120
+      Country: param2.country,
145 121
       ProgramVersion: app.globalData.Version,
146 122
       Introducer: app.globalData.introducer,
147 123
       UserSource: app.globalData.userSource,
@@ -150,8 +126,8 @@ Page({
150 126
       iv: param.iv,
151 127
       encryptedData: param.encryptedData,
152 128
     }, function (data) {
153
-      wx.reLaunch({
154
-        url: '../main/default'
129
+      wx.navigateBack({
130
+        delta: 1
155 131
       });
156 132
     });
157 133
   },

+ 1 - 1
pages/main/default.js

@@ -12,7 +12,7 @@ Page({
12 12
     version: app.globalData.version,
13 13
     FileUrl: app.globalData.fileUrl,
14 14
     NickName: "陌生用户",
15
-    IsMember: 0,
15
+    IsMember: 1,
16 16
     AvatarUrl: "",
17 17
     IsAccredit: false,
18 18
   },

+ 13 - 2
pages/main/list.js

@@ -30,8 +30,20 @@ Page({
30 30
       CategoryID: categoryID,
31 31
       Containnerheight: server.getWindowHeight(),
32 32
     });
33
+    
34
+  },
35
+  onShow: function(){
36
+    if (app.globalData.IsRefresh) {
37
+      wx.showLoading({
38
+        title: '请稍候',
39
+        mask: true,
40
+      });
41
+      setTimeout(function () {
42
+        wx.hideLoading();
43
+      }, 3000);
44
+      app.globalData.IsRefresh = false;
45
+    }
33 46
     this.getList();
34
-
35 47
   },
36 48
   onUnload: function () {
37 49
     this.closeHelp();
@@ -116,7 +128,6 @@ Page({
116 128
     this.setData({
117 129
       QuestionTypeList: list,
118 130
     });
119
-
120 131
   },
121 132
   openMenu: function (e) {
122 133
     this.data.filter = e.currentTarget.dataset.filter;

+ 0 - 2
utils/main.js

@@ -121,8 +121,6 @@ function payMoney(payType, buyType, money, detail, callback) {
121 121
               'signType': 'MD5',
122 122
               'paySign': data.paySign,
123 123
               'success': function (res3) {
124
-                app.globalData.userInfo.IsMember = 1;
125
-                app.globalData.userInfo.IsPay = 1;
126 124
                 console.log("success:" + res3);
127 125
                 callback(data);
128 126
               },

+ 20 - 0
utils/util.js

@@ -284,6 +284,25 @@ function getStorageValue(obj, name, defaultStatus, callback) {
284 284
   });
285 285
 }
286 286
 
287
+function FormatMoney(money) {
288
+  var result;
289
+  if (money == 0)
290
+    result = "0.00";
291
+  else {
292
+    result = (Math.round(money) / 100).toString();
293
+    //console.log("1:"+result);
294
+    if (result.indexOf(".") >= 0) {
295
+      if (result.substr(result.indexOf(".")).length < 3)
296
+        result += "0";
297
+    }
298
+    else {
299
+      result += ".00";
300
+    }
301
+  }
302
+
303
+  return result;
304
+}
305
+
287 306
 module.exports = {
288 307
   formatTime: formatTime,
289 308
   formatDateCHS: formatDateCHS,
@@ -303,4 +322,5 @@ module.exports = {
303 322
   isExistStr: isExistStr,
304 323
   getStorageValue: getStorageValue,
305 324
   getSystemHeight: getSystemHeight,
325
+  FormatMoney: FormatMoney,
306 326
 }